mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
This commit is contained in:
parent
fafd4f8513
commit
075a6af7ad
5 changed files with 134 additions and 54 deletions
|
|
@ -5,7 +5,7 @@
|
|||
"id": "20200924100744-br924ar",
|
||||
"title": "Assets",
|
||||
"type": "doc",
|
||||
"updated": "20220715092808"
|
||||
"updated": "20220715105117"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
|
@ -625,7 +625,7 @@
|
|||
"ListData": {},
|
||||
"Properties": {
|
||||
"id": "20220503122349-o26mvnq",
|
||||
"updated": "20220715092808"
|
||||
"updated": "20220715105117"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
|
@ -650,23 +650,7 @@
|
|||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "When deleting the notebook, in order to ensure that cross-notebook asset references work properly, the "
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "assets"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": " under the notebook will be copied to the global "
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "assets"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": " in batches"
|
||||
"Data": "When deleting the notebook, in order to ensure that cross-notebook asset references work properly, the assets under the notebook will be copied to the global assets in batches"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -694,19 +678,7 @@
|
|||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "Does not support viewing notebook-level "
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "assets"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": " history in "
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "data history"
|
||||
"Data": "Does not support viewing notebook-level assets history in data history"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -721,7 +693,7 @@
|
|||
},
|
||||
"Properties": {
|
||||
"id": "20220715092756-f5azf15",
|
||||
"updated": "20220715092808"
|
||||
"updated": "20220715105117"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
|
@ -729,7 +701,7 @@
|
|||
"Type": "NodeParagraph",
|
||||
"Properties": {
|
||||
"id": "20220715092756-4bzibji",
|
||||
"updated": "20220715092808"
|
||||
"updated": "20220715105117"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
|
@ -755,6 +727,34 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "20220715105056-8d652vx",
|
||||
"Type": "NodeListItem",
|
||||
"ListData": {
|
||||
"BulletChar": 42,
|
||||
"Marker": "Kg=="
|
||||
},
|
||||
"Properties": {
|
||||
"id": "20220715105056-8d652vx",
|
||||
"updated": "20220715105100"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"ID": "20220715105056-a6p3fg7",
|
||||
"Type": "NodeParagraph",
|
||||
"Properties": {
|
||||
"id": "20220715105056-a6p3fg7",
|
||||
"updated": "20220715105100"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "Dose not support rename"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
"id": "20200915214115-42b8zma",
|
||||
"title": "资源文件",
|
||||
"type": "doc",
|
||||
"updated": "20220715092726"
|
||||
"updated": "20220715105016"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
|
@ -547,7 +547,7 @@
|
|||
"ListData": {},
|
||||
"Properties": {
|
||||
"id": "20220503121213-afjyt05",
|
||||
"updated": "20220715092726"
|
||||
"updated": "20220715105016"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
|
@ -572,7 +572,15 @@
|
|||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "删除该笔记本时,为保证跨笔记本资源文件引用正常工作,该笔记本下的资源文件会被批量复制到全局 assets 中"
|
||||
"Data": "删除该笔记本时,为保证跨笔记本资源文件引用正常工作,该笔记本下的资源文件会被批量复制到全局 "
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "assets"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": " 中"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -661,6 +669,34 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "20220715105014-5jfe0bz",
|
||||
"Type": "NodeListItem",
|
||||
"ListData": {
|
||||
"BulletChar": 42,
|
||||
"Marker": "Kg=="
|
||||
},
|
||||
"Properties": {
|
||||
"id": "20220715105014-5jfe0bz",
|
||||
"updated": "20220715105016"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"ID": "20220715105014-3r1es71",
|
||||
"Type": "NodeParagraph",
|
||||
"Properties": {
|
||||
"id": "20220715105014-3r1es71",
|
||||
"updated": "20220715105016"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "不支持重命名"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"Properties": {
|
||||
"id": "20211226123038-4umgpxy",
|
||||
"title": "資料文件",
|
||||
"updated": "20220715092951"
|
||||
"updated": "20220715105038"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
|
@ -554,7 +554,7 @@
|
|||
"ListData": {},
|
||||
"Properties": {
|
||||
"id": "20220503122338-jmr7c2k",
|
||||
"updated": "20220715092938"
|
||||
"updated": "20220715105038"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
|
@ -579,7 +579,15 @@
|
|||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "刪除該筆記本時,為保證跨筆記本資料文件引用正常工作,該筆記本下的資料文件會被批量複製到全局 assets 中"
|
||||
"Data": "刪除該筆記本時,為保證跨筆記本資料文件引用正常工作,該筆記本下的資料文件會被批量複製到全局 "
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "assets"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": " 中"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -607,7 +615,15 @@
|
|||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "不支持在數據歷史中查看筆記本級資料文件歷史"
|
||||
"Data": "不支持在"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "數據歷史"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "中查看筆記本級資料文件歷史"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -660,6 +676,34 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "20220715105038-bwu5wmg",
|
||||
"Type": "NodeListItem",
|
||||
"ListData": {
|
||||
"BulletChar": 42,
|
||||
"Marker": "Kg=="
|
||||
},
|
||||
"Properties": {
|
||||
"id": "20220715105038-bwu5wmg",
|
||||
"updated": "20220715105038"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"ID": "20220715105038-mmy9v15",
|
||||
"Type": "NodeParagraph",
|
||||
"Properties": {
|
||||
"id": "20220715105038-mmy9v15",
|
||||
"updated": "20220715105038"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "不支持重命名"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ func renameAsset(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
oldName := arg["oldName"].(string)
|
||||
oldPath := arg["oldPath"].(string)
|
||||
newName := arg["newName"].(string)
|
||||
model.RenameAsset(oldName, newName)
|
||||
model.RenameAsset(oldPath, newName)
|
||||
}
|
||||
|
||||
func getDocImageAssets(c *gin.Context) {
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ func RemoveUnusedAsset(p string) (ret string) {
|
|||
return
|
||||
}
|
||||
|
||||
func RenameAsset(oldName, newName string) {
|
||||
func RenameAsset(oldPath, newName string) {
|
||||
util.PushEndlessProgress(Conf.Language(110))
|
||||
defer util.PushClearProgress()
|
||||
|
||||
|
|
@ -458,25 +458,25 @@ func RenameAsset(oldName, newName string) {
|
|||
pages := pagedPaths(filepath.Join(util.DataDir, notebook.ID), 32)
|
||||
for _, paths := range pages {
|
||||
for _, treeAbsPath := range paths {
|
||||
data, err := filelock.NoLockFileRead(treeAbsPath)
|
||||
if nil != err {
|
||||
util.LogErrorf("get data [path=%s] failed: %s", treeAbsPath, err)
|
||||
data, readErr := filelock.NoLockFileRead(treeAbsPath)
|
||||
if nil != readErr {
|
||||
util.LogErrorf("get data [path=%s] failed: %s", treeAbsPath, readErr)
|
||||
return
|
||||
}
|
||||
|
||||
if !bytes.Contains(data, []byte(oldName)) {
|
||||
if !bytes.Contains(data, []byte(oldPath)) {
|
||||
return
|
||||
}
|
||||
|
||||
data = bytes.Replace(data, []byte(oldName), []byte(newName), -1)
|
||||
if err = filelock.NoLockFileWrite(treeAbsPath, data); nil != err {
|
||||
util.LogErrorf("write data [path=%s] failed: %s", treeAbsPath, err)
|
||||
data = bytes.Replace(data, []byte(oldPath), []byte(newName), -1)
|
||||
if writeErr := filelock.NoLockFileWrite(treeAbsPath, data); nil != writeErr {
|
||||
util.LogErrorf("write data [path=%s] failed: %s", treeAbsPath, writeErr)
|
||||
return
|
||||
}
|
||||
|
||||
tree, err := protyle.ParseJSONWithoutFix(luteEngine, data)
|
||||
if nil != err {
|
||||
util.LogErrorf("parse json to tree [%s] failed: %s", treeAbsPath, err)
|
||||
tree, parseErr := protyle.ParseJSONWithoutFix(luteEngine, data)
|
||||
if nil != parseErr {
|
||||
util.LogErrorf("parse json to tree [%s] failed: %s", treeAbsPath, parseErr)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue