mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
This commit is contained in:
parent
f628ac35f8
commit
03d0773959
3 changed files with 31 additions and 14 deletions
|
|
@ -322,7 +322,7 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any) => {
|
|||
json.instance = "Tab";
|
||||
} else if (layout instanceof Editor) {
|
||||
json.blockId = layout.editor.protyle.block.id;
|
||||
json.rootID = layout.editor.protyle.block.rootID;
|
||||
json.rootId = layout.editor.protyle.block.rootID;
|
||||
json.mode = layout.editor.protyle.preview.element.classList.contains("fn__none") ? "wysiwyg" : "preview";
|
||||
json.action = layout.editor.protyle.block.showAll ? Constants.CB_GET_ALL : "";
|
||||
json.instance = "Editor";
|
||||
|
|
@ -482,6 +482,15 @@ export const copyTab = (tab: Tab) => {
|
|||
tab: newTab,
|
||||
text: tab.model.text
|
||||
});
|
||||
} else if (!tab.model && tab.headElement) {
|
||||
const initData = JSON.parse(tab.headElement.getAttribute("data-initdata") || "{}");
|
||||
model = new Editor({
|
||||
tab: newTab,
|
||||
blockId: initData.rootId || initData.blockId,
|
||||
mode: initData.mode,
|
||||
action: typeof initData.action === "string" ? [initData.action] : initData.action,
|
||||
scrollAttr: initData.scrollAttr,
|
||||
});
|
||||
}
|
||||
newTab.addModel(model);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue