Vanessa 2024-05-12 23:37:31 +08:00
parent 84819beaf7
commit fbc86d6a90
6 changed files with 39 additions and 6 deletions

26
app/src/menus/text.ts Normal file
View file

@ -0,0 +1,26 @@
import {Menu} from "../plugin/Menu";
export const textMenu = (target: Element) => {
const menu = new Menu();
if (menu.isOpen) {
return;
}
menu.addItem({
label: window.siyuan.languages.copy,
icon: "iconCopy",
click() {
document.execCommand("copy");
}
})
menu.addItem({
label: window.siyuan.languages.selectAll,
icon: "iconSelect",
click() {
if (getSelection().rangeCount === 0) {
return;
}
getSelection().getRangeAt(0).selectNode(target)
}
})
return menu
}