Skip to content

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

:memo: Clarify tab reading persistence under global editor locking https://github.com/siyuan-note/siyuan/issues/20111

Liang Ding03df2e466313
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy
index 59d46e1aed..bd90b98153 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy
@@ -3358,7 +3358,7 @@
"Children": [
{
"Type": "NodeText",
- "Data": "Use the menu beside the tabs to add, duplicate, delete or reorder tabs and choose a top or left layout. The active tab and layout are saved and synced with the document. In a locked document, the last tab viewed is saved in the local workspace without changing the document default. Published pages, globally read-only workspaces and encrypted notebooks keep this position only for the current session. Removing the tab layout preserves every title and its content in order."
+ "Data": "Use the menu beside the tabs to add, duplicate, delete or reorder tabs and choose a top or left layout. The active tab and layout are saved and synced with the document. In a locked document, the last tab viewed is saved in the local workspace without changing the document default. Published pages, read-only kernels and encrypted notebooks keep this position only for the current session. Removing the tab layout preserves every title and its content in order."
}
]
},
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy
index 22daf4c88e..842400e0ae 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy
@@ -3361,7 +3361,7 @@
"Children": [
{
"Type": "NodeText",
- "Data": "使用页签右侧的菜单新增、复制、删除或排序页签,切换顶部或左侧布局。选中的页签和布局随文档保存、同步;锁定编辑的文档会在本地工作空间记住最后查看的页签,不修改文档默认页签;发布页面、全局只读工作空间及加密笔记本仅在当前会话中记住。取消页签布局会按顺序保留所有标题与正文。"
+ "Data": "使用页签右侧的菜单新增、复制、删除或排序页签,切换顶部或左侧布局。选中的页签和布局随文档保存、同步;锁定编辑的文档会在本地工作空间记住最后查看的页签,不修改文档默认页签;发布页面、内核只读模式及加密笔记本仅在当前会话中记住。取消页签布局会按顺序保留所有标题与正文。"
}
]
},
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy
index a79c06f009..36f5a7fdec 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy
@@ -3359,7 +3359,7 @@
"Children": [
{
"Type": "NodeText",
- "Data": "使用頁籤右側的選單新增、複製、刪除或排序頁籤,切換頂部或左側版面配置。選取的頁籤與版面配置會隨文件儲存、同步;鎖定編輯的文件會在本機工作空間記住最後檢視的頁籤,不修改文件預設頁籤;發佈頁面、全域唯讀工作空間及加密筆記本僅於目前工作階段記住。取消頁籤版面配置會依序保留所有標題與內文。"
+ "Data": "使用頁籤右側的選單新增、複製、刪除或排序頁籤,切換頂部或左側版面配置。選取的頁籤與版面配置會隨文件儲存、同步;鎖定編輯的文件會在本機工作空間記住最後檢視的頁籤,不修改文件預設頁籤;發佈頁面、核心唯讀模式及加密筆記本僅於目前工作階段記住。取消頁籤版面配置會依序保留所有標題與內文。"
}
]
},
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy
index 755ab85545..7e3c7b4956 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy
@@ -3490,7 +3490,7 @@
"Children": [
{
"Type": "NodeText",
- "Data": "タブ右側のメニューで、タブの追加、複製、削除、並べ替え、および上部/左側の配置を選べます。選択中のタブと配置はドキュメントとともに保存・同期されます。編集をロックしたドキュメントでは、最後に表示したタブをローカルワークスペースに記憶し、ドキュメントの既定のタブは変更しません。公開ページ、ワークスペース全体が読み取り専用の場合、および暗号化ノートブックでは、現在のセッション中のみ記憶します。タブ配置を解除すると、すべてのタイトルと本文が順番に残ります。"
+ "Data": "タブ右側のメニューで、タブの追加、複製、削除、並べ替え、および上部/左側の配置を選べます。選択中のタブと配置はドキュメントとともに保存・同期されます。編集をロックしたドキュメントでは、最後に表示したタブをローカルワークスペースに記憶し、ドキュメントの既定のタブは変更しません。公開ページ、カーネルが読み取り専用の場合、および暗号化ノートブックでは、現在のセッション中のみ記憶します。タブ配置を解除すると、すべてのタイトルと本文が順番に残ります。"
}
]
},
diff --git a/app/src/protyle/wysiwyg/tabsReading.test.ts b/app/src/protyle/wysiwyg/tabsReading.test.ts
index cc18d5385f..6e3858e620 100644
--- a/app/src/protyle/wysiwyg/tabsReading.test.ts
+++ b/app/src/protyle/wysiwyg/tabsReading.test.ts
@@ -28,7 +28,7 @@ assert.ok(restoreSource);
const fixture = (storage: Record<string, any> = {}) => {
const writes: Record<string, string>[] = [];
- const siyuan = {storage, config: {readonly: false}, isPublish: false};
+ const siyuan = {storage, config: {readonly: false, editor: {readOnly: false}}, isPublish: false};
const api = {} as typeof import("./tabsReading");
const root = {};
const protyle = {disabled: true, lite: false, notebookId: "ordinary", options: {action: [] as string[]},
@@ -82,7 +82,17 @@ test("editing uses document defaults and clears an old readonly selection", () =
assert.equal(f.read(), undefined);
});
-test("publish, global readonly and encrypted notebooks retain only session selections", () => {
+test("global editor locking persists the reading position without unlocking the document", () => {
+ const f = fixture();
+ f.siyuan.config.editor.readOnly = true;
+ f.save("b");
+ assert.equal(f.read(), "b");
+ assert.equal(f.writes.length, 1);
+ assert.equal(f.protyle.disabled, true);
+ assert.equal(fixture({[storageKey]: f.writes[0]}).read(), "b");
+});
+
+test("publish, readonly kernels and encrypted notebooks retain only session selections", () => {
for (const mode of ["publish", "readonly", "encrypted"]) {
const f = fixture({[storageKey]: {other: "unchanged"}});
f.siyuan.isPublish = mode === "publish";