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.
After reordering the rows editor behavior is normal
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.
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.
Status | New | ⇒ | Information Required |
Labels |
Added:
J3 Issue
|
Title |
|
I can confirm this problem, maybe someone with better js knowledge then me could look at this.
We support 3.x for at least 2 years after j 4.0 release so this should be fixed.
closed for Reason stated above.
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-05-28 11:39:53 |
Closed_By | ⇒ | franz-wohlkoenig |
Status | Closed | ⇒ | New |
Closed_Date | 2019-05-28 11:39:53 | ⇒ | |
Closed_By | franz-wohlkoenig | ⇒ |
Status | New | ⇒ | Discussion |
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" :
// 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.
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?
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
Labels |
Added:
J4 Issue
|
@apophis1982 Could you test PR #34808 ? Thanks in advance.
@pixxelfactory Could you test PR #34808 ? Thanks in advance.
I have planed, it need more changes there,
it will be not quick fix, maybe another 2 year ;)
Just in time for 4.0 final then ;-)
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: ? |
Status | Closed | ⇒ | New |
Closed_Date | 2021-11-28 18:32:43 | ⇒ | |
Closed_By | wilsonge | ⇒ |
OK Just realised the comment about keeping it open for J4
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-11-28 18:33:42 |
Closed_By | ⇒ | wilsonge |
@HLeithner can you please comment?