瀏覽代碼

:art: https://github.com/siyuan-note/siyuan/issues/8742

Vanessa 2 年之前
父節點
當前提交
609b50d40a

+ 1 - 0
app/appearance/langs/en_US.json

@@ -899,6 +899,7 @@
   "column": "Column",
   "column": "Column",
   "copied": "Copied",
   "copied": "Copied",
   "copy": "Copy",
   "copy": "Copy",
+  "copyText": "Copy text *",
   "delete-column": "Delete Column",
   "delete-column": "Delete Column",
   "delete-row": "Delete Row",
   "delete-row": "Delete Row",
   "down": "Down",
   "down": "Down",

+ 1 - 0
app/appearance/langs/es_ES.json

@@ -899,6 +899,7 @@
   "column": "Columna",
   "column": "Columna",
   "copied": "Copiado",
   "copied": "Copiado",
   "copy": "Copiar",
   "copy": "Copiar",
+  "copyText": "Copiar texto *",
   "delete-column": "Borrar columna",
   "delete-column": "Borrar columna",
   "delete-row": "Borrar fila",
   "delete-row": "Borrar fila",
   "down": "Abajo",
   "down": "Abajo",

+ 1 - 0
app/appearance/langs/fr_FR.json

@@ -899,6 +899,7 @@
   "column": "Colonne",
   "column": "Colonne",
   "copied": "Copié",
   "copied": "Copié",
   "copy": "Copie",
   "copy": "Copie",
+  "copyText": "Copier le texte *",
   "delete-column": "Supprimer une Colonne",
   "delete-column": "Supprimer une Colonne",
   "delete-row": "Supprimer la rangée",
   "delete-row": "Supprimer la rangée",
   "down": "En bas",
   "down": "En bas",

+ 1 - 0
app/appearance/langs/zh_CHT.json

@@ -899,6 +899,7 @@
   "column": "行",
   "column": "行",
   "copied": "已複製",
   "copied": "已複製",
   "copy": "複製",
   "copy": "複製",
+  "copyText": "複製 文本 *",
   "delete-column": "刪除行",
   "delete-column": "刪除行",
   "delete-row": "刪除列",
   "delete-row": "刪除列",
   "down": "下",
   "down": "下",

+ 1 - 0
app/appearance/langs/zh_CN.json

@@ -899,6 +899,7 @@
   "column": "列",
   "column": "列",
   "copied": "已复制",
   "copied": "已复制",
   "copy": "复制",
   "copy": "复制",
+  "copyText": "复制 文本 *",
   "delete-column": "删除列",
   "delete-column": "删除列",
   "delete-row": "删除行",
   "delete-row": "删除行",
   "down": "下",
   "down": "下",

+ 1 - 0
app/src/constants.ts

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

+ 4 - 3
app/src/protyle/gutter/index.ts

@@ -729,7 +729,7 @@ export class Gutter {
 
 
         if (protyle?.app?.plugins) {
         if (protyle?.app?.plugins) {
             emitOpenMenu({
             emitOpenMenu({
-                plugins:protyle.app.plugins,
+                plugins: protyle.app.plugins,
                 type: "click-blockicon",
                 type: "click-blockicon",
                 detail: {
                 detail: {
                     protyle,
                     protyle,
@@ -1545,7 +1545,7 @@ export class Gutter {
 
 
         if (protyle?.app?.plugins) {
         if (protyle?.app?.plugins) {
             emitOpenMenu({
             emitOpenMenu({
-                plugins:protyle.app.plugins,
+                plugins: protyle.app.plugins,
                 type: "click-blockicon",
                 type: "click-blockicon",
                 detail: {
                 detail: {
                     protyle,
                     protyle,
@@ -1749,7 +1749,8 @@ export class Gutter {
             return false;
             return false;
         }
         }
         return {
         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() {
             click() {
                 // 用于标识复制文本 *
                 // 用于标识复制文本 *
                 selectsElement[0].setAttribute("data-reftext", "true");
                 selectsElement[0].setAttribute("data-reftext", "true");

+ 9 - 0
app/src/protyle/wysiwyg/keydown.ts

@@ -971,6 +971,15 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
             event.stopPropagation();
             event.stopPropagation();
             return true;
             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)) {
         if (matchHotKey(window.siyuan.config.keymap.editor.general.copyBlockRef.custom, event)) {
             event.preventDefault();
             event.preventDefault();
             event.stopPropagation();
             event.stopPropagation();