Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/10237

Vanessa6f8c1176f508
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index 49d293b32f..abab03063e 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -696,7 +696,7 @@ export class Wnd {
model.send("closews", {});
}
- private removeTabAction = (id: string, closeAll = false, animate = true) => {
+ private removeTabAction = (id: string, closeAll = false, animate = true, isSaveLayout = true) => {
clearCounter();
this.children.find((item, index) => {
if (item.id === id) {
@@ -792,7 +792,9 @@ export class Wnd {
setTitle(window.siyuan.languages.siyuanNote);
}
}
- saveLayout();
+ if (isSaveLayout) {
+ saveLayout();
+ }
/// #if !BROWSER
webFrame.clearCache();
ipcRenderer.send(Constants.SIYUAN_CMD, "clearCache");
@@ -800,7 +802,7 @@ export class Wnd {
/// #endif
};
- public removeTab(id: string, closeAll = false, animate = true) {
+ public removeTab(id: string, closeAll = false, animate = true, isSaveLayout = true) {
for (let index = 0; index < this.children.length; index++) {
const item = this.children[index];
if (item.id === id) {
@@ -809,9 +811,9 @@ export class Wnd {
showMessage(window.siyuan.languages.uploading);
return;
}
- this.removeTabAction(id, closeAll, animate);
+ this.removeTabAction(id, closeAll, animate, isSaveLayout);
} else {
- this.removeTabAction(id, closeAll, animate);
+ this.removeTabAction(id, closeAll, animate, isSaveLayout);
}
return;
}
diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts
index a2f3a2a0a8..d54279dbc4 100644
--- a/app/src/layout/util.ts
+++ b/app/src/layout/util.ts
@@ -428,7 +428,7 @@ export const JSONToLayout = (app: App, isStart: boolean) => {
if (!sessionStorage.getItem(Constants.LOCAL_SESSION_FIRSTLOAD)) {
getAllTabs().forEach(item => {
if (item.headElement && !item.headElement.classList.contains("item--pin")) {
- item.parent.removeTab(item.id, false, false);
+ item.parent.removeTab(item.id, false, false, false);
}
});
sessionStorage.setItem(Constants.LOCAL_SESSION_FIRSTLOAD, "true");
@@ -437,7 +437,7 @@ export const JSONToLayout = (app: App, isStart: boolean) => {
if (isStart) {
getAllTabs().forEach(item => {
if (item.headElement && !item.headElement.classList.contains("item--pin")) {
- item.parent.removeTab(item.id, false, false);
+ item.parent.removeTab(item.id, false, false, false);
}
});
}
@@ -460,7 +460,7 @@ export const JSONToLayout = (app: App, isStart: boolean) => {
const tabId = item.getAttribute("data-id");
const tab = getInstanceById(tabId) as Tab;
if (tab) {
- tab.parent.removeTab(tabId, false, false);
+ tab.parent.removeTab(tabId, false, false, false);
}
}
}
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 17644add42..ba7c7d3ea0 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -2398,7 +2398,7 @@ export class WYSIWYG {
// 选中后,在选中的文字上点击需等待 range 更新
let newRange = getEditorRange(this.element);
// https://github.com/siyuan-note/siyuan/issues/10357
- const attrElement = hasClosestByClassName(newRange.endContainer, "protyle-attr")
+ const attrElement = hasClosestByClassName(newRange.endContainer, "protyle-attr");
if (attrElement) {
newRange = setLastNodeRange(attrElement.previousElementSibling, newRange, false);
}
diff --git a/app/src/util/assets.ts b/app/src/util/assets.ts
index 848b89f9cd..cf1ca75b87 100644
--- a/app/src/util/assets.ts
+++ b/app/src/util/assets.ts
@@ -40,7 +40,7 @@ export const loadAssets = (data: IAppearance) => {
const defaultThemeAddress = `/appearance/themes/${data.mode === 1 ? "midnight" : "daylight"}/theme.css?v=${Constants.SIYUAN_VERSION}`;
if (defaultStyleElement) {
if (!defaultStyleElement.getAttribute("href").startsWith(defaultThemeAddress)) {
- defaultStyleElement.setAttribute("href", defaultThemeAddress)
+ defaultStyleElement.setAttribute("href", defaultThemeAddress);
}
} else {
addStyle(defaultThemeAddress, "themeDefaultStyle");
@@ -50,7 +50,7 @@ export const loadAssets = (data: IAppearance) => {
const themeAddress = `/appearance/themes/${data.mode === 1 ? data.themeDark : data.themeLight}/theme.css?v=${data.themeVer}`;
if (styleElement) {
if (!styleElement.getAttribute("href").startsWith(themeAddress)) {
- styleElement.setAttribute("href", themeAddress)
+ styleElement.setAttribute("href", themeAddress);
}
} else {
addStyle(themeAddress, "themeStyle");