mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
228da65358
commit
3abccfe676
10 changed files with 101 additions and 83 deletions
|
|
@ -110,6 +110,16 @@ export const openFile = (options: IOpenFileOptions) => {
|
|||
}
|
||||
});
|
||||
if (custom) {
|
||||
if (options.afterOpen) {
|
||||
options.afterOpen();
|
||||
}
|
||||
return;
|
||||
}
|
||||
const hasModel = getUnInitTab(options);
|
||||
if (hasModel) {
|
||||
if (options.afterOpen) {
|
||||
options.afterOpen();
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else if (options.searchData) {
|
||||
|
|
@ -284,7 +294,8 @@ const getUnInitTab = (options: IOpenFileOptions) => {
|
|||
const initData = item.headElement?.getAttribute("data-initdata");
|
||||
if (initData) {
|
||||
const initObj = JSON.parse(initData);
|
||||
if (initObj.rootId === options.rootID || initObj.blockId === options.rootID) {
|
||||
if (initObj.instance === "Editor" &&
|
||||
(initObj.rootId === options.rootID || initObj.blockId === options.rootID)) {
|
||||
initObj.blockId = options.id;
|
||||
initObj.mode = options.mode;
|
||||
if (options.zoomIn) {
|
||||
|
|
@ -296,6 +307,9 @@ const getUnInitTab = (options: IOpenFileOptions) => {
|
|||
item.headElement.setAttribute("data-initdata", JSON.stringify(initObj));
|
||||
item.parent.switchTab(item.headElement);
|
||||
return true;
|
||||
} else if (initObj.instance === "Custom" && objEquals(initObj.customModelData, options.custom.data)) {
|
||||
item.parent.switchTab(item.headElement);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue