Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 2 rokov pred
rodič
commit
d595e7bb14

+ 1 - 0
README.md

@@ -188,6 +188,7 @@ The data is saved in the workspace folder, in the workspace data folder:
 * `storage` is used to save query conditions, layouts and flashcards, etc.
 * `templates` is used to save template snippets
 * `widgets` is used to save widgets
+* `plugins` is used to save plugins
 * 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?

+ 1 - 0
README_zh_CN.md

@@ -199,6 +199,7 @@
 * `storage` 用于保存查询条件、布局和闪卡数据等
 * `templates` 用于保存模板片段
 * `widgets` 用于保存挂件
+* `plugins` 用于保存插件
 * 其余文件夹就是用户自己创建的笔记本文件夹,笔记本文件夹下 `.sy` 后缀的文件用于保存文档数据,数据格式为 JSON
 
 ### 支持通过第三方同步盘进行数据同步吗?

+ 36 - 3
app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20210824202056-udkf7wg.sy

@@ -5,7 +5,7 @@
 	"Properties": {
 		"id": "20210824202056-udkf7wg",
 		"title": "Widgets",
-		"updated": "20230506210716"
+		"updated": "20230512195357"
 	},
 	"Children": [
 		{
@@ -33,7 +33,15 @@
 			"Children": [
 				{
 					"Type": "NodeText",
-					"Data": "The widget is a static webpage served by SiYuan Kernel. It accesses data through API and renders it through "
+					"Data": "The widget is a static webpage served by "
+				},
+				{
+					"Type": "NodeText",
+					"Data": "SiYuan"
+				},
+				{
+					"Type": "NodeText",
+					"Data": " Kernel. It accesses data through API and renders it through "
 				},
 				{
 					"Type": "NodeTextMark",
@@ -42,7 +50,32 @@
 				},
 				{
 					"Type": "NodeText",
-					"Data": "."
+					"Data": "​."
+				}
+			]
+		},
+		{
+			"ID": "20230512195321-tin4qpv",
+			"Type": "NodeParagraph",
+			"Properties": {
+				"id": "20230512195321-tin4qpv",
+				"updated": "20230512195357"
+			},
+			"Children": [
+				{
+					"Type": "NodeText",
+					"Data": "Compared with "
+				},
+				{
+					"Type": "NodeTextMark",
+					"TextMarkType": "block-ref",
+					"TextMarkBlockRefID": "20230506205948-yah52eb",
+					"TextMarkBlockRefSubtype": "s",
+					"TextMarkTextContent": "plugins"
+				},
+				{
+					"Type": "NodeText",
+					"Data": ", a widget is a kind of content block, which follows the indexing and rendering rules of the block. The widget is mainly oriented to content block extension, not to program function extension."
 				}
 			]
 		},

+ 19 - 5
app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20230506205948-yah52eb.sy

@@ -5,7 +5,7 @@
 	"Properties": {
 		"id": "20230506205948-yah52eb",
 		"title": "Plugins",
-		"updated": "20230506211146"
+		"updated": "20230512195433"
 	},
 	"Children": [
 		{
@@ -28,23 +28,37 @@
 			"Type": "NodeParagraph",
 			"Properties": {
 				"id": "20230506210937-bt48731",
-				"updated": "20230506211000"
+				"updated": "20230512195419"
 			},
 			"Children": [
 				{
 					"Type": "NodeText",
-					"Data": "Plugins are mainly used to expand the overall functions of SiYuan. Compared with "
+					"Data": "Plugins are mainly used to expand the overall functions of SiYuan."
+				}
+			]
+		},
+		{
+			"ID": "20230512195420-9550ilh",
+			"Type": "NodeParagraph",
+			"Properties": {
+				"id": "20230512195420-9550ilh",
+				"updated": "20230512195433"
+			},
+			"Children": [
+				{
+					"Type": "NodeText",
+					"Data": "Compared with "
 				},
 				{
 					"Type": "NodeTextMark",
 					"TextMarkType": "block-ref",
 					"TextMarkBlockRefID": "20210824202056-udkf7wg",
 					"TextMarkBlockRefSubtype": "s",
-					"TextMarkTextContent": "Widgets"
+					"TextMarkTextContent": "widgets"
 				},
 				{
 					"Type": "NodeText",
-					"Data": ", the plugin can exist without the document, which is more flexible and powerful."
+					"Data": ", the plugin is mainly for program function extension, not for content block extension."
 				}
 			]
 		},

+ 53 - 9
app/guide/20210808180117-6v0mkxr/20200923234731-h3zkwm2.sy

@@ -7,7 +7,7 @@
 		"id": "20200923234731-h3zkwm2",
 		"title": "FAQ",
 		"type": "doc",
-		"updated": "20230429085233"
+		"updated": "20230512170538"
 	},
 	"Children": [
 		{
@@ -268,7 +268,7 @@
 			"ListData": {},
 			"Properties": {
 				"id": "20210428222603-moih9fe",
-				"updated": "20230429085233"
+				"updated": "20230512170538"
 			},
 			"Children": [
 				{
@@ -302,7 +302,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​ is used to save all inserted "
+									"Data": "​ is used to save all inserted "
 								},
 								{
 									"Type": "NodeTextMark",
@@ -346,7 +346,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​ is used to save emoji images"
+									"Data": "​ is used to save emoji images"
 								}
 							]
 						}
@@ -383,7 +383,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​ is used to save code snippets"
+									"Data": "​ is used to save code snippets"
 								}
 							]
 						}
