This commit is contained in:
parent
8f6d9f312b
commit
d0f3ac29b6
2 changed files with 7 additions and 1 deletions
|
@ -15,7 +15,6 @@ import {App} from "../index";
|
|||
import {Constants} from "../constants";
|
||||
import {textMenu} from "./text";
|
||||
|
||||
|
||||
export class Menus {
|
||||
public menu: Menu;
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue