This commit is contained in:
Vanessa 2023-11-27 22:17:16 +08:00
parent f9edcd0690
commit 7ef7577821
3 changed files with 11 additions and 3 deletions

View file

@ -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));

View file

@ -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: {

View file

@ -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);