@@ -420,7 +420,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​ is used to save query conditions, layouts and "
+									"Data": "​ is used to save query conditions, layouts and "
 								},
 								{
 									"Type": "NodeTextMark",
@@ -468,7 +468,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​ is used to save "
+									"Data": "​ is used to save "
 								},
 								{
 									"Type": "NodeTextMark",
@@ -512,7 +512,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​ is used to save "
+									"Data": "​ is used to save "
 								},
 								{
 									"Type": "NodeTextMark",
@@ -525,6 +525,50 @@
 						}
 					]
 				},
+				{
+					"ID": "20230512170526-zvfzhdo",
+					"Type": "NodeListItem",
+					"ListData": {
+						"BulletChar": 42,
+						"Marker": "Kg=="
+					},
+					"Properties": {
+						"id": "20230512170526-zvfzhdo",
+						"updated": "20230512170538"
+					},
+					"Children": [
+						{
+							"ID": "20230512170526-3ivxdkg",
+							"Type": "NodeParagraph",
+							"Properties": {
+								"id": "20230512170526-3ivxdkg",
+								"updated": "20230512170538"
+							},
+							"Children": [
+								{
+									"Type": "NodeText",
+									"Data": "​"
+								},
+								{
+									"Type": "NodeTextMark",
+									"TextMarkType": "code",
+									"TextMarkTextContent": "plugins"
+								},
+								{
+									"Type": "NodeText",
+									"Data": "​ is used to save "
+								},
+								{
+									"Type": "NodeTextMark",
+									"TextMarkType": "block-ref",
+									"TextMarkBlockRefID": "20230506205948-yah52eb",
+									"TextMarkBlockRefSubtype": "s",
+									"TextMarkTextContent": "plugins"
+								}
+							]
+						}
+					]
+				},
 				{
 					"ID": "20210428222603-27so3jy",
 					"Type": "NodeListItem",
@@ -555,7 +599,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"
 								}
 							]
 						}

+ 28 - 3
app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20210824201257-cy7icrc.sy

