mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
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 {Constants} from "../constants";
|
||||||
import {textMenu} from "./text";
|
import {textMenu} from "./text";
|
||||||
|
|
||||||
|
|
||||||
export class Menus {
|
export class Menus {
|
||||||
public menu: Menu;
|
public menu: Menu;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,13 @@ export const textMenu = (target: Element) => {
|
||||||
label: window.siyuan.languages.copy,
|
label: window.siyuan.languages.copy,
|
||||||
icon: "iconCopy",
|
icon: "iconCopy",
|
||||||
click() {
|
click() {
|
||||||
|
if (getSelection().rangeCount === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const range = getSelection().getRangeAt(0);
|
||||||
|
if (!range.toString()) {
|
||||||
|
getSelection().getRangeAt(0).selectNode(target);
|
||||||
|
}
|
||||||
document.execCommand("copy");
|
document.execCommand("copy");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue