🎨 Add focus handling for paste actions in content menu and toolbar (#16190)

fix https://github.com/siyuan-note/siyuan/issues/16100 02
This commit is contained in:
Jeffrey Chen 2025-10-24 10:17:56 +08:00 committed by GitHub
parent 94b497b761
commit af26096dbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -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);

View file

@ -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") {