diff --git a/app/changelogs/v2.10.7/v2.10.7.md b/app/changelogs/v2.10.7/v2.10.7.md index 889250e91..a7cf1d51c 100644 --- a/app/changelogs/v2.10.7/v2.10.7.md +++ b/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 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 table row insertion when using the fixed header](https://github.com/siyuan-note/siyuan/issues/9265) ### Bugfix diff --git a/app/changelogs/v2.10.7/v2.10.7_zh_CHT.md b/app/changelogs/v2.10.7/v2.10.7_zh_CHT.md index 4373d419a..48ab7053c 100644 --- a/app/changelogs/v2.10.7/v2.10.7_zh_CHT.md +++ b/app/changelogs/v2.10.7/v2.10.7_zh_CHT.md @@ -1,6 +1,6 @@ ## 概述 -此版本修復了一些缺陷,建議升級。 另外,從此版本開始付費用戶可以優先參與資料庫特性公測。 +此版本修復了一些缺陷,建議升級。另外,從此版本開始付費用戶可以優先參與資料庫特性公測。 廣告: 目前 `功能特性` 正處於早鳥價階段,歡迎[了解](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/9252) * [改進分隔線編輯](https://github.com/siyuan-note/siyuan/issues/9259) +* [使用固定標題時改進表格行插入](https://github.com/siyuan-note/siyuan/issues/9265) ### 修復缺陷 diff --git a/app/changelogs/v2.10.7/v2.10.7_zh_CN.md b/app/changelogs/v2.10.7/v2.10.7_zh_CN.md index 9f41cdf73..7f0c47240 100644 --- a/app/changelogs/v2.10.7/v2.10.7_zh_CN.md +++ b/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/9252) * [改进分隔线编辑](https://github.com/siyuan-note/siyuan/issues/9259) +* [使用固定标题时改进表格行插入](https://github.com/siyuan-note/siyuan/issues/9265) ### 修复缺陷 diff --git a/kernel/model/assets.go b/kernel/model/assets.go index f4436d5d8..8f651a6e6 100644 --- a/kernel/model/assets.go +++ b/kernel/model/assets.go @@ -663,6 +663,37 @@ func UnusedAssets() (ret []string) { 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 { delete(assetsPathMap, toRemove) } diff --git a/kernel/model/import.go b/kernel/model/import.go index b7d44305d..383beedbd 100644 --- a/kernel/model/import.go +++ b/kernel/model/import.go @@ -260,18 +260,13 @@ func ImportSY(zipPath, boxID, toPath string) (err error) { ial := parse.IAL2Map(n.KramdownIAL) for k, v := range ial { if strings.HasPrefix(k, NodeAttrNamePrefixAvKey) || strings.HasPrefix(k, NodeAttrNameAvs) { + newKey, newVal := k, v 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) } }