mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-25 08:24:06 +01:00
This commit is contained in:
parent
c0b68b1e5e
commit
df3bafdb48
5 changed files with 101 additions and 95 deletions
|
|
@ -64,6 +64,7 @@ import {processClonePHElement} from "../render/util";
|
|||
import {openFileById} from "../../editor/util";
|
||||
/// #endif
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
import {copyTextByType} from "../toolbar/util";
|
||||
|
||||
export class Gutter {
|
||||
public element: HTMLElement;
|
||||
|
|
@ -745,20 +746,7 @@ export class Gutter {
|
|||
}
|
||||
}).element);
|
||||
}
|
||||
const copyMenu: IMenu[] = [{
|
||||
id: "copy",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.copy,
|
||||
accelerator: "⌘C",
|
||||
click() {
|
||||
if (isNotEditBlock(selectsElement[0])) {
|
||||
focusBlock(selectsElement[0]);
|
||||
} else {
|
||||
focusByRange(getEditorRange(selectsElement[0]));
|
||||
}
|
||||
document.execCommand("copy");
|
||||
}
|
||||
}, {
|
||||
const copyMenu: IMenu[] = (copySubMenu(Array.from(selectsElement).map(item => item.getAttribute("data-node-id")), true, selectsElement[0]) as IMenu[]).concat([{
|
||||
id: "copyPlainText",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.copyPlainText,
|
||||
|
|
@ -771,6 +759,19 @@ export class Gutter {
|
|||
copyPlainText(html.trimEnd());
|
||||
focusBlock(selectsElement[0]);
|
||||
}
|
||||
}, {
|
||||
id: "copy",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.copy,
|
||||
accelerator: "⌘C",
|
||||
click() {
|
||||
if (isNotEditBlock(selectsElement[0])) {
|
||||
focusBlock(selectsElement[0]);
|
||||
} else {
|
||||
focusByRange(getEditorRange(selectsElement[0]));
|
||||
}
|
||||
document.execCommand("copy");
|
||||
}
|
||||
}, {
|
||||
id: "duplicate",
|
||||
iconHTML: "",
|
||||
|
|
@ -780,10 +781,20 @@ export class Gutter {
|
|||
click() {
|
||||
duplicateBlock(selectsElement, protyle);
|
||||
}
|
||||
}];
|
||||
}]);
|
||||
copyMenu.splice(4, 1, {
|
||||
id: "copyHPath",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.copyHPath,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.copyHPath.custom,
|
||||
click: () => {
|
||||
copyTextByType([selectsElement[0].getAttribute("data-node-id")], "hPath");
|
||||
focusBlock(selectsElement[0]);
|
||||
}
|
||||
});
|
||||
const copyTextRefMenu = this.genCopyTextRef(selectsElement);
|
||||
if (copyTextRefMenu) {
|
||||
copyMenu.splice(2, 0, copyTextRefMenu);
|
||||
copyMenu.splice(7, 0, copyTextRefMenu);
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copy",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue