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

This commit is contained in:
ralf 2022-12-02 14:42:36 +01:00
parent a70e470ffb
commit e72e628c81

View File

@ -305,13 +305,14 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
self.resetDirty(); self.resetDirty();
if (self.editor && self.editor.editorContainer) if (self.editor && self.editor.editorContainer)
{ {
const activeElement = document.activeElement;
self.editor.formatter.toggle(rte_formatblock); self.editor.formatter.toggle(rte_formatblock);
jQuery(self.editor.editorContainer).height(self.options.height); jQuery(self.editor.editorContainer).height(self.options.height);
jQuery(self.editor.iframeElement.contentWindow.document).on('dragenter', function(){ 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'); 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 // give focus back
self.getInstanceManager().focusOnFirstInput(); activeElement && activeElement.focus && activeElement.focus();
} }
}); });
} }