No Code Attached Yet J3 Issue J4 Issue
avatar apophis1982
apophis1982
25 Mar 2019

Steps to reproduce the issue

Create a new Field with type repeatable and add under form fields one field type Editor. Set options to be shown in a tab in article edit view. Create a new article go to the tab and add 2 rows. Write something in each editor field and save and reorder the rows.

Expected result

After reordering the rows editor behavior is normal

Actual result

After you release the mouse button after reordering the rows the editor field gets blank and uneditable but the content will be saved and after refresh loaded correctly.

System information (as much as possible)

Linux apache php 7.2 and 7.3. Joomla 3.9.4. Editor JCE Pro and TinyMCE (joomla standard). Also tried it with a new clean cloud installation via launch.joomla.

Additional comments

avatar apophis1982 apophis1982 - open - 25 Mar 2019
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Mar 2019
avatar ghost
ghost - comment - 27 Mar 2019

@HLeithner can you please comment?

avatar franz-wohlkoenig franz-wohlkoenig - change - 27 Mar 2019
Status New Information Required
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Apr 2019
Labels Added: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 4 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Apr 2019
Title
[3.9] (Subform)Repeatable editor blank after drag&drop reorder
(Subform)Repeatable editor blank after drag&drop reorder
avatar franz-wohlkoenig franz-wohlkoenig - edited - 19 Apr 2019
avatar HLeithner
HLeithner - comment - 28 May 2019

I can confirm this problem, maybe someone with better js knowledge then me could look at this.

avatar AndySDH
AndySDH - comment - 28 May 2019

Repeatable field is going away in Joomla 4. It will be replaced by the better version, called Subfields
See: #24711

Please test if the problem happens with this new version too and report in that PR.

avatar HLeithner
HLeithner - comment - 28 May 2019

We support 3.x for at least 2 years after j 4.0 release so this should be fixed.

avatar ghost
ghost - comment - 28 May 2019

closed for Reason stated above.

avatar franz-wohlkoenig franz-wohlkoenig - change - 28 May 2019
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2019-05-28 11:39:53
Closed_By franz-wohlkoenig
avatar franz-wohlkoenig franz-wohlkoenig - close - 28 May 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 May 2019
Status Closed New
Closed_Date 2019-05-28 11:39:53
Closed_By franz-wohlkoenig
avatar franz-wohlkoenig franz-wohlkoenig - reopen - 28 May 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 May 2019
Status New Discussion
avatar ryandemmer
ryandemmer - comment - 28 Jul 2019

The DOM is changed when the editors are sorted, so the editors need to be rebuilt.

Firstly, you need an event to be triggered when the sort is completed, which you can then use to trigger the re-initialisation of the editors.

As an example, an "update" option can be added to the sortable options in media/system/js/subform-repeatable.js to trigger a "subform-row-sort" :

See https://github.com/joomla/joomla-cms/blob/staging/media/system/js/subform-repeatable-uncompressed.js#L52-L58

// bind move button
if (this.options.btMove) {
    this.$containerRows.sortable({
        items: this.options.repeatableElement,
        handle: this.options.btMove,
        tolerance: 'pointer',
        update: function (event, ui) {
            var $row = ui.item[0];
            self.$container.trigger('subform-row-sort', $row);
        }
    });
}

then in media/editors/tinymce/js/tinymce.js, a listener triggers the editor setup after the sort :
See - https://github.com/joomla/joomla-cms/blob/staging/media/editors/tinymce/js/tinymce.js#L106-L115

jQuery(document).on('subform-row-sort', function (event, row) {
    Joomla.JoomlaTinyMCE.setupEditors(row);
});

but, the existing editor must first be removed before it is re-initialised, so adding a few lines to do this in the same file :

See - https://github.com/joomla/joomla-cms/blob/staging/media/editors/tinymce/js/tinymce.js#L59-L63

if (element) {
    // We already have the Target, so reset the selector and assign given element as target
    options.selector = null;
    options.target = element;

    var editor = tinymce.get(element.id);

    if (editor) {
        editor.remove();
        delete Joomla.editors.instances[element.id];
    }
}

The second part is for the core Tinymce only, but JCE will have it's own fix for this in the next update. The sortable event is required for all editors.

I will try and put this into a PR this coming week.

avatar pixxelfactory
pixxelfactory - comment - 29 Jun 2020

I can still confirm this bug on the current 3.9.19 release and tried to apply the above fix manually.
However it does not work...
Any way to fix this in the current release?

avatar Fedik
Fedik - comment - 17 Jul 2021

It is Browser behavior,
Explanation https://stackoverflow.com/a/2542043/1000711

In short: browser will clear iframe content when DOM changes,

@ryandemmer idea should work

avatar Fedik
Fedik - comment - 17 Jul 2021

Please test #34808 Joomla 3 fix.

However it still an issue for Joomla 4, so please keep it open for now.

avatar Quy Quy - change - 17 Jul 2021
Labels Added: J4 Issue
avatar Quy Quy - labeled - 17 Jul 2021
avatar richard67
richard67 - comment - 18 Jul 2021

@apophis1982 Could you test PR #34808 ? Thanks in advance.

avatar richard67
richard67 - comment - 18 Jul 2021

@pixxelfactory Could you test PR #34808 ? Thanks in advance.

avatar richard67
richard67 - comment - 18 Jul 2021

However it still an issue for Joomla 4, so please keep it open for now.

@Fedik Will you also make a fix for J4?

avatar Fedik
Fedik - comment - 18 Jul 2021

I have planed, it need more changes there,
it will be not quick fix, maybe another 2 year ;)

avatar richard67
richard67 - comment - 18 Jul 2021

Just in time for 4.0 final then ;-)

avatar wilsonge wilsonge - change - 28 Nov 2021
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2021-11-28 18:32:43
Closed_By wilsonge
Labels Added: No Code Attached Yet
Removed: ?
avatar wilsonge wilsonge - close - 28 Nov 2021
avatar wilsonge
wilsonge - comment - 28 Nov 2021

Fixed with #34808

avatar wilsonge wilsonge - change - 28 Nov 2021
Status Closed New
Closed_Date 2021-11-28 18:32:43
Closed_By wilsonge
avatar wilsonge wilsonge - reopen - 28 Nov 2021
avatar wilsonge
wilsonge - comment - 28 Nov 2021

OK Just realised the comment about keeping it open for J4 ?

avatar wilsonge wilsonge - change - 28 Nov 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-11-28 18:33:42
Closed_By wilsonge
avatar wilsonge wilsonge - close - 28 Nov 2021
avatar Fedik
Fedik - comment - 18 Dec 2021

The fix for Joomla 4, please test #36345

Add a Comment

Login with GitHub to post a comment