Vanessa 2023-07-12 18:32:23 +08:00
parent ac31b61a19
commit 609b50d40a
8 changed files with 19 additions and 3 deletions

View file

@ -253,6 +253,7 @@ export abstract class Constants {
hLayout: {default: "", custom: ""},
vLayout: {default: "", custom: ""},
refPopover: {default: "", custom: ""},
copyText: {default: "", custom: ""},
expand: {default: "⌘↓", custom: "⌘↓"},
collapse: {default: "⌘↑", custom: "⌘↑"},
insertBottom: {default: "⌥⌘.", custom: "⌥⌘."},

View file

@ -729,7 +729,7 @@ export class Gutter {
if (protyle?.app?.plugins) {
emitOpenMenu({
plugins:protyle.app.plugins,
plugins: protyle.app.plugins,
type: "click-blockicon",
detail: {
protyle,
@ -1545,7 +1545,7 @@ export class Gutter {
if (protyle?.app?.plugins) {
emitOpenMenu({
plugins:protyle.app.plugins,
plugins: protyle.app.plugins,
type: "click-blockicon",
detail: {
protyle,
@ -1749,7 +1749,8 @@ export class Gutter {
return false;
}
return {
label: `${window.siyuan.languages.copy} ${window.siyuan.languages.text} *`,
accelerator: window.siyuan.config.keymap.editor.general.copyText.custom,
label: window.siyuan.languages.copyText,
click() {
// 用于标识复制文本 *
selectsElement[0].setAttribute("data-reftext", "true");

View file

@ -971,6 +971,15 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
event.stopPropagation();
return true;
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.copyText.custom, event)) {
// 用于标识复制文本 *
nodeElement.setAttribute("data-reftext", "true");
focusByRange(getEditorRange(nodeElement));
document.execCommand("copy");
event.preventDefault();
event.stopPropagation();
return true;
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.copyBlockRef.custom, event)) {
event.preventDefault();
event.stopPropagation();