From 4eb276b89c78fe6f14bf061406f515bcd92d1f49 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 2 Dec 2022 22:02:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:memo:=20=E6=9B=B4=E6=96=B0=20FAQ?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +- README_zh_CN.md | 10 +- .../20200923234731-h3zkwm2.sy | 294 ++++++++---------- .../20200813093015-u6bopdt.sy | 281 ++++++++--------- .../20211226115227-r1rty9v.sy | 275 ++++++++-------- 5 files changed, 408 insertions(+), 462 deletions(-) diff --git a/README.md b/README.md index 5f584d3e9..5b6aeeb3a 100644 --- a/README.md +++ b/README.md @@ -175,10 +175,12 @@ This question varies from person to person and is difficult to answer uniformly. The data is saved in the workspace folder (the default is in the user's home directory Documents/SiYuan, which can be modified in Settings - About), in the workspace data folder: -* `assets` are used to save all inserted assets -* `templates` are used to save template snippets -* `widgets` are used to save widgets -* `emojis` are used to save emoji images +* `assets` is used to save all inserted assets +* `emojis` is used to save emoji images +* `snippets` is used to save code snippets +* `storage` is used to save browser localStorage and flashcards, etc. +* `templates` is used to save template snippets +* `widgets` is used to save widgets * The rest of the folders are the notebook folders created by the user, files with the suffix of `.sy` in the notebook folder are used to save the document data, and the data format is JSON ### Does it support data synchronization through a third-party sync disk? diff --git a/README_zh_CN.md b/README_zh_CN.md index 46e3bea77..5b33edba7 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -188,9 +188,11 @@ 数据保存在工作空间文件夹下(默认位于用户家目录 Documents/SiYuan,可在 设置 - 关于 中进行修改),在工作空间 data 文件夹下: * `assets` 用于保存所有插入的资源文件 +* `emojis` 用于保存自定义图标表情图片 +* `snippets` 用于保存代码片段 +* `storage` 用于保存浏览器 localStorage 以及闪卡数据等 * `templates` 用于保存模板片段 * `widgets` 用于保存挂件 -* `emojis` 用于保存 Emoji 图片 * 其余文件夹就是用户自己创建的笔记本文件夹,笔记本文件夹下 `.sy` 后缀的文件用于保存文档数据,数据格式为 JSON ### 支持通过第三方同步盘进行数据同步吗? @@ -214,11 +216,9 @@ 思源笔记是完全开源的,欢迎参与贡献: * [界面和内核](https://github.com/siyuan-note/siyuan) -* [用户指南](https://github.com/siyuan-note/user-guide-zh_CN)和[外观](https://github.com/siyuan-note/appearance) -* [编辑器引擎](https://github.com/88250/lute) -* [端到端加密](https://github.com/siyuan-note/encryption)和[数据仓库](https://github.com/siyuan-note/dejavu) +* [Android 端](https://github.com/siyuan-note/siyuan-android) +* [iOS 端](https://github.com/siyuan-note/siyuan-ios) * [Chrome 剪藏扩展](https://github.com/siyuan-note/siyuan-chrome) -* [Android 端](https://github.com/siyuan-note/siyuan-android)和 [iOS 端](https://github.com/siyuan-note/siyuan-ios) 更多细节请参考[开发指南](https://github.com/siyuan-note/siyuan/blob/master/.github/CONTRIBUTING_zh_CN.md)。 diff --git a/app/guide/20210808180117-6v0mkxr/20200923234731-h3zkwm2.sy b/app/guide/20210808180117-6v0mkxr/20200923234731-h3zkwm2.sy index 8dc25cf02..5b0ac0ba4 100644 --- a/app/guide/20210808180117-6v0mkxr/20200923234731-h3zkwm2.sy +++ b/app/guide/20210808180117-6v0mkxr/20200923234731-h3zkwm2.sy @@ -7,7 +7,7 @@ "id": "20200923234731-h3zkwm2", "title": "FAQ", "type": "doc", - "updated": "20221112211041" + "updated": "20221202215048" }, "Children": [ { @@ -275,7 +275,7 @@ "ListData": {}, "Properties": { "id": "20210428222603-moih9fe", - "updated": "20220329160456" + "updated": "20221202215048" }, "Children": [ { @@ -287,7 +287,7 @@ }, "Properties": { "id": "20210428222603-gxgx3vi", - "updated": "20220329160450" + "updated": "20221202215029" }, "Children": [ { @@ -295,7 +295,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20210428222603-0goch51", - "updated": "20220329160450" + "updated": "20221202215029" }, "Children": [ { @@ -309,7 +309,7 @@ }, { "Type": "NodeText", - "Data": "​ are used to save all inserted " + "Data": "​ is used to save all inserted " }, { "Type": "NodeTextMark", @@ -322,6 +322,117 @@ } ] }, + { + "ID": "20221202214756-6a5qi9y", + "Type": "NodeListItem", + "ListData": { + "BulletChar": 42, + "Marker": "Kg==" + }, + "Properties": { + "id": "20221202214756-6a5qi9y", + "updated": "20221202215034" + }, + "Children": [ + { + "ID": "20221202214756-polklnd", + "Type": "NodeParagraph", + "Properties": { + "id": "20221202214756-polklnd", + "updated": "20221202215034" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "​" + }, + { + "Type": "NodeTextMark", + "TextMarkType": "code", + "TextMarkTextContent": "emojis" + }, + { + "Type": "NodeText", + "Data": "​ is used to save emoji images" + } + ] + } + ] + }, + { + "ID": "20221202214758-dtqv6vc", + "Type": "NodeListItem", + "ListData": { + "BulletChar": 42, + "Marker": "Kg==" + }, + "Properties": { + "id": "20221202214758-dtqv6vc", + "updated": "20221202215043" + }, + "Children": [ + { + "ID": "20221202214758-5u6jitp", + "Type": "NodeParagraph", + "Properties": { + "id": "20221202214758-5u6jitp", + "updated": "20221202215043" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "​" + }, + { + "Type": "NodeTextMark", + "TextMarkType": "code", + "TextMarkTextContent": "snippets" + }, + { + "Type": "NodeText", + "Data": "​ is used to save code snippets" + } + ] + } + ] + }, + { + "ID": "20221202214811-2s26txl", + "Type": "NodeListItem", + "ListData": { + "BulletChar": 42, + "Marker": "Kg==" + }, + "Properties": { + "id": "20221202214811-2s26txl", + "updated": "20221202215022" + }, + "Children": [ + { + "ID": "20221202214811-p1eevpi", + "Type": "NodeParagraph", + "Properties": { + "id": "20221202214811-p1eevpi", + "updated": "20221202215022" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "​" + }, + { + "Type": "NodeTextMark", + "TextMarkType": "code", + "TextMarkTextContent": "storage" + }, + { + "Type": "NodeText", + "Data": "​ is used to save browser localStorage and flashcards, etc." + } + ] + } + ] + }, { "ID": "20210428222603-vtr89xq", "Type": "NodeListItem", @@ -331,7 +442,7 @@ }, "Properties": { "id": "20210428222603-vtr89xq", - "updated": "20210824200933" + "updated": "20221202215047" }, "Children": [ { @@ -339,7 +450,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20210428222603-criebuv", - "updated": "20210824200933" + "updated": "20221202215047" }, "Children": [ { @@ -353,7 +464,7 @@ }, { "Type": "NodeText", - "Data": "​ are used to save " + "Data": "​ is used to save " }, { "Type": "NodeTextMark", @@ -375,7 +486,7 @@ }, "Properties": { "id": "20210428222603-456vgdh", - "updated": "20220329160456" + "updated": "20221202215048" }, "Children": [ { @@ -383,7 +494,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20210428222603-m3djncm", - "updated": "20220329160456" + "updated": "20221202215048" }, "Children": [ { @@ -397,7 +508,7 @@ }, { "Type": "NodeText", - "Data": "​ are used to save " + "Data": "​ is used to save " }, { "Type": "NodeTextMark", @@ -410,43 +521,6 @@ } ] }, - { - "ID": "20210826092337-pt1yd7r", - "Type": "NodeListItem", - "ListData": { - "BulletChar": 42, - "Marker": "Kg==" - }, - "Properties": { - "id": "20210826092337-pt1yd7r", - "updated": "20220226130622" - }, - "Children": [ - { - "ID": "20210826092337-swh0gdd", - "Type": "NodeParagraph", - "Properties": { - "id": "20210826092337-swh0gdd", - "updated": "20220226130622" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "​" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "code", - "TextMarkTextContent": "emojis" - }, - { - "Type": "NodeText", - "Data": "​ are used to save emoji images" - } - ] - } - ] - }, { "ID": "20210428222603-27so3jy", "Type": "NodeListItem", @@ -477,7 +551,7 @@ }, { "Type": "NodeText", - "Data": "​ in the notebook folder are used to save the document data, and the data format is JSON" + "Data": "​​ in the notebook folder are used to save the document data, and the data format is JSON" } ] } @@ -877,7 +951,7 @@ "ListData": {}, "Properties": { "id": "20220526112843-xbvl2ni", - "updated": "20220808132857" + "updated": "20221202214406" }, "Children": [ { @@ -911,110 +985,58 @@ ] }, { - "ID": "20220526112843-br8thvh", + "ID": "20221202214345-gctwcoa", "Type": "NodeListItem", "ListData": { "BulletChar": 42, "Marker": "Kg==" }, "Properties": { - "id": "20220526112843-br8thvh", - "updated": "20220526112843" + "id": "20221202214345-gctwcoa", + "updated": "20221202214406" }, "Children": [ { - "ID": "20220526112843-q3ckr5q", + "ID": "20221202214345-4p4zmco", "Type": "NodeParagraph", "Properties": { - "id": "20220526112843-q3ckr5q", - "updated": "20220615152158" + "id": "20221202214345-4p4zmco", + "updated": "20221202214406" }, "Children": [ { "Type": "NodeTextMark", "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/user-guide-en_US", - "TextMarkTextContent": "User Guide" - }, - { - "Type": "NodeText", - "Data": " and " - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/appearance", - "TextMarkTextContent": "Appearance" + "TextMarkAHref": "https://github.com/siyuan-note/siyuan-android", + "TextMarkTextContent": "Android" } ] } ] }, { - "ID": "20220526112843-rnr85gt", + "ID": "20221202214348-poddvse", "Type": "NodeListItem", "ListData": { "BulletChar": 42, "Marker": "Kg==" }, "Properties": { - "id": "20220526112843-rnr85gt", - "updated": "20220808132857" + "id": "20221202214348-poddvse" }, "Children": [ { - "ID": "20220526112843-mj4iy0b", + "ID": "20221202214348-tk7i2le", "Type": "NodeParagraph", "Properties": { - "id": "20220526112843-mj4iy0b", - "updated": "20220808132857" + "id": "20221202214348-tk7i2le" }, "Children": [ { "Type": "NodeTextMark", "TextMarkType": "a", - "TextMarkAHref": "https://github.com/88250/lute", - "TextMarkTextContent": "Editor Engine" - } - ] - } - ] - }, - { - "ID": "20220526112843-dh5azqr", - "Type": "NodeListItem", - "ListData": { - "BulletChar": 42, - "Marker": "Kg==" - }, - "Properties": { - "id": "20220526112843-dh5azqr", - "updated": "20220526112843" - }, - "Children": [ - { - "ID": "20220526112843-p1pn0w7", - "Type": "NodeParagraph", - "Properties": { - "id": "20220526112843-p1pn0w7", - "updated": "20220615152221" - }, - "Children": [ - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/encryption", - "TextMarkTextContent": "End-to-end encryption" - }, - { - "Type": "NodeText", - "Data": " and " - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/dejavu", - "TextMarkTextContent": "Data repo" + "TextMarkAHref": "https://github.com/siyuan-note/siyuan-ios", + "TextMarkTextContent": "iOS" } ] } @@ -1049,46 +1071,6 @@ ] } ] - }, - { - "ID": "20220526112843-qwi3jan", - "Type": "NodeListItem", - "ListData": { - "BulletChar": 42, - "Marker": "Kg==" - }, - "Properties": { - "id": "20220526112843-qwi3jan", - "updated": "20220615152228" - }, - "Children": [ - { - "ID": "20220526112843-lvjzpyf", - "Type": "NodeParagraph", - "Properties": { - "id": "20220526112843-lvjzpyf", - "updated": "20220615152228" - }, - "Children": [ - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/siyuan-android", - "TextMarkTextContent": "Android" - }, - { - "Type": "NodeText", - "Data": " and " - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/siyuan-ios", - "TextMarkTextContent": "iOS" - } - ] - } - ] } ] }, diff --git a/app/guide/20210808180117-czj9bvb/20200813093015-u6bopdt.sy b/app/guide/20210808180117-czj9bvb/20200813093015-u6bopdt.sy index e119b0823..984e74dd7 100644 --- a/app/guide/20210808180117-czj9bvb/20200813093015-u6bopdt.sy +++ b/app/guide/20210808180117-czj9bvb/20200813093015-u6bopdt.sy @@ -7,7 +7,7 @@ "id": "20200813093015-u6bopdt", "title": "常见问题", "type": "doc", - "updated": "20221112211001" + "updated": "20221202215129" }, "Children": [ { @@ -372,7 +372,7 @@ "ListData": {}, "Properties": { "id": "20210428213927-rbcfx2y", - "updated": "20220329160344" + "updated": "20221202215129" }, "Children": [ { @@ -406,7 +406,7 @@ }, { "Type": "NodeText", - "Data": "​ 用于保存所有插入的" + "Data": "​​ 用于保存所有插入的" }, { "Type": "NodeTextMark", @@ -419,6 +419,116 @@ } ] }, + { + "ID": "20221202214520-u96zbhq", + "Type": "NodeListItem", + "ListData": { + "BulletChar": 42, + "Marker": "Kg==" + }, + "Properties": { + "id": "20221202214520-u96zbhq", + "updated": "20221202215129" + }, + "Children": [ + { + "ID": "20221202214520-k8zqbno", + "Type": "NodeParagraph", + "Properties": { + "id": "20221202214520-k8zqbno", + "updated": "20221202215129" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "​" + }, + { + "Type": "NodeTextMark", + "TextMarkType": "code", + "TextMarkTextContent": "emojis" + }, + { + "Type": "NodeText", + "Data": "​ 用于保存自定义图标表情图片" + } + ] + } + ] + }, + { + "ID": "20221202214533-6s8dyno", + "Type": "NodeListItem", + "ListData": { + "BulletChar": 42, + "Marker": "Kg==" + }, + "Properties": { + "id": "20221202214533-6s8dyno" + }, + "Children": [ + { + "ID": "20221202214533-jfy92ef", + "Type": "NodeParagraph", + "Properties": { + "id": "20221202214533-jfy92ef", + "updated": "20221202214549" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "​" + }, + { + "Type": "NodeTextMark", + "TextMarkType": "code", + "TextMarkTextContent": "snippets" + }, + { + "Type": "NodeText", + "Data": "​ 用于保存代码片段" + } + ] + } + ] + }, + { + "ID": "20221202214653-s19pmcp", + "Type": "NodeListItem", + "ListData": { + "BulletChar": 42, + "Marker": "Kg==" + }, + "Properties": { + "id": "20221202214653-s19pmcp", + "updated": "20221202214912" + }, + "Children": [ + { + "ID": "20221202214653-trmmieq", + "Type": "NodeParagraph", + "Properties": { + "id": "20221202214653-trmmieq", + "updated": "20221202214912" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "​" + }, + { + "Type": "NodeTextMark", + "TextMarkType": "code", + "TextMarkTextContent": "storage" + }, + { + "Type": "NodeText", + "Data": "​ 用于保存浏览器 localStorage 以及闪卡数据等" + } + ] + } + ] + }, { "ID": "20210428213944-j13vr82", "Type": "NodeListItem", @@ -449,7 +559,7 @@ }, { "Type": "NodeText", - "Data": "​ 用于保存" + "Data": "​​ 用于保存" }, { "Type": "NodeTextMark", @@ -493,7 +603,7 @@ }, { "Type": "NodeText", - "Data": "​ 用于保存" + "Data": "​​ 用于保存" }, { "Type": "NodeTextMark", @@ -506,43 +616,6 @@ } ] }, - { - "ID": "20210826092236-9cre4ae", - "Type": "NodeListItem", - "ListData": { - "BulletChar": 42, - "Marker": "Kg==" - }, - "Properties": { - "id": "20210826092236-9cre4ae", - "updated": "20210826092321" - }, - "Children": [ - { - "ID": "20210826092236-r5kusqv", - "Type": "NodeParagraph", - "Properties": { - "id": "20210826092236-r5kusqv", - "updated": "20210826092321" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "​" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "code", - "TextMarkTextContent": "emojis" - }, - { - "Type": "NodeText", - "Data": "​ 用于保存 Emoji 图片" - } - ] - } - ] - }, { "ID": "20210428214049-1kebc1m", "Type": "NodeListItem", @@ -574,7 +647,7 @@ }, { "Type": "NodeText", - "Data": "​ 后缀的文件用于保存文档数据,数据格式为 JSON" + "Data": "​​ 后缀的文件用于保存文档数据,数据格式为 JSON" } ] } @@ -970,7 +1043,7 @@ "ListData": {}, "Properties": { "id": "20220526112824-mw30a1z", - "updated": "20220808132829" + "updated": "20221202214109" }, "Children": [ { @@ -1004,110 +1077,58 @@ ] }, { - "ID": "20220526112824-r9uu71u", + "ID": "20221202214106-cbq0omo", "Type": "NodeListItem", "ListData": { "BulletChar": 42, "Marker": "Kg==" }, "Properties": { - "id": "20220526112824-r9uu71u", - "updated": "20220526112824" + "id": "20221202214106-cbq0omo" }, "Children": [ { - "ID": "20220526112824-fxlsr6k", + "ID": "20221202214106-cpfwdrq", "Type": "NodeParagraph", "Properties": { - "id": "20220526112824-fxlsr6k", - "updated": "20220615151915" + "id": "20221202214106-cpfwdrq", + "updated": "20221202214109" }, "Children": [ { "Type": "NodeTextMark", "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/user-guide-zh_CN", - "TextMarkTextContent": "用户指南" - }, - { - "Type": "NodeText", - "Data": "和" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/appearance", - "TextMarkTextContent": "外观" + "TextMarkAHref": "https://github.com/siyuan-note/siyuan-android", + "TextMarkTextContent": "Android 端" } ] } ] }, { - "ID": "20220526112824-w23ystc", + "ID": "20221202214109-8fu6oix", "Type": "NodeListItem", "ListData": { "BulletChar": 42, "Marker": "Kg==" }, "Properties": { - "id": "20220526112824-w23ystc", - "updated": "20220808132829" + "id": "20221202214109-8fu6oix", + "updated": "20221202214109" }, "Children": [ { - "ID": "20220526112824-8p1ws46", + "ID": "20221202214109-wx29l27", "Type": "NodeParagraph", "Properties": { - "id": "20220526112824-8p1ws46", - "updated": "20220808132829" + "id": "20221202214109-wx29l27" }, "Children": [ { "Type": "NodeTextMark", "TextMarkType": "a", - "TextMarkAHref": "https://github.com/88250/lute", - "TextMarkTextContent": "编辑器引擎" - } - ] - } - ] - }, - { - "ID": "20220526112824-2s9lzl6", - "Type": "NodeListItem", - "ListData": { - "BulletChar": 42, - "Marker": "Kg==" - }, - "Properties": { - "id": "20220526112824-2s9lzl6", - "updated": "20220526112824" - }, - "Children": [ - { - "ID": "20220526112824-ib9nppy", - "Type": "NodeParagraph", - "Properties": { - "id": "20220526112824-ib9nppy", - "updated": "20220615151946" - }, - "Children": [ - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/encryption", - "TextMarkTextContent": "端到端加密" - }, - { - "Type": "NodeText", - "Data": "和" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/dejavu", - "TextMarkTextContent": "数据仓库" + "TextMarkAHref": "https://github.com/siyuan-note/siyuan-ios", + "TextMarkTextContent": "iOS 端" } ] } @@ -1142,46 +1163,6 @@ ] } ] - }, - { - "ID": "20220526112824-zp2o0bd", - "Type": "NodeListItem", - "ListData": { - "BulletChar": 42, - "Marker": "Kg==" - }, - "Properties": { - "id": "20220526112824-zp2o0bd", - "updated": "20220615151956" - }, - "Children": [ - { - "ID": "20220526112824-f3e6e6n", - "Type": "NodeParagraph", - "Properties": { - "id": "20220526112824-f3e6e6n", - "updated": "20220615151956" - }, - "Children": [ - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/siyuan-android", - "TextMarkTextContent": "Android 端" - }, - { - "Type": "NodeText", - "Data": "和 " - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/siyuan-ios", - "TextMarkTextContent": "iOS 端" - } - ] - } - ] } ] }, diff --git a/app/guide/20211226090932-5lcq56f/20211226115227-r1rty9v.sy b/app/guide/20211226090932-5lcq56f/20211226115227-r1rty9v.sy index a2e6afd75..f8a06db9b 100644 --- a/app/guide/20211226090932-5lcq56f/20211226115227-r1rty9v.sy +++ b/app/guide/20211226090932-5lcq56f/20211226115227-r1rty9v.sy @@ -6,7 +6,7 @@ "icon": "2753", "id": "20211226115227-r1rty9v", "title": "常見問題", - "updated": "20221114173816" + "updated": "20221202215232" }, "Children": [ { @@ -270,7 +270,7 @@ "ListData": {}, "Properties": { "id": "20211226115356-i1v42hf", - "updated": "20220329160520" + "updated": "20221202215232" }, "Children": [ { @@ -304,7 +304,7 @@ }, { "Type": "NodeText", - "Data": "​ 用於保存所有插入的" + "Data": "​​ 用於保存所有插入的" }, { "Type": "NodeTextMark", @@ -317,6 +317,115 @@ } ] }, + { + "ID": "20221202215155-za7sgpu", + "Type": "NodeListItem", + "ListData": { + "BulletChar": 42, + "Marker": "Kg==" + }, + "Properties": { + "id": "20221202215155-za7sgpu" + }, + "Children": [ + { + "ID": "20221202215155-gzavzm9", + "Type": "NodeParagraph", + "Properties": { + "id": "20221202215155-gzavzm9", + "updated": "20221202215210" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "​" + }, + { + "Type": "NodeTextMark", + "TextMarkType": "code", + "TextMarkTextContent": "emojis" + }, + { + "Type": "NodeText", + "Data": "​ 用於保存自定義圖標表情圖片" + } + ] + } + ] + }, + { + "ID": "20221202215213-i82djox", + "Type": "NodeListItem", + "ListData": { + "BulletChar": 42, + "Marker": "Kg==" + }, + "Properties": { + "id": "20221202215213-i82djox" + }, + "Children": [ + { + "ID": "20221202215213-r3f80k4", + "Type": "NodeParagraph", + "Properties": { + "id": "20221202215213-r3f80k4", + "updated": "20221202215224" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "​" + }, + { + "Type": "NodeTextMark", + "TextMarkType": "code", + "TextMarkTextContent": "snippets" + }, + { + "Type": "NodeText", + "Data": "​ 用於保存代碼片段" + } + ] + } + ] + }, + { + "ID": "20221202215226-ibnf53j", + "Type": "NodeListItem", + "ListData": { + "BulletChar": 42, + "Marker": "Kg==" + }, + "Properties": { + "id": "20221202215226-ibnf53j", + "updated": "20221202215232" + }, + "Children": [ + { + "ID": "20221202215226-n689p7u", + "Type": "NodeParagraph", + "Properties": { + "id": "20221202215226-n689p7u", + "updated": "20221202215232" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "​" + }, + { + "Type": "NodeTextMark", + "TextMarkType": "code", + "TextMarkTextContent": "storage" + }, + { + "Type": "NodeText", + "Data": "​ 用於保存瀏覽器 localStorage 以及閃卡數據等" + } + ] + } + ] + }, { "ID": "20211226115356-dmkm408", "Type": "NodeListItem", @@ -348,7 +457,7 @@ }, { "Type": "NodeText", - "Data": "​ 用於保存" + "Data": "​​ 用於保存" }, { "Type": "NodeTextMark", @@ -392,7 +501,7 @@ }, { "Type": "NodeText", - "Data": "​ 用於保存" + "Data": "​​ 用於保存" }, { "Type": "NodeTextMark", @@ -405,41 +514,6 @@ } ] }, - { - "ID": "20211226115356-09xvo09", - "Type": "NodeListItem", - "ListData": { - "BulletChar": 42, - "Marker": "Kg==" - }, - "Properties": { - "id": "20211226115356-09xvo09" - }, - "Children": [ - { - "ID": "20211226115356-1r4537c", - "Type": "NodeParagraph", - "Properties": { - "id": "20211226115356-1r4537c" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "​" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "code", - "TextMarkTextContent": "emojis" - }, - { - "Type": "NodeText", - "Data": "​ 用於保存 Emoji 圖片" - } - ] - } - ] - }, { "ID": "20211226115356-vfc2ba3", "Type": "NodeListItem", @@ -471,7 +545,7 @@ }, { "Type": "NodeText", - "Data": "​ 後綴的文件用於保存文檔資料,資料格式為 JSON" + "Data": "​​ 後綴的文件用於保存文檔資料,資料格式為 JSON" } ] } @@ -905,110 +979,57 @@ ] }, { - "ID": "20220526112905-0vhtidf", + "ID": "20221202214433-gt06q1x", "Type": "NodeListItem", "ListData": { "BulletChar": 42, "Marker": "Kg==" }, "Properties": { - "id": "20220526112905-0vhtidf", - "updated": "20220526112905" + "id": "20221202214433-gt06q1x" }, "Children": [ { - "ID": "20220526112905-ofq01hk", + "ID": "20221202214433-gyqo6sf", "Type": "NodeParagraph", "Properties": { - "id": "20220526112905-ofq01hk", - "updated": "20220615152032" + "id": "20221202214433-gyqo6sf", + "updated": "20221202214435" }, "Children": [ { "Type": "NodeTextMark", "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/user-guide-zh_CN", - "TextMarkTextContent": "用戶指南" - }, - { - "Type": "NodeText", - "Data": "和" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/appearance", - "TextMarkTextContent": "外觀" + "TextMarkAHref": "https://github.com/siyuan-note/siyuan-android", + "TextMarkTextContent": "Android 端" } ] } ] }, { - "ID": "20220526112905-25zib8i", + "ID": "20221202214436-snvza5h", "Type": "NodeListItem", "ListData": { "BulletChar": 42, "Marker": "Kg==" }, "Properties": { - "id": "20220526112905-25zib8i", - "updated": "20220808132844" + "id": "20221202214436-snvza5h" }, "Children": [ { - "ID": "20220526112905-lg3tfv2", + "ID": "20221202214436-ym3tiwx", "Type": "NodeParagraph", "Properties": { - "id": "20220526112905-lg3tfv2", - "updated": "20220808132844" + "id": "20221202214436-ym3tiwx" }, "Children": [ { "Type": "NodeTextMark", "TextMarkType": "a", - "TextMarkAHref": "https://github.com/88250/lute", - "TextMarkTextContent": "編輯器引擎" - } - ] - } - ] - }, - { - "ID": "20220526112905-9nfa85r", - "Type": "NodeListItem", - "ListData": { - "BulletChar": 42, - "Marker": "Kg==" - }, - "Properties": { - "id": "20220526112905-9nfa85r", - "updated": "20220526112905" - }, - "Children": [ - { - "ID": "20220526112905-idr2lmn", - "Type": "NodeParagraph", - "Properties": { - "id": "20220526112905-idr2lmn", - "updated": "20220615152127" - }, - "Children": [ - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/encryption", - "TextMarkTextContent": "端到端加密" - }, - { - "Type": "NodeText", - "Data": "和" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/dejavu", - "TextMarkTextContent": "數據倉庫" + "TextMarkAHref": "https://github.com/siyuan-note/siyuan-ios", + "TextMarkTextContent": "iOS 端" } ] } @@ -1043,46 +1064,6 @@ ] } ] - }, - { - "ID": "20220526112905-myxxgda", - "Type": "NodeListItem", - "ListData": { - "BulletChar": 42, - "Marker": "Kg==" - }, - "Properties": { - "id": "20220526112905-myxxgda", - "updated": "20220615152136" - }, - "Children": [ - { - "ID": "20220526112905-9l7ydfc", - "Type": "NodeParagraph", - "Properties": { - "id": "20220526112905-9l7ydfc", - "updated": "20220615152136" - }, - "Children": [ - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/siyuan-android", - "TextMarkTextContent": "Android 端" - }, - { - "Type": "NodeText", - "Data": "和 " - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/siyuan-ios", - "TextMarkTextContent": "iOS 端" - } - ] - } - ] } ] }, From d8236681a50e54d600910784fb97e445baad0f90 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 2 Dec 2022 23:38:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:art:=20=E6=90=9C=E7=B4=A2=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=8E=92=E5=BA=8F=20Fix=20https://github.com/siyuan-n?= =?UTF-8?q?ote/siyuan/issues/6766?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/block.go | 2 ++ kernel/model/search.go | 65 ++++++++++++++++++++++++++++++++---------- 2 files changed, 52 insertions(+), 15 deletions(-) diff --git a/kernel/model/block.go b/kernel/model/block.go index b8b8b2124..408895cba 100644 --- a/kernel/model/block.go +++ b/kernel/model/block.go @@ -56,6 +56,8 @@ type Block struct { Depth int `json:"depth"` Count int `json:"count"` Sort int `json:"sort"` + Created string `json:"created"` + Updated string `json:"updated"` } func (block *Block) IsContainerBlock() bool { diff --git a/kernel/model/search.go b/kernel/model/search.go index 36d91ca28..b363ac1d6 100644 --- a/kernel/model/search.go +++ b/kernel/model/search.go @@ -312,10 +312,12 @@ func FindReplace(keyword, replacement string, ids []string, method int) (err err return } +// FullTextSearchBlock 搜索内容块。 +// +// method:0:文本,1:查询语法,2:SQL,3:正则表达式 +// orderBy: 0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时) +// groupBy:0:不分组,1:按文档分组 func FullTextSearchBlock(query string, boxes, paths []string, types map[string]bool, method, orderBy, groupBy int) (ret []*Block, matchedBlockCount, matchedRootCount int) { - // method:0:文本,1:查询语法,2:SQL,3:正则表达式 - // orderBy: 0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时) - // groupBy:0:不分组,1:按文档分组 query = strings.TrimSpace(query) beforeLen := 36 var blocks []*Block @@ -346,7 +348,7 @@ func FullTextSearchBlock(query string, boxes, paths []string, types map[string]b case 1: // 按文档分组 rootMap := map[string]bool{} var rootIDs []string - sorts := map[string]int{} + contentSorts := map[string]int{} for _, b := range blocks { if _, ok := rootMap[b.RootID]; !ok { rootMap[b.RootID] = true @@ -356,16 +358,18 @@ func FullTextSearchBlock(query string, boxes, paths []string, types map[string]b continue } - sort := 0 - ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus { - if !entering || !n.IsBlock() { - return ast.WalkContinue - } + if 5 == orderBy { // 按内容顺序(仅在按文档分组时) + sort := 0 + ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus { + if !entering || !n.IsBlock() { + return ast.WalkContinue + } - sorts[n.ID] = sort - sort++ - return ast.WalkContinue - }) + contentSorts[n.ID] = sort + sort++ + return ast.WalkContinue + }) + } } } @@ -373,12 +377,43 @@ func FullTextSearchBlock(query string, boxes, paths []string, types map[string]b roots := fromSQLBlocks(&sqlRoots, "", beforeLen) for _, root := range roots { for _, b := range blocks { - b.Sort = sorts[b.ID] + if 5 == orderBy { // 按内容顺序(仅在按文档分组时) + b.Sort = contentSorts[b.ID] + } if b.RootID == root.ID { root.Children = append(root.Children, b) } } - sort.Slice(root.Children, func(i, j int) bool { return root.Children[i].Sort < root.Children[j].Sort }) + + switch orderBy { + case 1: //按创建时间升序 + sort.Slice(root.Children, func(i, j int) bool { return root.Children[i].Created < root.Children[j].Created }) + case 2: // 按创建时间降序 + sort.Slice(root.Children, func(i, j int) bool { return root.Children[i].Created > root.Children[j].Created }) + case 3: // 按更新时间升序 + sort.Slice(root.Children, func(i, j int) bool { return root.Children[i].Updated < root.Children[j].Updated }) + case 4: // 按更新时间降序 + sort.Slice(root.Children, func(i, j int) bool { return root.Children[i].Updated > root.Children[j].Updated }) + case 5: // 按内容顺序(仅在按文档分组时) + sort.Slice(root.Children, func(i, j int) bool { return root.Children[i].Sort < root.Children[j].Sort }) + default: // 按块类型(默认) + sort.Slice(root.Children, func(i, j int) bool { return root.Children[i].Sort < root.Children[j].Sort }) + } + } + + switch orderBy { + case 1: //按创建时间升序 + sort.Slice(roots, func(i, j int) bool { return roots[i].Created < roots[j].Created }) + case 2: // 按创建时间降序 + sort.Slice(roots, func(i, j int) bool { return roots[i].Created > roots[j].Created }) + case 3: // 按更新时间升序 + sort.Slice(roots, func(i, j int) bool { return roots[i].Updated < roots[j].Updated }) + case 4: // 按更新时间降序 + sort.Slice(roots, func(i, j int) bool { return roots[i].Updated > roots[j].Updated }) + case 5: // 按内容顺序(仅在按文档分组时) + // 都是文档,不需要再次排序 + default: // 按块类型(默认) + // 都是文档,不需要再次排序 } ret = roots default: