mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Add internal kernel API /api/setting/setEditorReadOnly https://github.com/siyuan-note/siyuan/issues/10268
This commit is contained in:
parent
bb4e8c9a8e
commit
0dd90ecef6
2 changed files with 22 additions and 0 deletions
|
|
@ -29,6 +29,27 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func setEditorReadOnly(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
readOnly := arg["readonly"].(bool)
|
||||
|
||||
oldReadOnly := model.Conf.Editor.ReadOnly
|
||||
model.Conf.Editor.ReadOnly = readOnly
|
||||
model.Conf.Save()
|
||||
|
||||
if oldReadOnly != model.Conf.Editor.ReadOnly {
|
||||
util.BroadcastByType("protyle", "readonly", 0, "", model.Conf.Editor.ReadOnly)
|
||||
util.BroadcastByType("main", "readonly", 0, "", model.Conf.Editor.ReadOnly)
|
||||
}
|
||||
}
|
||||
|
||||
func setConfSnippet(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue