Browse Source

:art: 编辑器启用只读模式时启动后提示用户 Fix https://github.com/siyuan-note/siyuan/issues/7700

Liang Ding 2 years ago
parent
commit
c9ad6dd943

+ 2 - 1
app/appearance/langs/en_US.json

@@ -1120,6 +1120,7 @@
     "193": "Please refer to the [Artificial Intelligence] chapter of the User Guide for configuration",
     "194": "There are restrictions on the Nutstore interface, please use other WebDAV services",
     "195": "The system time is incorrect, please calibrate the system time and try again",
-    "196": "Do not set the workspace under the path of a third-party sync disk, otherwise the data will be damaged (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)"
+    "196": "Do not set the workspace under the path of a third-party sync disk, otherwise the data will be damaged (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)",
+    "197": "Currently the editor is in read-only mode. If you need to edit content, please switch to edit mode"
   }
 }

+ 2 - 1
app/appearance/langs/es_ES.json

@@ -1120,6 +1120,7 @@
     "193": "Consulte el capítulo [Inteligencia artificial] de la guía del usuario para la configuración",
     "194": "Existen restricciones en la interfaz de Nutstore, utilice otros servicios WebDAV",
     "195": "La hora del sistema es incorrecta, calibre la hora del sistema y vuelva a intentarlo",
-    "196": "No configure el espacio de trabajo bajo la ruta de un disco de sincronización de terceros, de lo contrario, los datos se dañarán (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)"
+    "196": "No configure el espacio de trabajo bajo la ruta de un disco de sincronización de terceros, de lo contrario, los datos se dañarán (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)",
+    "197": "Actualmente, el editor se encuentra en modo de solo lectura. Si necesita editar contenido, cambie al modo de edición"
   }
 }

+ 2 - 1
app/appearance/langs/fr_FR.json

@@ -1120,6 +1120,7 @@
     "193": "Veuillez vous référer au chapitre [Intelligence Artificielle] du guide de l'utilisateur pour la configuration",
     "194": "Il existe des restrictions sur l'interface Nutstore, veuillez utiliser d'autres services WebDAV",
     "195": "L'heure du système est incorrecte, veuillez calibrer l'heure du système et réessayer",
-    "196": "Ne définissez pas l'espace de travail sous le chemin d'un disque de synchronisation tiers, sinon les données seront endommagées (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)"
+    "196": "Ne définissez pas l'espace de travail sous le chemin d'un disque de synchronisation tiers, sinon les données seront endommagées (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)",
+    "197": "Actuellement, l'éditeur est en mode lecture seule. Si vous devez modifier le contenu, veuillez passer en mode édition"
   }
 }

+ 2 - 1
app/appearance/langs/zh_CHT.json

@@ -1120,6 +1120,7 @@
     "193": "請先參考用戶指南 [人工智能] 章節進行配置",
     "194": "堅果雲接口存在限制,請使用其他 WebDAV 服務",
     "195": "系統時間不正確,請校準系統時間後再試",
-    "196": "請勿將工作空間設置在第三方同步盤路徑下,否則數據會被損壞(iCloud/OneDrive/Dropbox/Google Drive/堅果雲/百度網盤/騰訊微雲等)"
+    "196": "請勿將工作空間設置在第三方同步盤路徑下,否則數據會被損壞(iCloud/OneDrive/Dropbox/Google Drive/堅果雲/百度網盤/騰訊微雲等)",
+    "197": "目前編輯器正處於只讀模式狀態,如果需要編輯內容,請切換到編輯模式"
   }
 }

+ 2 - 1
app/appearance/langs/zh_CN.json

@@ -1120,6 +1120,7 @@
     "193": "请先参考用户指南 [人工智能] 章节进行配置",
     "194": "坚果云接口存在限制,请使用其他 WebDAV 服务",
     "195": "系统时间不正确,请校准系统时间后再试",
-    "196": "请勿将工作空间设置在第三方同步盘路径下,否则数据会被损坏(iCloud/OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等)"
+    "196": "请勿将工作空间设置在第三方同步盘路径下,否则数据会被损坏(iCloud/OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等)",
+    "197": "目前编辑器正处于只读模式状态,如果需要编辑内容,请切换到编辑模式"
   }
 }

+ 10 - 0
kernel/api/system.go

@@ -164,6 +164,16 @@ func getConf(c *gin.Context) {
 
 	if start {
 		start = false
+
+		if model.Conf.Editor.ReadOnly {
+			// 编辑器启用只读模式时启动后提示用户 https://github.com/siyuan-note/siyuan/issues/7700
+			go func() {
+				time.Sleep(time.Second * 5)
+				if model.Conf.Editor.ReadOnly {
+					util.PushMsg(model.Conf.Language(197), 7000)
+				}
+			}()
+		}
 	}
 }