No Code Attached Yet bug
avatar Flowman
Flowman
22 May 2023

Steps to reproduce the issue

  1. Create form with subform field and have an editor field.
  2. Change default editor to CodeMirror.
  3. Drag the entry around.

issue

Expected result

Editor should not duplicate itself.

Actual result

Editor duplicates itself.

System information (as much as possible)

PHP Version | 8.0.28
nginx/1.23.1
Joomla! 4.3.1 Stable [ Bora ] 2-May-2023 16:00 GMT
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0

Additional comments

It works fine with any other editor but CodeMirror.

Example form:

<field
    name="pages"
    type="subform"
    label="Pages"
    multiple="true"
    layout="joomla.form.field.subform.repeatable"
    >
    <form>
        <field
            name="title"
            type="text"
            label="Title"
        />
        <field
            name="content"
            type="editor"
            label="Content"
            filter="JComponentHelper::filterText"
            buttons="false"
        />
    </form>
</field>
avatar Flowman Flowman - open - 22 May 2023
avatar joomla-cms-bot joomla-cms-bot - change - 22 May 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 22 May 2023
avatar richard67 richard67 - change - 22 May 2023
Labels Added: bug
avatar richard67 richard67 - labeled - 22 May 2023
avatar Fedik
Fedik - comment - 22 May 2023

I can confirm, the bug happens because disconnectedCallback does not destroy an old instance.

disconnectedCallback() {
// Remove from the Joomla API
delete Joomla.editors.instances[this.element.id];
// Remove from observer
this.intersectionObserver.unobserve(this);
}

This is for whole 4.x, not specific for only 4.3

avatar Fedik Fedik - change - 22 May 2023
Title
[4.3] Subform with CodeMirror duplicates editor on dragable
Subform with CodeMirror duplicates editor on dragable
avatar Fedik Fedik - edited - 22 May 2023

Add a Comment

Login with GitHub to post a comment