diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index c02fc2dbc..0845ca487 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -825,6 +825,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => { icon: "iconPaste", accelerator: "⌘V", async click() { + focusByRange(getEditorRange(nodeElement)); if (document.queryCommandSupported("paste")) { document.execCommand("paste"); } else { @@ -850,6 +851,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => { id: "pasteEscaped", label: window.siyuan.languages.pasteEscaped, click() { + focusByRange(getEditorRange(nodeElement)); pasteEscaped(protyle, nodeElement); } }).element); diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index 406f21793..7998617e6 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -1685,6 +1685,7 @@ ${item.name} updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML); this.subElement.classList.add("fn__none"); } else if (action === "paste") { + focusByRange(getEditorRange(nodeElement)); if (document.queryCommandSupported("paste")) { document.execCommand("paste"); } else { @@ -1708,6 +1709,7 @@ ${item.name} pasteAsPlainText(protyle); this.subElement.classList.add("fn__none"); } else if (action === "pasteEscaped") { + focusByRange(getEditorRange(nodeElement)); pasteEscaped(protyle, nodeElement); this.subElement.classList.add("fn__none"); } else if (action === "back") {