mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-21 11:30:42 +08:00
This commit is contained in:
parent
67d107772a
commit
cb1f00b0be
@ -1480,11 +1480,7 @@ const panelTreeKeydown = (app: App, event: KeyboardEvent) => {
|
||||
hasClosestByClassName(target, "protyle", true)) {
|
||||
return false;
|
||||
}
|
||||
if (!matchHotKey(window.siyuan.config.keymap.editor.general.collapse.custom, event) &&
|
||||
!matchHotKey(window.siyuan.config.keymap.editor.general.expand.custom, event) &&
|
||||
!event.key.startsWith("Arrow") && event.key !== "Enter") {
|
||||
return false;
|
||||
}
|
||||
|
||||
let activePanelElement = document.querySelector(".layout__tab--active");
|
||||
if (!activePanelElement) {
|
||||
Array.from(document.querySelectorAll(".layout__wnd--active .layout-tab-container > div")).find(item => {
|
||||
@ -1500,6 +1496,28 @@ const panelTreeKeydown = (app: App, event: KeyboardEvent) => {
|
||||
if (activePanelElement.className.indexOf("sy__") === -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let matchCommand = false;
|
||||
app.plugins.find(item => {
|
||||
item.commands.find(command => {
|
||||
if (command.dockCallback && matchHotKey(command.customHotkey, event)) {
|
||||
matchCommand = true;
|
||||
command.dockCallback(activePanelElement as HTMLElement);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (matchCommand) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (matchCommand) {
|
||||
return true;
|
||||
}
|
||||
if (!matchHotKey(window.siyuan.config.keymap.editor.general.collapse.custom, event) &&
|
||||
!matchHotKey(window.siyuan.config.keymap.editor.general.expand.custom, event) &&
|
||||
!event.key.startsWith("Arrow") && event.key !== "Enter") {
|
||||
return false;
|
||||
}
|
||||
if (!event.repeat && matchHotKey(window.siyuan.config.keymap.editor.general.collapse.custom, event)) {
|
||||
const collapseElement = activePanelElement.querySelector('.block__icon[data-type="collapse"]');
|
||||
if (collapseElement) {
|
||||
@ -1521,23 +1539,6 @@ const panelTreeKeydown = (app: App, event: KeyboardEvent) => {
|
||||
activePanelElement.classList.contains("sy__graph")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let matchCommand = false;
|
||||
app.plugins.find(item => {
|
||||
item.commands.find(command => {
|
||||
if (command.dockCallback && matchHotKey(command.customHotkey, event)) {
|
||||
matchCommand = true;
|
||||
command.dockCallback(activePanelElement as HTMLElement);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (matchCommand) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (matchCommand) {
|
||||
return true;
|
||||
}
|
||||
const model = (getInstanceById(activePanelElement.getAttribute("data-id"), window.siyuan.layout.layout) as Tab)?.model;
|
||||
if (!model) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user