Переглянути джерело

:art: fix https://github.com/siyuan-note/siyuan/issues/9754

Vanessa 1 рік тому
батько
коміт
7ef7577821
3 змінених файлів з 11 додано та 3 видалено
  1. 9 3
      app/src/boot/globalEvent/keydown.ts
  2. 1 0
      app/src/constants.ts
  3. 1 0
      app/src/menus/tab.ts

+ 9 - 3
app/src/boot/globalEvent/keydown.ts

@@ -72,6 +72,7 @@ import {quickMakeCard} from "../../card/makeCard";
 import {copyPNG} from "../../menus/util";
 import {copyPNG} from "../../menus/util";
 import {getContentByInlineHTML} from "../../protyle/wysiwyg/keydown";
 import {getContentByInlineHTML} from "../../protyle/wysiwyg/keydown";
 import {searchKeydown} from "./searchKeydown";
 import {searchKeydown} from "./searchKeydown";
+import {openNewWindow} from "../../window/openNewWindow";
 
 
 const switchDialogEvent = (app: App, event: MouseEvent) => {
 const switchDialogEvent = (app: App, event: MouseEvent) => {
     event.preventDefault();
     event.preventDefault();
@@ -1577,14 +1578,19 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
         return;
         return;
     }
     }
 
 
-    if ((matchHotKey(window.siyuan.config.keymap.general.splitLR.custom, event) ||
+    if ((
+        matchHotKey(window.siyuan.config.keymap.general.splitLR.custom, event) ||
         matchHotKey(window.siyuan.config.keymap.general.splitMoveR.custom, event) ||
         matchHotKey(window.siyuan.config.keymap.general.splitMoveR.custom, event) ||
         matchHotKey(window.siyuan.config.keymap.general.splitTB.custom, event) ||
         matchHotKey(window.siyuan.config.keymap.general.splitTB.custom, event) ||
-        matchHotKey(window.siyuan.config.keymap.general.splitMoveB.custom, event)) && !event.repeat) {
+        matchHotKey(window.siyuan.config.keymap.general.tabToWindow.custom, event) ||
+        matchHotKey(window.siyuan.config.keymap.general.splitMoveB.custom, event)
+    ) && !event.repeat) {
         event.preventDefault();
         event.preventDefault();
         const tab = getActiveTab(false);
         const tab = getActiveTab(false);
         if (tab) {
         if (tab) {
-            if (matchHotKey(window.siyuan.config.keymap.general.splitLR.custom, event)) {
+            if (matchHotKey(window.siyuan.config.keymap.general.tabToWindow.custom, event)) {
+                openNewWindow(tab);
+            } else if (matchHotKey(window.siyuan.config.keymap.general.splitLR.custom, event)) {
                 tab.parent.split("lr").addTab(copyTab(app, tab));
                 tab.parent.split("lr").addTab(copyTab(app, tab));
             } else if (matchHotKey(window.siyuan.config.keymap.general.splitTB.custom, event)) {
             } else if (matchHotKey(window.siyuan.config.keymap.general.splitTB.custom, event)) {
                 tab.parent.split("tb").addTab(copyTab(app, tab));
                 tab.parent.split("tb").addTab(copyTab(app, tab));

+ 1 - 0
app/src/constants.ts

@@ -279,6 +279,7 @@ export abstract class Constants {
             closeUnmodified: {default: "", custom: ""},
             closeUnmodified: {default: "", custom: ""},
             closeLeft: {default: "", custom: ""},
             closeLeft: {default: "", custom: ""},
             closeRight: {default: "", custom: ""},
             closeRight: {default: "", custom: ""},
+            tabToWindow: {default: "", custom: ""},
         },
         },
         editor: {
         editor: {
             general: {
             general: {

+ 1 - 0
app/src/menus/tab.ts

@@ -210,6 +210,7 @@ export const initTabMenu = (app: App, tab: Tab) => {
     /// #if !BROWSER
     /// #if !BROWSER
     window.siyuan.menus.menu.append(new MenuItem({
     window.siyuan.menus.menu.append(new MenuItem({
         label: window.siyuan.languages.tabToWindow,
         label: window.siyuan.languages.tabToWindow,
+        accelerator: window.siyuan.config.keymap.general.tabToWindow.custom,
         icon: "iconOpenWindow",
         icon: "iconOpenWindow",
         click: () => {
         click: () => {
             openNewWindow(tab);
             openNewWindow(tab);