This commit is contained in:
parent
a45a77950e
commit
6f8c1176f5
4 changed files with 13 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Add table
Reference in a new issue