diff --git a/app/src/constants.ts b/app/src/constants.ts
index 042e84e5d..c0ec946ca 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -105,6 +105,7 @@ export abstract class Constants {
public static readonly LOCAL_FILEPOSITION = "local-fileposition";
public static readonly LOCAL_DIALOGPOSITION = "local-dialogposition";
public static readonly LOCAL_SESSION_FIRSTLOAD = "local-session-firstload";
+ public static readonly LOCAL_OUTLINE = "local-outline";
// dialog
public static readonly DIALOG_OPENCARD = "dialog-opencard";
diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts
index 533ffac5a..6da086dac 100644
--- a/app/src/layout/dock/Outline.ts
+++ b/app/src/layout/dock/Outline.ts
@@ -6,7 +6,7 @@ import {getDockByType} from "../tabUtil";
import {fetchPost} from "../../util/fetch";
import {getAllModels} from "../getAll";
import {hasClosestBlock, hasClosestByClassName, hasTopClosestByClassName} from "../../protyle/util/hasClosest";
-import {updateHotkeyTip} from "../../protyle/util/compatibility";
+import {setStorageVal, updateHotkeyTip} from "../../protyle/util/compatibility";
import {openFileById} from "../../editor/util";
import {Constants} from "../../constants";
import {escapeHtml} from "../../util/escape";
@@ -87,7 +87,7 @@ export class Outline extends Model {
${window.siyuan.languages.outline}
-
+
@@ -155,9 +155,13 @@ export class Outline extends Model {
}
if (iconElement.classList.contains("block__icon--active")) {
iconElement.classList.remove("block__icon--active");
+ window.siyuan.storage[Constants.LOCAL_OUTLINE].keepExpand = false;
} else {
iconElement.classList.add("block__icon--active");
+ window.siyuan.storage[Constants.LOCAL_OUTLINE].keepExpand = true;
}
+
+ setStorageVal(Constants.LOCAL_OUTLINE, window.siyuan.storage[Constants.LOCAL_OUTLINE]);
this.tree.expandAll();
});
options.tab.panelElement.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index 7aea95db6..81fc9ebbe 100644
--- a/app/src/protyle/util/compatibility.ts
+++ b/app/src/protyle/util/compatibility.ts
@@ -187,6 +187,7 @@ export const getLocalStorage = (cb: () => void) => {
defaultStorage[Constants.LOCAL_LAYOUTS] = []; // {name: "", layout:{}}
defaultStorage[Constants.LOCAL_AI] = []; // {name: "", memo: ""}
defaultStorage[Constants.LOCAL_PLUGINTOPUNPIN] = [];
+ defaultStorage[Constants.LOCAL_OUTLINE] = {keepExpand: true};
defaultStorage[Constants.LOCAL_FILEPOSITION] = {}; // {id: IScrollAttr}
defaultStorage[Constants.LOCAL_DIALOGPOSITION] = {}; // {id: IPosition}
defaultStorage[Constants.LOCAL_FLASHCARD] = {
@@ -250,7 +251,7 @@ export const getLocalStorage = (cb: () => void) => {
Constants.LOCAL_EXPORTWORD, Constants.LOCAL_EXPORTPDF, Constants.LOCAL_DOCINFO, Constants.LOCAL_FONTSTYLES,
Constants.LOCAL_SEARCHDATA, Constants.LOCAL_ZOOM, Constants.LOCAL_LAYOUTS, Constants.LOCAL_AI,
Constants.LOCAL_PLUGINTOPUNPIN, Constants.LOCAL_SEARCHASSET, Constants.LOCAL_FLASHCARD, Constants.LOCAL_DIALOGPOSITION,
- Constants.LOCAL_FILEPOSITION].forEach((key) => {
+ Constants.LOCAL_OUTLINE, Constants.LOCAL_FILEPOSITION].forEach((key) => {
if (typeof response.data[key] === "string") {
try {
const parseData = JSON.parse(response.data[key]);