give focus back to previous active element instead of focusing on first input

This commit is contained in:
ralf 2022-12-02 14:43:19 +01:00
parent 43b6202dfc
commit 7b29b5dbe5
2 changed files with 7 additions and 5 deletions

View File

@ -166,14 +166,15 @@ var et2_htmlarea = /** @class */ (function (_super) {
self.set_value(self.htmlNode.val());
self.resetDirty();
if (self.editor && self.editor.editorContainer) {
const activeElement = document.activeElement;
self.editor.formatter.toggle(rte_formatblock);
jQuery(self.editor.editorContainer).height(self.options.height);
jQuery(self.editor.iframeElement.contentWindow.document).on('dragenter', function () {
if (jQuery('#dragover-tinymce').length < 1)
jQuery("<style id='dragover-tinymce'>.dragover:after {height:calc(100% - " + jQuery(this).height() + "px) !important;}</style>").appendTo('head');
});
//set back focus to the first field in the form
self.getInstanceManager().focusOnFirstInput();
// give focus back
activeElement && activeElement.focus && activeElement.focus();
}
});
};

View File

@ -299,13 +299,14 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
self.resetDirty();
if (self.editor && self.editor.editorContainer)
{
const activeElement = document.activeElement;
self.editor.formatter.toggle(rte_formatblock);
jQuery(self.editor.editorContainer).height(self.options.height);
jQuery(self.editor.iframeElement.contentWindow.document).on('dragenter', function(){
if (jQuery('#dragover-tinymce').length < 1) jQuery("<style id='dragover-tinymce'>.dragover:after {height:calc(100% - "+jQuery(this).height()+"px) !important;}</style>").appendTo('head');
});
//set back focus to the first field in the form
self.getInstanceManager().focusOnFirstInput();
// give focus back
activeElement && activeElement.focus && activeElement.focus();
}
});
}
@ -587,4 +588,4 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
}
}
}
et2_register_widget(et2_htmlarea, ["htmlarea"]);
et2_register_widget(et2_htmlarea, ["htmlarea"]);