Hi,
we are using Subforms in Joomla to provide dynamic block-style layouts for our clients (so that they can add, edit, delete and sort blocks of content).
However there is one big issue: When creating editor-fields, as soon as you start to drag the subform-row, all the content inside editor-fields in that row will be eliminated instantly.
The joomla-devs know about this issue a long time, but don't care:
https://github.com/joomla/joomla-cms/issues/24343
So we tried to fix it on our own, modifying two javascript files:
- media/system/js/subform-repeatable.js:
We modified its code so that a subform-row-sort event gets triggered everytime a user drags a subform-row:
// bind move button
if(this.options.btMove){
this.$containerRows.sortable({
items: this.options.repeatableElement,
handle: this.options.btMove,
tolerance: 'pointer',
stop: function(event, ui) {
var $row = ui.item[0];
self.$container.trigger('subform-row-sort', $row);
}
});
}
And media/editors/tinymce/js/tinymce.min.js, inside the setupEditor function we add a condition wich eliminates the editor prior to rebuilding it if it exists alread:
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];
}
}
That way drag-and-drop works inside subforms, but only using the tinymce editor wich is aweful & terrible.
We tried to figure out if there is any way to fix this behaviour with jce...
Can you help us?
Thanks in advance
Best regards