mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-30 21:38:48 +01:00
🎨 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:
parent
94b497b761
commit
af26096dbb
2 changed files with 4 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue