Skip to content

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

:bug: Restore mobile parent document double-tap and setting tip https://github.com/siyuan-note/siyuan/issues/19752

Daniel26169f4f4aef
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index ae10a0e701..becb791ff2 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -702,7 +702,7 @@
"docIconClickExpand": "انقر فوق أيقونة المستند أو دفتر الملاحظات لتوسيع المستندات الفرعية أو طيها",
"docIconClickExpandTip": "عند التمكين، يؤدي النقر فوق أيقونة مستند أو دفتر ملاحظات إلى توسيع المستندات الفرعية أو طيها؛ وعند عدم وجود مستندات فرعية، يُفتح المستند إن كان متاحًا، وإلا يمكن تغيير الأيقونة؛ وعند التعطيل، يؤدي النقر فوق أي من الأيقونتين إلى تغييرها",
"parentDocClickExpand": "انقر فوق عنوان المستند الأصل لتوسيع المستندات الفرعية أو طيها",
- "parentDocClickExpandTip": "عند التمكين، يؤدي النقر فوق عنوان المستند الأصل إلى توسيع المستندات الفرعية أو طيها، ويمكن فتح المستند الأصل عبر «فتح المستند» في قائمة النقر بزر الماوس الأيمن؛ وإذا لم توجد مستندات فرعية، فسيظل النقر يفتح المستند مباشرةً؛ يفتح النقر المزدوج على العنوان المستند الأصل دون تغيير حالة توسيع المستندات الفرعية",
+ "parentDocClickExpandTip": "عند التمكين، يؤدي النقر فوق عنوان المستند الأصل إلى توسيع المستندات الفرعية أو طيها، ويمكن فتح المستند الأصل عبر «فتح المستند» في قائمة المستند؛ وإذا لم توجد مستندات فرعية، فسيظل النقر يفتح المستند مباشرةً؛ يفتح النقر المزدوج على العنوان المستند الأصل دون تغيير حالة توسيع المستندات الفرعية",
"mcpStatusAuthorizing": "جارٍ التفويض",
"mcpStatusAuthorizationRequired": "التفويض مطلوب",
"mcpAuthorize": "تفويض",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index 08fb9f703f..1a853b5dea 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -702,7 +702,7 @@
"docIconClickExpand": "单击文档或笔记本图标展开或折叠下级文档",
"docIconClickExpandTip": "启用后单击文档或笔记本图标将展开或折叠下级文档;没有下级文档时,有可打开文档则打开文档,否则修改图标;关闭后单击文档或笔记本图标将修改图标",
"parentDocClickExpand": "单击父文档标题时展开或折叠下级文档",
- "parentDocClickExpandTip": "启用后单击父文档标题将展开或折叠下级文档,可通过右键菜单中的“打开文档”打开父文档;没有子文档时仍会直接打开文档;双击标题可打开父文档,且不改变展开或折叠状态",
+ "parentDocClickExpandTip": "启用后单击父文档标题将展开或折叠下级文档,可通过文档菜单中的“打开文档”打开父文档;没有子文档时仍会直接打开文档;双击标题可打开父文档,且不改变展开或折叠状态",
"mcpStatusAuthorizing": "正在授权",
"mcpStatusAuthorizationRequired": "需要授权",
"mcpAuthorize": "授权",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index d4bd3c5aa5..21137fe483 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -702,7 +702,7 @@
"docIconClickExpand": "點擊文件或筆記本圖示展開或折疊下級文件",
"docIconClickExpandTip": "啟用後點擊文件或筆記本圖示將展開或折疊下級文件;沒有下級文件時,有可開啟文件則開啟文件,否則修改圖示;關閉後點擊文件或筆記本圖示將修改圖示",
"parentDocClickExpand": "點擊父文件標題時展開或折疊下級文件",
- "parentDocClickExpandTip": "啟用後點擊父文件標題將展開或折疊下級文件,可透過右鍵選單中的「開啟文件」開啟父文件;沒有子文件時仍會直接開啟文件;按兩下標題可開啟父文件,且不改變展開或折疊狀態",
+ "parentDocClickExpandTip": "啟用後點擊父文件標題將展開或折疊下級文件,可透過文件選單中的「開啟文件」開啟父文件;沒有子文件時仍會直接開啟文件;按兩下標題可開啟父文件,且不改變展開或折疊狀態",
"mcpStatusAuthorizing": "正在授權",
"mcpStatusAuthorizationRequired": "需要授權",
"mcpAuthorize": "授權",
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy
index ddecef5be5..17d918b994 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy
@@ -7,7 +7,7 @@
"id": "20200924100950-9op5xi1",
"title": "Shortcuts",
"type": "doc",
- "updated": "20260923083553"
+ "updated": "20260923212237"
},
"Children": [
{
@@ -16758,12 +16758,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260922150640-l6dnc3c",
- "updated": "20260922150640"
+ "updated": "20260923212237"
},
"Children": [
{
"Type": "NodeText",
- "Data": "When “Click parent document title to expand or collapse child documents” is enabled, single-click a parent document title in the desktop document tree or pinned documents to expand or collapse its children after a short delay. Double-click the title to open the parent document without changing its expansion state. Documents without children still open with a single click"
+ "Data": "When “Click parent document title to expand or collapse child documents” is enabled, click or tap a parent title in the document tree or pinned documents to expand or collapse its children after a short delay. Double-click or double-tap the title to open the parent document without changing its expansion state. Documents without children still open with one click or tap"
}
]
},
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy
index 657d8335a6..e59a483af8 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy
@@ -7,7 +7,7 @@
"id": "20200813004551-gm0pbn1",
"title": "快捷键",
"type": "doc",
- "updated": "20260923083553"
+ "updated": "20260923212237"
},
"Children": [
{
@@ -16808,12 +16808,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260922150640-fahlo11",
- "updated": "20260922150640"
+ "updated": "20260923212237"
},
"Children": [
{
"Type": "NodeText",
- "Data": "启用“单击父文档标题时展开或折叠下级文档”后,在桌面端文档树或置顶文档区单击父文档标题,会在短暂等待后展开或折叠下级文档;双击标题则打开父文档,且不改变展开或折叠状态。没有子文档时仍然单击直接打开"
+ "Data": "启用“单击父文档标题时展开或折叠下级文档”后,在文档树或置顶文档区单击或点按父文档标题,会在短暂等待后展开或折叠下级文档;双击或连续点按两次标题则打开父文档,且不改变展开或折叠状态。没有子文档时仍然单击或点按直接打开"
}
]
},
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy
index 470a685a19..e0e46d92c3 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy
@@ -7,7 +7,7 @@
"id": "20211226122549-jktxego",
"title": "快捷鍵",
"type": "doc",
- "updated": "20260923083553"
+ "updated": "20260923212237"
},
"Children": [
{
@@ -16750,12 +16750,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260922150640-nft4e80",
- "updated": "20260922150640"
+ "updated": "20260923212237"
},
"Children": [
{
"Type": "NodeText",
- "Data": "啟用「點擊父文件標題時展開或折疊下級文件」後,在桌面版文件樹或置頂文件區點擊父文件標題,會在短暫等待後展開或折疊下級文件;按兩下標題則開啟父文件,且不改變展開或折疊狀態。沒有子文件時仍然點擊直接開啟"
+ "Data": "啟用「點擊父文件標題時展開或折疊下級文件」後,在文件樹或置頂文件區點擊或點按父文件標題,會在短暫等待後展開或折疊下級文件;按兩下或連續點按兩次標題則開啟父文件,且不改變展開或折疊狀態。沒有子文件時仍然點擊或點按直接開啟"
}
]
},
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy
index e905f0ac54..238098b46e 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy
@@ -9,7 +9,7 @@
"id": "20240530101000-xsbxokr",
"title": "ショートカット",
"type": "doc",
- "updated": "20260923083553"
+ "updated": "20260923212237"
},
"Children": [
{
@@ -16756,12 +16756,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260922150640-g5u649a",
- "updated": "20260922150640"
+ "updated": "20260923212237"
},
"Children": [
{
"Type": "NodeText",
- "Data": "親文書のタイトルをクリックして子文書を展開または折りたたむ設定が有効な場合、デスクトップ版のドキュメントツリーやピン留めした文書で親文書のタイトルをクリックすると、少し待ってから子文書を展開または折りたたみます。タイトルをダブルクリックすると、展開状態を変えずに親文書を開きます。子文書がない場合は、これまでどおりシングルクリックで直接開きます"
+ "Data": "親文書のタイトルをクリックして子文書を展開または折りたたむ設定が有効な場合、ドキュメントツリーやピン留めした文書で親文書のタイトルをクリックまたはタップすると、少し待ってから子文書を展開または折りたたみます。タイトルをダブルクリックまたはダブルタップすると、展開状態を変えずに親文書を開きます。子文書がない場合は、これまでどおり1回のクリックまたはタップで直接開きます"
}
]
},
diff --git a/app/src/config/tabs/fileTab.ts b/app/src/config/tabs/fileTab.ts
index 910ed152ac..d7529d847c 100644
--- a/app/src/config/tabs/fileTab.ts
+++ b/app/src/config/tabs/fileTab.ts
@@ -54,7 +54,7 @@ const registerFileTreeBehaviorGroup = (tab: SettingTabBuilder) => {
/// #endif
group.switch("fileTree.parentDocClickExpand", {
title: window.siyuan.languages.parentDocClickExpand,
- desc: window.siyuan.mobile ? "" : window.siyuan.languages.parentDocClickExpandTip,
+ desc: window.siyuan.languages.parentDocClickExpandTip,
save: (value) => fileConfigApi.patch("parentDocClickExpand", value, () => {
/// #if !MOBILE
getAllModels().files.forEach((files) => files.updateDocActions());
diff --git a/app/src/layout/dock/PinnedDocs.test.ts b/app/src/layout/dock/PinnedDocs.test.ts
index f31e2db872..c23e1f6fcb 100644
--- a/app/src/layout/dock/PinnedDocs.test.ts
+++ b/app/src/layout/dock/PinnedDocs.test.ts
@@ -400,9 +400,13 @@ test("notebook root expansion requests physical root while documents keep their
});
test("parent titles prefetch once and double clicks preserve expanded and collapsed pinned rows", async () => {
- for (const expanded of [false, true]) {
+ for (const {expanded, mobile} of [
+ {expanded: false, mobile: false}, {expanded: true, mobile: false},
+ {expanded: false, mobile: true}, {expanded: true, mobile: true},
+ ]) {
const {panel, config, calls} = loadPanel();
config.fileTree.parentDocClickExpand = true;
+ panel.mobile = mobile;
panel.generation = 0;
panel.expanded = new Set(expanded ? ["doc"] : []);
const row = {isConnected: true, dataset: {nodeId: "doc", notebook: "box", pinRow: "doc", path: "/doc.sy", count: "1"},
diff --git a/app/src/layout/dock/PinnedDocs.ts b/app/src/layout/dock/PinnedDocs.ts
index 28b0416446..5d260e8220 100644
--- a/app/src/layout/dock/PinnedDocs.ts
+++ b/app/src/layout/dock/PinnedDocs.ts
@@ -455,7 +455,7 @@ export class PinnedDocs {
} else if (row.dataset.unavailable !== "true") {
this.selectRow(row);
if (window.siyuan.config.fileTree.parentDocClickExpand && Number(row.dataset.count) > 0) {
- if (this.mobile || !target.closest(".b3-list-item__text") ||
+ if (!target.closest(".b3-list-item__text") ||
event.ctrlKey || event.metaKey || event.altKey || event.shiftKey) {
this.toggle(row);
return;
diff --git a/app/src/mobile/dock/MobileFiles.ts b/app/src/mobile/dock/MobileFiles.ts
index 4d3078e2b9..5c54d2bdca 100644
--- a/app/src/mobile/dock/MobileFiles.ts
+++ b/app/src/mobile/dock/MobileFiles.ts
@@ -61,6 +61,7 @@ import {
import {MobileOpenedFileSelection} from "./mobileOpenedFileSelection";
import {insertMobileMultiSelectMenu, renderMultiSelectToolbar, updateMultiSelectToolbar} from "../util/multiSelectToolbar";
import {PinnedDocs} from "../../layout/dock/PinnedDocs";
+import {ParentDocClick} from "../../layout/dock/parentDocClick";
export class MobileFiles extends Model {
public element: HTMLElement;
@@ -75,6 +76,7 @@ export class MobileFiles extends Model {
private docSortModeChanges = new Map<string, IDocSortModeChanged>();
private movedExpandedDocIDs = new Set<string>();
private openedFileSelection = new MobileOpenedFileSelection();
+ private parentDocClick = new ParentDocClick();
private touchDragState: {
selectedElement: HTMLElement;
startX: number;
@@ -160,6 +162,13 @@ export class MobileFiles extends Model {
}, {capture: true, passive: true});
filesElement.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {
let target = event.target as HTMLElement;
+ const parentTitle = target.closest<HTMLElement>(".b3-list-item__text");
+ const parentRow = parentTitle?.parentElement;
+ const isParentTitle = window.siyuan.config.fileTree.parentDocClickExpand &&
+ !!parentRow?.getAttribute("data-node-id") && Number(parentRow.getAttribute("data-count")) > 0;
+ if (!isParentTitle) {
+ this.parentDocClick.cancel();
+ }
while (target && !target.isEqualNode(this.actionsElement)) {
if (target.classList.contains("b3-list-item__icon")) {
const notebookElement = target.closest("li[data-encrypted=true]");
@@ -302,12 +311,17 @@ export class MobileFiles extends Model {
event.stopPropagation();
break;
} else if (target.tagName === "LI") {
- this.setCurrent(target);
+ this.setCurrent(target, !isParentTitle || parentRow !== target);
const ulElement = hasTopClosestByTag(target, "UL");
const notebookId = ulElement ? ulElement.getAttribute("data-url") : "";
if (target.getAttribute("data-type") === "navigation-file") {
if (window.siyuan.config.fileTree.parentDocClickExpand && Number(target.getAttribute("data-count")) > 0) {
- this.toggleTreeItem(target);
+ if (parentRow === target) {
+ this.handleParentDocClick(target, notebookId);
+ } else {
+ this.parentDocClick.cancel();
+ this.toggleTreeItem(target);
+ }
} else {
openMobileFileById(app, target.getAttribute("data-node-id"), [Constants.CB_GET_SCROLL], undefined, notebookId);
}
@@ -315,7 +329,12 @@ export class MobileFiles extends Model {
const boxDocID = target.getAttribute("data-node-id");
if (boxDocID) {
if (window.siyuan.config.fileTree.parentDocClickExpand && Number(target.getAttribute("data-count")) > 0) {
- this.toggleTreeItem(target);
+ if (parentRow === target) {
+ this.handleParentDocClick(target, notebookId);
+ } else {
+ this.parentDocClick.cancel();
+ this.toggleTreeItem(target);
+ }
} else {
openMobileFileById(app, boxDocID, [Constants.CB_GET_SCROLL], undefined, notebookId);
}
@@ -804,6 +823,7 @@ export class MobileFiles extends Model {
};
public destroy() {
+ this.parentDocClick.cancel();
this.selectionObserver.disconnect();
this.pinnedDocs.destroy();
}
@@ -1461,6 +1481,16 @@ export class MobileFiles extends Model {
window.siyuan.menus.menu.remove();
}
+ private handleParentDocClick(item: HTMLElement, notebookId: string) {
+ const docId = item.getAttribute("data-node-id");
+ this.parentDocClick.click(item, async () => () => {
+ if (window.siyuan.config.fileTree.parentDocClickExpand && item.getAttribute("data-node-id") === docId &&
+ Number(item.getAttribute("data-count")) > 0) {
+ this.toggleTreeItem(item);
+ }
+ }, () => openMobileFileById(this.app, docId, [Constants.CB_GET_SCROLL], undefined, notebookId));
+ }
+
private insertMultiSelectMenu(item: HTMLElement) {
if (window.siyuan.config.readonly) {
return;
@@ -1478,6 +1508,7 @@ export class MobileFiles extends Model {
}
private setMultiSelect(enabled: boolean) {
+ this.parentDocClick.cancel();
this.multiSelect = enabled;
this.touchDragState = null;
this.openedFileSelection.cancel();