@@ -5,7 +5,7 @@
 	"Properties": {
 		"id": "20210824201257-cy7icrc",
 		"title": "挂件",
-		"updated": "20230506210708"
+		"updated": "20230512194517"
 	},
 	"Children": [
 		{
@@ -28,7 +28,7 @@
 			"Type": "NodeParagraph",
 			"Properties": {
 				"id": "20210824201352-z3731rx",
-				"updated": "20210824201939"
+				"updated": "20230512170805"
 			},
 			"Children": [
 				{
@@ -42,7 +42,32 @@
 				},
 				{
 					"Type": "NodeText",
-					"Data": " 进行渲染展现。"
+					"Data": "​ 进行渲染展现。"
+				}
+			]
+		},
+		{
+			"ID": "20230512170809-69w37zm",
+			"Type": "NodeParagraph",
+			"Properties": {
+				"id": "20230512170809-69w37zm",
+				"updated": "20230512194517"
+			},
+			"Children": [
+				{
+					"Type": "NodeText",
+					"Data": "相较于"
+				},
+				{
+					"Type": "NodeTextMark",
+					"TextMarkType": "block-ref",
+					"TextMarkBlockRefID": "20230506210010-houyyvy",
+					"TextMarkBlockRefSubtype": "s",
+					"TextMarkTextContent": "插件"
+				},
+				{
+					"Type": "NodeText",
+					"Data": "而言,挂件是一种内容块,遵循块的索引和渲染规则,挂件主要面向内容块扩展,不面向程序功能扩展。"
 				}
 			]
 		},

+ 25 - 3
app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20230506210010-houyyvy.sy

@@ -5,7 +5,7 @@
 	"Properties": {
 		"id": "20230506210010-houyyvy",
 		"title": "插件",
-		"updated": "20230506211757"
+		"updated": "20230512171323"
 	},
 	"Children": [
 		{
@@ -33,7 +33,29 @@
 			"Children": [
 				{
 					"Type": "NodeText",
-					"Data": "插件主要用于扩展思源整体功能。相较于"
+					"Data": "插件主要用于扩展"
+				},
+				{
+					"Type": "NodeText",
+					"Data": "思源"
+				},
+				{
+					"Type": "NodeText",
+					"Data": "整体功能。"
+				}
+			]
+		},
+		{
+			"ID": "20230512170814-itmsfoy",
+			"Type": "NodeParagraph",
+			"Properties": {
+				"id": "20230512170814-itmsfoy",
+				"updated": "20230512171323"
+			},
+			"Children": [
+				{
+					"Type": "NodeText",
+					"Data": "相较于"
 				},
 				{
 					"Type": "NodeTextMark",
@@ -44,7 +66,7 @@
 				},
 				{
 					"Type": "NodeText",
-					"Data": "而言,插件可以脱离于文档而存在,更为灵活和强大。"
+					"Data": "而言,插件主要面向程序功能扩展,不面向内容块扩展。"
 				}
 			]
 		},

+ 61 - 9
app/guide/20210808180117-czj9bvb/20200813093015-u6bopdt.sy

@@ -7,7 +7,7 @@
 		"id": "20200813093015-u6bopdt",
 		"title": "常见问题",
 		"type": "doc",
-		"updated": "20230429085021"
+		"updated": "20230512170439"
 	},
 	"Children": [
 		{
@@ -326,7 +326,7 @@
 			"ListData": {},
 			"Properties": {
 				"id": "20210428213927-rbcfx2y",
-				"updated": "20230429085021"
+				"updated": "20230512170439"
 			},
 			"Children": [
 				{
@@ -360,7 +360,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​​ 用于保存所有插入的"
+									"Data": "​​ 用于保存所有插入的"
 								},
 								{
 									"Type": "NodeTextMark",
@@ -404,7 +404,15 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​ 用于保存自定义图标表情图片"
+									"Data": "​​ 用于保存自定义"
+								},
+								{
+									"Type": "NodeText",
+									"Data": "图标"
+								},
+								{
+									"Type": "NodeText",
+									"Data": "表情图片"
 								}
 							]
 						}
@@ -440,7 +448,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​ 用于保存代码片段"
+									"Data": "​ 用于保存代码片段"
 								}
 							]
 						}
@@ -477,7 +485,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​ 用于保存查询条件、布局和"
+									"Data": "​ 用于保存查询条件、布局和"
 								},
 								{
 									"Type": "NodeTextMark",
@@ -524,7 +532,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​​ 用于保存"
+									"Data": "​​ 用于保存"
 								},
 								{
 									"Type": "NodeTextMark",
@@ -568,7 +576,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​​ 用于保存"
+									"Data": "​​ 用于保存"
 								},
 								{
 									"Type": "NodeTextMark",
@@ -581,6 +589,50 @@
 						}
 					]
 				},
+				{
+					"ID": "20230512170429-itokqka",
+					"Type": "NodeListItem",
+					"ListData": {
+						"BulletChar": 42,
+						"Marker": "Kg=="
+					},
+					"Properties": {
+						"id": "20230512170429-itokqka",
+						"updated": "20230512170439"
+					},
+					"Children": [
+						{
+							"ID": "20230512170429-dzajfaa",
+							"Type": "NodeParagraph",
+							"Properties": {
+								"id": "20230512170429-dzajfaa",
+								"updated": "20230512170439"
+							},
+							"Children": [
+								{
+									"Type": "NodeText",
+									"Data": "​"
+								},
+								{
+									"Type": "NodeTextMark",
+									"TextMarkType": "code",
+									"TextMarkTextContent": "plugins"
+								},
+								{
+									"Type": "NodeText",
+									"Data": "​ 用于保存"
+								},
+								{
+									"Type": "NodeTextMark",
+									"TextMarkType": "block-ref",
+									"TextMarkBlockRefID": "20230506210010-houyyvy",
+									"TextMarkBlockRefSubtype": "s",
+									"TextMarkTextContent": "插件"
+								}
+							]
+						}
+					]
+				},
 				{
 					"ID": "20210428214049-1kebc1m",
 					"Type": "NodeListItem",
@@ -612,7 +664,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​​ 后缀的文件用于保存文档数据,数据格式为 JSON"
+									"Data": "​​ 后缀的文件用于保存文档数据,数据格式为 JSON"
 								}
 							]
 						}

+ 53 - 9
app/guide/20211226090932-5lcq56f/20211226115227-r1rty9v.sy

@@ -6,7 +6,7 @@
 		"icon": "2753",
 		"id": "20211226115227-r1rty9v",
 		"title": "常見問題",
-		"updated": "20230429085324"
+		"updated": "20230512170521"
 	},
 	"Children": [
 		{
@@ -263,7 +263,7 @@
 			"ListData": {},
 			"Properties": {
 				"id": "20211226115356-i1v42hf",
-				"updated": "20230429085324"
+				"updated": "20230512170521"
 			},
 			"Children": [
 				{
@@ -297,7 +297,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​​ 用於保存所有插入的"
+									"Data": "​​ 用於保存所有插入的"
 								},
 								{
 									"Type": "NodeTextMark",
@@ -340,7 +340,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​ 用於保存自定義圖標表情圖片"
+									"Data": "​ 用於保存自定義圖標表情圖片"
 								}
 							]
 						}
@@ -376,7 +376,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​ 用於保存代碼片段"
+									"Data": "​ 用於保存代碼片段"
 								}
 							]
 						}
@@ -413,7 +413,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​​ 用於保存查詢條件、佈局和"
+									"Data": "​​ 用於保存查詢條件、佈局和"
 								},
 								{
 									"Type": "NodeTextMark",
@@ -461,7 +461,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​​ 用於保存"
+									"Data": "​​ 用於保存"
 								},
 								{
 									"Type": "NodeTextMark",
@@ -505,7 +505,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​​ 用於保存"
+									"Data": "​​ 用於保存"
 								},
 								{
 									"Type": "NodeTextMark",
@@ -518,6 +518,50 @@
 						}
 					]
 				},
+				{
+					"ID": "20230512170447-3eatvgq",
+					"Type": "NodeListItem",
+					"ListData": {
+						"BulletChar": 42,
+						"Marker": "Kg=="
+					},
+					"Properties": {
+						"id": "20230512170447-3eatvgq",
+						"updated": "20230512170521"
+					},
+					"Children": [
+						{
+							"ID": "20230512170447-iqoofli",
+							"Type": "NodeParagraph",
+							"Properties": {
+								"id": "20230512170447-iqoofli",
+								"updated": "20230512170521"
+							},
+							"Children": [
+								{
+									"Type": "NodeText",
+									"Data": "​"
+								},
+								{
+									"Type": "NodeTextMark",
+									"TextMarkType": "code",
+									"TextMarkTextContent": "plugins"
+								},
+								{
+									"Type": "NodeText",
+									"Data": "​ 用於保存"
+								},
+								{
+									"Type": "NodeTextMark",
+									"TextMarkType": "block-ref",
+									"TextMarkBlockRefID": "20230506211210-1roopyo",
+									"TextMarkBlockRefSubtype": "s",
+									"TextMarkTextContent": "插件"
+								}
+							]
+						}
+					]
+				},
 				{
 					"ID": "20211226115356-vfc2ba3",
 					"Type": "NodeListItem",
@@ -549,7 +593,7 @@
 								},
 								{
 									"Type": "NodeText",
-									"Data": "​​ 後綴的文件用於保存文檔資料,資料格式為 JSON"
+									"Data": "​​ 後綴的文件用於保存文檔資料,資料格式為 JSON"
 								}
 							]
 						}

+ 27 - 2
app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123101-qjw03ab.sy

@@ -5,7 +5,7 @@
 	"Properties": {
 		"id": "20211226123101-qjw03ab",
 		"title": "小工具",
-		"updated": "20230506210742"
+		"updated": "20230512195243"
 	},
 	"Children": [
 		{
@@ -42,7 +42,32 @@
 				},
 				{
 					"Type": "NodeText",
-					"Data": " 進行渲染展現。"
+					"Data": "​ 進行渲染展現。"
+				}
+			]
+		},
+		{
+			"ID": "20230512195228-movvk6h",
+			"Type": "NodeParagraph",
+			"Properties": {
+				"id": "20230512195228-movvk6h",
+				"updated": "20230512195243"
+			},
+			"Children": [
+				{
+					"Type": "NodeText",
+					"Data": "相較於"
+				},
+				{
+					"Type": "NodeTextMark",
+					"TextMarkType": "block-ref",
+					"TextMarkBlockRefID": "20230506211210-1roopyo",
+					"TextMarkBlockRefSubtype": "s",
+					"TextMarkTextContent": "插件"
+				},
+				{
+					"Type": "NodeText",
+					"Data": "而言,挂件是一種內容塊,遵循塊的索引和渲染規則,挂件主要面向內容塊擴展,不面向程序功能擴展。"
 				}
 			]
 		},

