mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
🚨
This commit is contained in:
parent
0664aebe15
commit
e32c8f8c1c
2 changed files with 13 additions and 13 deletions
|
|
@ -178,7 +178,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
|||
}
|
||||
});
|
||||
}
|
||||
const activeTab = getActiveTab()
|
||||
const activeTab = getActiveTab();
|
||||
if (!protyle && activeTab) {
|
||||
if (activeTab.model instanceof Editor) {
|
||||
protyle = activeTab.model.editor.protyle;
|
||||
|
|
@ -1435,7 +1435,7 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
|
|||
if (matchHotKey(window.siyuan.config.keymap.general.closeUnmodified.custom, event) && !event.repeat) {
|
||||
const tab = getActiveTab(false);
|
||||
if (tab) {
|
||||
const unmodifiedTabs: Tab[] = []
|
||||
const unmodifiedTabs: Tab[] = [];
|
||||
tab.parent.children.forEach((item: Tab) => {
|
||||
const editor = item.model as Editor;
|
||||
if (!editor || (editor.editor?.protyle && !editor.editor?.protyle.updated)) {
|
||||
|
|
|
|||
|
|
@ -43,21 +43,21 @@ export const getActiveTab = (wndActive = true) => {
|
|||
export const switchTabByIndex = (index: number) => {
|
||||
const activeDockIcoElement = document.querySelector(".dock .dock__item--activefocus");
|
||||
if (activeDockIcoElement) {
|
||||
let indexElement = activeDockIcoElement.parentElement.children[index]
|
||||
let indexElement = activeDockIcoElement.parentElement.children[index];
|
||||
if (index === -1) {
|
||||
// 最后一个
|
||||
indexElement = activeDockIcoElement.parentElement.lastElementChild
|
||||
indexElement = activeDockIcoElement.parentElement.lastElementChild;
|
||||
if (!indexElement.getAttribute("data-type")) {
|
||||
indexElement = indexElement.previousElementSibling
|
||||
indexElement = indexElement.previousElementSibling;
|
||||
}
|
||||
} else if (index === -2) {
|
||||
// 上一个
|
||||
indexElement = activeDockIcoElement.previousElementSibling
|
||||
indexElement = activeDockIcoElement.previousElementSibling;
|
||||
} else if (index === -3) {
|
||||
// 下一个
|
||||
indexElement = activeDockIcoElement.nextElementSibling
|
||||
indexElement = activeDockIcoElement.nextElementSibling;
|
||||
}
|
||||
const type = indexElement?.getAttribute("data-type")
|
||||
const type = indexElement?.getAttribute("data-type");
|
||||
if (type) {
|
||||
getDockByType(type)?.toggleModel(type, true, false);
|
||||
}
|
||||
|
|
@ -65,23 +65,23 @@ export const switchTabByIndex = (index: number) => {
|
|||
}
|
||||
const tab = getActiveTab(false);
|
||||
if (tab) {
|
||||
let indexElement = tab.parent.headersElement.children[index]
|
||||
let indexElement = tab.parent.headersElement.children[index];
|
||||
if (index === -1) {
|
||||
// 最后一个
|
||||
indexElement = tab.parent.headersElement.lastElementChild
|
||||
indexElement = tab.parent.headersElement.lastElementChild;
|
||||
} else if (index === -2) {
|
||||
// 上一个
|
||||
indexElement = tab.headElement.previousElementSibling
|
||||
indexElement = tab.headElement.previousElementSibling;
|
||||
} else if (index === -3) {
|
||||
// 下一个
|
||||
indexElement = tab.headElement.nextElementSibling
|
||||
indexElement = tab.headElement.nextElementSibling;
|
||||
}
|
||||
if (indexElement) {
|
||||
tab.parent.switchTab(indexElement as HTMLElement, true);
|
||||
tab.parent.showHeading();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let resizeTimeout: number;
|
||||
export const resizeTabs = () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue