Prechádzať zdrojové kódy

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

Vanessa 11 mesiacov pred
rodič
commit
9a1c02e7e4

+ 1 - 0
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)

+ 1 - 0
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)

+ 1 - 0
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)

+ 4 - 1
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) {

+ 2 - 3
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
 }