mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
This commit is contained in:
parent
c05f23f488
commit
d2145ec916
2 changed files with 41 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ import {promiseTransactions} from "./protyle/wysiwyg/transaction";
|
|||
import {initMessage} from "./dialog/message";
|
||||
import {resizeDrag} from "./layout/util";
|
||||
import {setLocalStorage} from "./protyle/util/compatibility";
|
||||
import {getAllTabs} from "./layout/getAll";
|
||||
|
||||
class App {
|
||||
constructor() {
|
||||
|
|
@ -46,6 +47,45 @@ class App {
|
|||
case"progress":
|
||||
progressLoading(data);
|
||||
break;
|
||||
case "rename":
|
||||
getAllTabs().forEach((tab) => {
|
||||
if (tab.headElement) {
|
||||
const initTab = tab.headElement.getAttribute("data-initdata")
|
||||
if (initTab) {
|
||||
const initTabData = JSON.parse(initTab)
|
||||
if (initTabData.rootId === data.data.id) {
|
||||
tab.updateTitle(data.data.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "unmount":
|
||||
getAllTabs().forEach((tab) => {
|
||||
if (tab.headElement) {
|
||||
const initTab = tab.headElement.getAttribute("data-initdata")
|
||||
if (initTab) {
|
||||
const initTabData = JSON.parse(initTab)
|
||||
if (data.data.box === initTabData.notebookId) {
|
||||
tab.parent.removeTab(tab.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "removeDoc":
|
||||
getAllTabs().forEach((tab) => {
|
||||
if (tab.headElement) {
|
||||
const initTab = tab.headElement.getAttribute("data-initdata")
|
||||
if (initTab) {
|
||||
const initTabData = JSON.parse(initTab)
|
||||
if (data.data.ids.includes(initTabData.rootId)) {
|
||||
tab.parent.removeTab(tab.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
case"statusbar":
|
||||
progressStatus(data);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -345,6 +345,7 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any) => {
|
|||
}
|
||||
json.instance = "Tab";
|
||||
} else if (layout instanceof Editor) {
|
||||
json.notebookId = layout.editor.protyle.notebookId;
|
||||
json.blockId = layout.editor.protyle.block.id;
|
||||
json.rootId = layout.editor.protyle.block.rootID;
|
||||
json.mode = layout.editor.protyle.preview.element.classList.contains("fn__none") ? "wysiwyg" : "preview";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue