Display duplicate editors when dragging and dropping editors in the paragraph field

Created on 5 January 2024, 11 months ago
Updated 20 September 2024, 2 months ago

Problem/Motivation

When I drag and drop the editors used in a field allowing multiple values, more duplicate editors appear.

This happens both for a standard field such as the Body field, or Paragraph fields.

Steps to reproduce

Any field, like a Body-field:

  1. Set "Allowed number of values" to "Unlimited" for any field
  2. Add two or more instances
  3. Drag them, and see duplicates

Paragraphs:

  1. Add 3 or more editors (using template button) in 1 paragraph field
  2. Drag and drop these editors to change the sort order multiple times
  3. Occasionally, duplicate editors will appear

Without Ckeditor5 Template, no duplicates

Duplicates with Ckeditor5 Template

๐Ÿ› Bug report
Status

Needs review

Version

1.0

Component

User interface

Created by

๐Ÿ‡ป๐Ÿ‡ณVietnam trungnt34

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @trungnt34
  • ๐Ÿ‡ป๐Ÿ‡ณVietnam trungnt34
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany dbielke1986

    Hi trungnt34,

    Thanks for reporting this issue!
    Can you please check whether the problem also occurs when the template module is deactivated / when the button for the templates is not in the toolbar?

    I assume that this is not an issue with the ckeditor5_template module.

    BR
    Daniel

  • ๐Ÿ‡ป๐Ÿ‡ณVietnam trungnt34

    Hi dbielke1986,

    The phenomenon only occurs when the template button has been activated. I have tried many times with the original ckeditor5 but did not encounter this phenomenon.

    On the original ckeditor5, when dragging and dropping, sometimes the editor will flicker, but duplicate editors will not appear.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany dbielke1986

    Ok, I will install the paragraph field and try to reproduce the behavior.
    Iยดll keep you updated.

    BR

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark ressa Copenhagen

    I have also seen this with a plain Body-field, "Allowed number of values" set to "Unlimited". So it's really easy to reproduce, and I will add the steps in the Issue Summary.

    Allowing multi-values in a field is not uncommon, so it would be great to get this looked at.

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark ressa Copenhagen
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany dbielke1986

    I can reproduce this issue. Thank you for reporting and providing the needed information.
    We will resolve this issue as soon as possible.

    BR

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany dbielke1986

    We found the reason for this behavior, but currently we do not know how to fix this.
    Maybe the community has an idea?

    The root is the asynchronous include which we need for the "fetch" function. This again is needed to load the template file dynamically.

    https://git.drupalcode.org/project/ckeditor5_template/-/blob/1.0.x/js/ck...

    export default class Template extends Plugin {
        async init() {
            const editor = this.editor;
            const template_config = this.editor.config.get('template');
            console.log('Value: ', template_config['file_path']);
            const templateArray = await fetch(template_config['file_path'])
              .then(res => res.json())
              .catch(error => console.log(error));
            editor.ui.componentFactory.add('template', function (locale) {
    

    If we remove the "async" and load the file statically, the duplication of the editor cannot be reproduced.

  • Status changed to Closed: won't fix 8 months ago
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany vincent.hoehn Dresden, Germany
  • why was it closed ? the issue still occurs

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany vincent.hoehn Dresden, Germany

    Hi @adinan cenci,

    we have decided not to fix this issue. Please have a look at the drupal documentation about the issue status field โ†’

    BR
    Vincent

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark ressa Copenhagen

    So, this is still a bug, and multiple users encounter it ... I think it might be worth considering to keep the issue "Active", stating that it needs to be fixed, so that anyone who at some point finds a solution, finds this issue and can share it here. If the issue is closed, it may get overlooked.

  • I came up with this patch.

    Not the best solution I know, leaving the data in memory like that, but it works for me.

  • Status changed to Needs review 2 months ago
  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark ressa Copenhagen

    Thanks @adinan cenci! Hopefully someone with more code experience can review it.

  • Pipeline finished with Success
    2 months ago
    Total: 151s
    #286044
  • Assigned to vincent.hoehn
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany dbielke1986

    @vincent:

    Can you take a look at this, please?

Production build 0.71.5 2024