mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
0afaf36e81
commit
56dc05740a
1 changed files with 14 additions and 7 deletions
|
|
@ -181,7 +181,10 @@ const JSONToCenter = (json: any, layout?: Layout | Wnd | Tab | Model) => {
|
||||||
child.element.classList.remove("fn__flex-1");
|
child.element.classList.remove("fn__flex-1");
|
||||||
child.element.style.height = json.height;
|
child.element.style.height = json.height;
|
||||||
}
|
}
|
||||||
} else if (json.instance === "Tab") {
|
} else if (json.instance === "Tab" && (
|
||||||
|
(window.siyuan.config.fileTree.closeTabsOnStart && json.pin) ||
|
||||||
|
!window.siyuan.config.fileTree.closeTabsOnStart)
|
||||||
|
) {
|
||||||
if (!json.title) {
|
if (!json.title) {
|
||||||
child = newCenterEmptyTab();
|
child = newCenterEmptyTab();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -205,14 +208,14 @@ const JSONToCenter = (json: any, layout?: Layout | Wnd | Tab | Model) => {
|
||||||
child.headElement.setAttribute("data-init-active", "true");
|
child.headElement.setAttribute("data-init-active", "true");
|
||||||
}
|
}
|
||||||
(layout as Wnd).addTab(child);
|
(layout as Wnd).addTab(child);
|
||||||
} else if (json.instance === "Editor" && json.blockId) {
|
} else if (json.instance === "Editor" && json.blockId && layout) {
|
||||||
(layout as Tab).addModel(new Editor({
|
(layout as Tab).addModel(new Editor({
|
||||||
tab: (layout as Tab),
|
tab: (layout as Tab),
|
||||||
blockId: json.blockId,
|
blockId: json.blockId,
|
||||||
mode: json.mode,
|
mode: json.mode,
|
||||||
action: [json.action]
|
action: [json.action]
|
||||||
}));
|
}));
|
||||||
} else if (json.instance === "Asset") {
|
} else if (json.instance === "Asset" && layout) {
|
||||||
(layout as Tab).addModel(new Asset({
|
(layout as Tab).addModel(new Asset({
|
||||||
tab: (layout as Tab),
|
tab: (layout as Tab),
|
||||||
path: json.path,
|
path: json.path,
|
||||||
|
|
@ -230,22 +233,22 @@ const JSONToCenter = (json: any, layout?: Layout | Wnd | Tab | Model) => {
|
||||||
(layout as Tab).addModel(new Files({
|
(layout as Tab).addModel(new Files({
|
||||||
tab: (layout as Tab),
|
tab: (layout as Tab),
|
||||||
}));
|
}));
|
||||||
} else if (json.instance === "Graph") {
|
} else if (json.instance === "Graph" && layout) {
|
||||||
(layout as Tab).addModel(new Graph({
|
(layout as Tab).addModel(new Graph({
|
||||||
tab: (layout as Tab),
|
tab: (layout as Tab),
|
||||||
blockId: json.blockId,
|
blockId: json.blockId,
|
||||||
rootId: json.rootId,
|
rootId: json.rootId,
|
||||||
type: json.type
|
type: json.type
|
||||||
}));
|
}));
|
||||||
} else if (json.instance === "Outline") {
|
} else if (json.instance === "Outline" && layout) {
|
||||||
(layout as Tab).addModel(new Outline({
|
(layout as Tab).addModel(new Outline({
|
||||||
tab: (layout as Tab),
|
tab: (layout as Tab),
|
||||||
blockId: json.blockId,
|
blockId: json.blockId,
|
||||||
type: json.type
|
type: json.type
|
||||||
}));
|
}));
|
||||||
} else if (json.instance === "Tag") {
|
} else if (json.instance === "Tag" && layout) {
|
||||||
(layout as Tab).addModel(new Tag((layout as Tab)));
|
(layout as Tab).addModel(new Tag((layout as Tab)));
|
||||||
} else if (json.instance === "Search") {
|
} else if (json.instance === "Search" && layout) {
|
||||||
(layout as Tab).addModel(new Search({
|
(layout as Tab).addModel(new Search({
|
||||||
tab: (layout as Tab),
|
tab: (layout as Tab),
|
||||||
text: json.text
|
text: json.text
|
||||||
|
|
@ -272,6 +275,10 @@ const JSONToCenter = (json: any, layout?: Layout | Wnd | Tab | Model) => {
|
||||||
export const JSONToLayout = () => {
|
export const JSONToLayout = () => {
|
||||||
JSONToCenter(window.siyuan.config.uiLayout.layout);
|
JSONToCenter(window.siyuan.config.uiLayout.layout);
|
||||||
JSONToDock(window.siyuan.config.uiLayout);
|
JSONToDock(window.siyuan.config.uiLayout);
|
||||||
|
// 启动时不打开页签且没有钉住的页签,需要添加空白页
|
||||||
|
if (window.siyuan.layout.centerLayout.children[0].children.length === 0) {
|
||||||
|
(window.siyuan.layout.centerLayout.children[0] as Wnd).addTab(newCenterEmptyTab());
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getAllModels().editor.find(item => {
|
getAllModels().editor.find(item => {
|
||||||
if (item.headElement.classList.contains("item--focus")) {
|
if (item.headElement.classList.contains("item--focus")) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue