Browse Source

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

Vanessa 1 year ago
parent
commit
67be62d54d

+ 1 - 0
app/changelogs/v2.10.7/v2.10.7.md

@@ -24,6 +24,7 @@ Below are the detailed changes in this version.
 * [Improve data sync network connectivity check](https://github.com/siyuan-note/siyuan/issues/9251)
 * [Improve data sync network connectivity check](https://github.com/siyuan-note/siyuan/issues/9251)
 * [Improve the handling of inline-code containing `|` in the table](https://github.com/siyuan-note/siyuan/issues/9252)
 * [Improve the handling of inline-code containing `|` in the table](https://github.com/siyuan-note/siyuan/issues/9252)
 * [Improve thematic break editing](https://github.com/siyuan-note/siyuan/issues/9259)
 * [Improve thematic break editing](https://github.com/siyuan-note/siyuan/issues/9259)
+* [Improve table row insertion when using the fixed header](https://github.com/siyuan-note/siyuan/issues/9265)
 
 
 ### Bugfix
 ### Bugfix
 
 

+ 2 - 1
app/changelogs/v2.10.7/v2.10.7_zh_CHT.md

@@ -1,6 +1,6 @@
 ## 概述
 ## 概述
 
 
-此版本修復了一些缺陷,建議升級。 另外,從此版本開始付費用戶可以優先參與資料庫特性公測。
+此版本修復了一些缺陷,建議升級。另外,從此版本開始付費用戶可以優先參與資料庫特性公測。
 
 
 廣告: 目前 `功能特性` 正處於早鳥價階段,歡迎[了解](https://b3log.org/siyuan/pricing.html)。
 廣告: 目前 `功能特性` 正處於早鳥價階段,歡迎[了解](https://b3log.org/siyuan/pricing.html)。
 
 
@@ -24,6 +24,7 @@
 * [改進資料同步網路連結性檢查](https://github.com/siyuan-note/siyuan/issues/9251)
 * [改進資料同步網路連結性檢查](https://github.com/siyuan-note/siyuan/issues/9251)
 * [改進表格中包含 `|` 時行級程式碼的處理](https://github.com/siyuan-note/siyuan/issues/9252)
 * [改進表格中包含 `|` 時行級程式碼的處理](https://github.com/siyuan-note/siyuan/issues/9252)
 * [改進分隔線編輯](https://github.com/siyuan-note/siyuan/issues/9259)
 * [改進分隔線編輯](https://github.com/siyuan-note/siyuan/issues/9259)
+* [使用固定標題時改進表格行插入](https://github.com/siyuan-note/siyuan/issues/9265)
 
 
 ### 修復缺陷
 ### 修復缺陷
 
 

+ 1 - 0
app/changelogs/v2.10.7/v2.10.7_zh_CN.md

@@ -24,6 +24,7 @@
 * [改进数据同步网络连通性检查](https://github.com/siyuan-note/siyuan/issues/9251)
 * [改进数据同步网络连通性检查](https://github.com/siyuan-note/siyuan/issues/9251)
 * [改进表格中包含 `|` 时行级代码的处理](https://github.com/siyuan-note/siyuan/issues/9252)
 * [改进表格中包含 `|` 时行级代码的处理](https://github.com/siyuan-note/siyuan/issues/9252)
 * [改进分隔线编辑](https://github.com/siyuan-note/siyuan/issues/9259)
 * [改进分隔线编辑](https://github.com/siyuan-note/siyuan/issues/9259)
+* [使用固定标题时改进表格行插入](https://github.com/siyuan-note/siyuan/issues/9265)
 
 
 ### 修复缺陷
 ### 修复缺陷
 
 

+ 31 - 0
kernel/model/assets.go

@@ -663,6 +663,37 @@ func UnusedAssets() (ret []string) {
 			continue
 			continue
 		}
 		}
 	}
 	}
+
+	// 排除数据库中引用的资源文件
+	storageAvDir := filepath.Join(util.DataDir, "storage", "av")
+	if gulu.File.IsDir(storageAvDir) {
+		entries, readErr := os.ReadDir(storageAvDir)
+		if nil != readErr {
+			logging.LogErrorf("read dir [%s] failed: %s", storageAvDir, readErr)
+			err = readErr
+			return
+		}
+
+		for _, entry := range entries {
+			if !strings.HasSuffix(entry.Name(), ".json") || !ast.IsNodeIDPattern(strings.TrimSuffix(entry.Name(), ".json")) {
+				continue
+			}
+
+			data, readDataErr := filelock.ReadFile(filepath.Join(util.DataDir, "storage", "av", entry.Name()))
+			if nil != readDataErr {
+				logging.LogErrorf("read file [%s] failed: %s", entry.Name(), readDataErr)
+				err = readDataErr
+				return
+			}
+
+			for asset, _ := range assetsPathMap {
+				if bytes.Contains(data, []byte(asset)) {
+					toRemoves = append(toRemoves, asset)
+				}
+			}
+		}
+	}
+
 	for _, toRemove := range toRemoves {
 	for _, toRemove := range toRemoves {
 		delete(assetsPathMap, toRemove)
 		delete(assetsPathMap, toRemove)
 	}
 	}

+ 5 - 10
kernel/model/import.go

@@ -260,18 +260,13 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
 				ial := parse.IAL2Map(n.KramdownIAL)
 				ial := parse.IAL2Map(n.KramdownIAL)
 				for k, v := range ial {
 				for k, v := range ial {
 					if strings.HasPrefix(k, NodeAttrNamePrefixAvKey) || strings.HasPrefix(k, NodeAttrNameAvs) {
 					if strings.HasPrefix(k, NodeAttrNamePrefixAvKey) || strings.HasPrefix(k, NodeAttrNameAvs) {
+						newKey, newVal := k, v
 						for oldAvID, newAvID := range avIDs {
 						for oldAvID, newAvID := range avIDs {
-							newKey := strings.ReplaceAll(k, oldAvID, newAvID)
-							newVal := strings.ReplaceAll(v, oldAvID, newAvID)
-							if newKey != k {
-								n.SetIALAttr(newKey, v)
-								n.RemoveIALAttr(k)
-								k = newKey
-							}
-							if newVal != v {
-								n.SetIALAttr(k, newVal)
-							}
+							newKey = strings.ReplaceAll(newKey, oldAvID, newAvID)
+							newVal = strings.ReplaceAll(newVal, oldAvID, newAvID)
 						}
 						}
+						n.RemoveIALAttr(k)
+						n.SetIALAttr(newKey, newVal)
 					}
 					}
 				}
 				}