mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-11-02 10:16:50 +01:00
fixed editor keydown propagation outside of form
This commit is contained in:
1 parent
9205b11dc3
commit
74defc48b9
3 files changed
+7
-7
No files matched your search
@@ -134,18 +134,18 @@ window.app.components.tinymce = function(propsArg = {}) {
|
||||
oldChange = null;
|
||||
}
|
||||
|
||||
async function initEditor(el) {
|
||||
async function initEditor(editorTarget) {
|
||||
await loadTinyMCE();
|
||||
|
||||
destroyEditor();
|
||||
|
||||
// removed while loading
|
||||
if (!el.isConnected) {
|
||||
if (!editorTarget?.isConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
const opts = {
|
||||
target: el,
|
||||
target: editorTarget,
|
||||
content_style: cssVars,
|
||||
branding: false,
|
||||
promotion: false,
|
||||
@@ -254,10 +254,10 @@ window.app.components.tinymce = function(propsArg = {}) {
|
||||
|
||||
// propagate save shortcut to the parent
|
||||
editor.on("keydown", (e) => {
|
||||
if ((e.ctrlKey || e.metaKey) && e.code == "KeyS" && editor.formElement) {
|
||||
if ((e.ctrlKey || e.metaKey) && e.code == "KeyS" && editorTarget) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
editor.formElement.dispatchEvent(new KeyboardEvent("keydown", e));
|
||||
editorTarget.dispatchEvent(new KeyboardEvent("keydown", e));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user