User tests: Successful: Unsuccessful:
Pull Request for Issue #24343 .
Browser will clear iframe content when DOM changes, so we need to re-init the editor every time.
This fix only for Joomla 3.
Based on @ryandemmer idea, but more simple, without introducing new events.
Apply patch and please follow #24343
Editor lose the content
Editor works
none
Status | New | ⇒ | Pending |
Category | ⇒ | JavaScript External Library |
Have restarted the drone and it seems it has helped.
I have tested this item
I would suggest that if you are going to use the "sortstop" event bound to the document object, then you check that it is actually sorting a subform, eg:
jQuery(document).on('sortstop', function (event, ui) {
if (ui.item[0] && jQuery(ui.item[0]).is('.subform-repeatable-group')) {
Joomla.JoomlaTinyMCE.setupEditors(ui.item[0]);
}
});
Or better yet, bind to the subform container instead, eg:
jQuery(document).on('sortstop', '.subform-repeatable .ui-sortable', function (e, ui) {
if (ui.item[0]) {
Joomla.JoomlaTinyMCE.setupEditors(ui.item[0]);
}
});
I thought about it, but from other hand it will help also for someone who use own jquery UI sorting with editor.
The main issue comes from jquery UI.
If you don't bind the event specfically to the subform, then the event will trigger whenever a sortable occurs, regardless of whether it is on a subform or not. This is inefficient and unnecessary, and could cause unforseen issues.
Not really, Joomla.JoomlaTinyMCE.setupEditors()
will care about existing editor.
Using jQuery delegation just add one more if()
in the chain.
In one or another way it will be the same if talk about efficiency ;)
then the event will trigger whenever a sortable occurs, regardless of whether it is on a subform or not.
And that is potential side effect (positive one), for people who use Editor with UI Sortable but not in subform.
I have tested it and there is an issue:
If you add a row and try to reorder it without saving the article first, the content disappears (tested with this repo with stock tinymce).
And it does not work at all using JCE (newest version, JCE Core).. =(
And it does not work at all using JCE
Please test with core TinyMCE editor,
JCE should implement its own fix, because it the editor issue
And it does not work at all using JCE (newest version, JCE Core).. =(
This will be fixed independantly in the next JCE update, as this current core fix cannot be applied to JCE.
Ok, done, it works, except in one case: If you add an editor and try to reorder it without saving the article first, in that case the content is emptied.
hmhm, I will check
It's a good idea to remove the editor first, before re-initialising it. This also saves the content to the textarea, which would prevent the content from dissappearing. See my comment here - #24343 (comment)
It's a good idea to remove the editor first, before re-initialising it.
It done here already.
On quick check it some random TinyMCE bug, happened when call editor.remove()
.
In most cases it works okay, but sometimes it cause TypeError: Cannot read property 'startContainer' of null
Labels |
Added:
?
|
I have tested this item
Works good to me thanks
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-11-21 13:18:24 |
Closed_By | ⇒ | zero-24 |
Drone fail with MySQL connection error, that not related to javascript changes