fixed editor keydown propagation outside of form
This commit is contained in:
File diff suppressed because one or more lines are too long
2
ui/dist/index.html
vendored
2
ui/dist/index.html
vendored
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<!-- prism -->
|
<!-- prism -->
|
||||||
<script src="./libs/prism/prism.js" data-manual></script>
|
<script src="./libs/prism/prism.js" data-manual></script>
|
||||||
<script type="module" crossorigin src="./assets/index-Df_7yJLi.js"></script>
|
<script type="module" crossorigin src="./assets/index-DKobRcoE.js"></script>
|
||||||
<link rel="modulepreload" crossorigin href="./assets/pocketbase.es-B_4DUNUU.js">
|
<link rel="modulepreload" crossorigin href="./assets/pocketbase.es-B_4DUNUU.js">
|
||||||
<link rel="stylesheet" crossorigin href="./assets/index-ouas71Vg.css">
|
<link rel="stylesheet" crossorigin href="./assets/index-ouas71Vg.css">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -134,18 +134,18 @@ window.app.components.tinymce = function(propsArg = {}) {
|
|||||||
oldChange = null;
|
oldChange = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function initEditor(el) {
|
async function initEditor(editorTarget) {
|
||||||
await loadTinyMCE();
|
await loadTinyMCE();
|
||||||
|
|
||||||
destroyEditor();
|
destroyEditor();
|
||||||
|
|
||||||
// removed while loading
|
// removed while loading
|
||||||
if (!el.isConnected) {
|
if (!editorTarget?.isConnected) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
target: el,
|
target: editorTarget,
|
||||||
content_style: cssVars,
|
content_style: cssVars,
|
||||||
branding: false,
|
branding: false,
|
||||||
promotion: false,
|
promotion: false,
|
||||||
@@ -254,10 +254,10 @@ window.app.components.tinymce = function(propsArg = {}) {
|
|||||||
|
|
||||||
// propagate save shortcut to the parent
|
// propagate save shortcut to the parent
|
||||||
editor.on("keydown", (e) => {
|
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.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
editor.formElement.dispatchEvent(new KeyboardEvent("keydown", e));
|
editorTarget.dispatchEvent(new KeyboardEvent("keydown", e));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user