+ 54 - 5
app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20230506211210-1roopyo.sy

@@ -5,7 +5,7 @@
 	"Properties": {
 		"id": "20230506211210-1roopyo",
 		"title": "插件",
-		"updated": "20230506211739"
+		"updated": "20230512195538"
 	},
 	"Children": [
 		{
@@ -33,7 +33,29 @@
 			"Children": [
 				{
 					"Type": "NodeText",
-					"Data": "插件主要用於擴展思源整體功能。相較於"
+					"Data": "插件主要用於擴展"
+				},
+				{
+					"Type": "NodeText",
+					"Data": "思源"
+				},
+				{
+					"Type": "NodeText",
+					"Data": "整體功能。"
+				}
+			]
+		},
+		{
+			"ID": "20230512195251-z81h9wi",
+			"Type": "NodeParagraph",
+			"Properties": {
+				"id": "20230512195251-z81h9wi",
+				"updated": "20230512195305"
+			},
+			"Children": [
+				{
+					"Type": "NodeText",
+					"Data": "相較於"
 				},
 				{
 					"Type": "NodeTextMark",
@@ -44,7 +66,7 @@
 				},
 				{
 					"Type": "NodeText",
-					"Data": "而言,插件可以脫離於文檔而存在,更為靈活和強大。"
+					"Data": "而言,插件主要面向程序功能擴展,不面向內容塊擴展。"
 				}
 			]
 		},
@@ -68,7 +90,7 @@
 			"Type": "NodeParagraph",
 			"Properties": {
 				"id": "20230506211224-uqq704u",
-				"updated": "20230506211224"
+				"updated": "20230512195538"
 			},
 			"Children": [
 				{
@@ -82,7 +104,34 @@
 				},
 				{
 					"Type": "NodeText",
-					"Data": "​ 文件夾下,你可以在 \u003ckbd\u003e插件集市\u003c/kbd\u003e - \u003ckbd\u003e已下載\u003c/kbd\u003e - \u003ckbd\u003e插件\u003c/kbd\u003e 中啟用或禁用插件。"
+					"Data": "​ 文件夾下,你可以在 "
+				},
+				{
+					"Type": "NodeTextMark",
+					"TextMarkType": "kbd",
+					"TextMarkTextContent": "插件集市"
+				},
+				{
+					"Type": "NodeText",
+					"Data": "​ - "
+				},
+				{
+					"Type": "NodeTextMark",
+					"TextMarkType": "kbd",
+					"TextMarkTextContent": "已下載"
+				},
+				{
+					"Type": "NodeText",
+					"Data": "​ - "
+				},
+				{
+					"Type": "NodeTextMark",
+					"TextMarkType": "kbd",
+					"TextMarkTextContent": "插件"
+				},
+				{
+					"Type": "NodeText",
+					"Data": "​ 中啟用或禁用插件。"
 				}
 			]
 		},

+ 1 - 0
kernel/model/export.go

@@ -631,6 +631,7 @@ func prepareExportTree(bt *treenode.BlockTree) (ret *parse.Tree) {
 	ret.Path = bt.Path
 	ret.HPath = bt.HPath
 	ret.Box = bt.BoxID
+	ret.ID = bt.RootID
 	return
 }
 

+ 2 - 2
kernel/treenode/blocktree.go

@@ -234,7 +234,7 @@ func RemoveBlockTreesByPathPrefix(pathPrefix string) {
 		slice.m.Lock()
 		for _, b := range slice.data {
 			if strings.HasPrefix(b.Path, pathPrefix) {
-				ids = append(ids, b.RootID)
+				ids = append(ids, b.ID)
 			}
 		}
 		slice.m.Unlock()
@@ -276,7 +276,7 @@ func RemoveBlockTreesByBoxID(boxID string) (ids []string) {
 		slice.m.Lock()
 		for _, b := range slice.data {
 			if b.BoxID == boxID {
-				ids = append(ids, b.RootID)
+				ids = append(ids, b.ID)
 			}
 		}
 		slice.m.Unlock()