From 644257998c1ffc197169868b72d4a0468db8e0fb Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 5 Jul 2024 22:30:45 +0800 Subject: [PATCH 1/2] :memo: Update changelogs --- app/changelogs/v3.1.0/v3.1.0.md | 1 + app/changelogs/v3.1.0/v3.1.0_zh_CHT.md | 1 + app/changelogs/v3.1.0/v3.1.0_zh_CN.md | 1 + 3 files changed, 3 insertions(+) diff --git a/app/changelogs/v3.1.0/v3.1.0.md b/app/changelogs/v3.1.0/v3.1.0.md index daad732e4..212e89319 100644 --- a/app/changelogs/v3.1.0/v3.1.0.md +++ b/app/changelogs/v3.1.0/v3.1.0.md @@ -45,6 +45,7 @@ Below are the detailed changes in this version. * [No prompt when pressing the auxiliary key in the shortcut key setting](https://github.com/siyuan-note/siyuan/issues/11720) * [Improve embed blocks exporting](https://github.com/siyuan-note/siyuan/issues/11725) * [Improve use of `↓` in doc titles](https://github.com/siyuan-note/siyuan/issues/11729) +* [Disable some menu items in read-only mode](https://github.com/siyuan-note/siyuan/pull/11733) * [Improve inline elements pasting](https://github.com/siyuan-note/siyuan/issues/11740) * [Improve HTML formula clipping](https://github.com/siyuan-note/siyuan/issues/11743) * [Custom Emoji folders no longer require manual refresh when they change](https://github.com/siyuan-note/siyuan/issues/11749) diff --git a/app/changelogs/v3.1.0/v3.1.0_zh_CHT.md b/app/changelogs/v3.1.0/v3.1.0_zh_CHT.md index 29b4af5dd..d3caadf2d 100644 --- a/app/changelogs/v3.1.0/v3.1.0_zh_CHT.md +++ b/app/changelogs/v3.1.0/v3.1.0_zh_CHT.md @@ -45,6 +45,7 @@ * [在快速鍵設定中按輔助鍵時無提示](https://github.com/siyuan-note/siyuan/issues/11720) * [改進嵌入塊導出](https://github.com/siyuan-note/siyuan/issues/11725) * [改進文件標題中 `↓` 的使用](https://github.com/siyuan-note/siyuan/issues/11729) +* [唯讀模式下禁用一些選單項目](https://github.com/siyuan-note/siyuan/pull/11733) * [改進行級元素貼上](https://github.com/siyuan-note/siyuan/issues/11740) * [改進 HTML 公式剪藏](https://github.com/siyuan-note/siyuan/issues/11743) * [自訂表情資料夾更改時不再需要手動刷新](https://github.com/siyuan-note/siyuan/issues/11749) diff --git a/app/changelogs/v3.1.0/v3.1.0_zh_CN.md b/app/changelogs/v3.1.0/v3.1.0_zh_CN.md index a5794cf9d..76197c6e8 100644 --- a/app/changelogs/v3.1.0/v3.1.0_zh_CN.md +++ b/app/changelogs/v3.1.0/v3.1.0_zh_CN.md @@ -45,6 +45,7 @@ * [在快捷键设置中按辅助键时无提示](https://github.com/siyuan-note/siyuan/issues/11720) * [改进嵌入块导出](https://github.com/siyuan-note/siyuan/issues/11725) * [改进文档标题中 `↓` 的使用](https://github.com/siyuan-note/siyuan/issues/11729) +* [只读模式下禁用一些菜单项](https://github.com/siyuan-note/siyuan/pull/11733) * [改进行级元素粘贴](https://github.com/siyuan-note/siyuan/issues/11740) * [改进 HTML 公式剪藏](https://github.com/siyuan-note/siyuan/issues/11743) * [自定义表情文件夹更改时不再需要手动刷新](https://github.com/siyuan-note/siyuan/issues/11749) From 427293f3e662cd04c1b6400fc022c99707fb9356 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 6 Jul 2024 09:51:54 +0800 Subject: [PATCH 2/2] :art: Improve asset renaming https://github.com/siyuan-note/siyuan/issues/11889 --- kernel/api/asset.go | 5 ++++- kernel/model/assets.go | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/api/asset.go b/kernel/api/asset.go index d4c079019..76647e366 100644 --- a/kernel/api/asset.go +++ b/kernel/api/asset.go @@ -159,13 +159,16 @@ func renameAsset(c *gin.Context) { oldPath := arg["oldPath"].(string) newName := arg["newName"].(string) - err := model.RenameAsset(oldPath, newName) + newPath, err := model.RenameAsset(oldPath, newName) if nil != err { ret.Code = -1 ret.Msg = err.Error() ret.Data = map[string]interface{}{"closeTimeout": 5000} return } + ret.Data = map[string]interface{}{ + "newPath": newPath, + } } func getDocImageAssets(c *gin.Context) { diff --git a/kernel/model/assets.go b/kernel/model/assets.go index 19a8cab04..2300523c1 100644 --- a/kernel/model/assets.go +++ b/kernel/model/assets.go @@ -762,7 +762,7 @@ func RemoveUnusedAsset(p string) (ret string) { return } -func RenameAsset(oldPath, newName string) (err error) { +func RenameAsset(oldPath, newName string) (newPath string, err error) { util.PushEndlessProgress(Conf.Language(110)) defer util.PushClearProgress() @@ -781,7 +781,7 @@ func RenameAsset(oldPath, newName string) (err error) { } newName = util.AssetName(newName + filepath.Ext(oldPath)) - newPath := "assets/" + newName + newPath = "assets/" + newName if err = filelock.Copy(filepath.Join(util.DataDir, oldPath), filepath.Join(util.DataDir, newPath)); nil != err { logging.LogErrorf("copy asset [%s] failed: %s", oldPath, err) return @@ -842,7 +842,6 @@ func RenameAsset(oldPath, newName string) (err error) { } IncSync() - util.ReloadUI() return }