Vanessa 2024-05-20 17:56:14 +08:00
parent 8f6d9f312b
commit d0f3ac29b6
2 changed files with 7 additions and 1 deletions

View file

@ -15,7 +15,6 @@ import {App} from "../index";
import {Constants} from "../constants";
import {textMenu} from "./text";
export class Menus {
public menu: Menu;

View file

@ -9,6 +9,13 @@ export const textMenu = (target: Element) => {
label: window.siyuan.languages.copy,
icon: "iconCopy",
click() {
if (getSelection().rangeCount === 0) {
return;
}
const range = getSelection().getRangeAt(0);
if (!range.toString()) {
getSelection().getRangeAt(0).selectNode(target);
}
document.execCommand("copy");
}
});