mirror of
https://github.com/mindoc-org/mindoc.git
synced 2026-02-27 17:03:57 +08:00
feat:1、实现文档自动保存
2、实现记住上次打开的文档,当文档编辑时会自动定位到上次打开的文档。
This commit is contained in:
@@ -144,6 +144,7 @@ func (c *BookController) SaveBook() {
|
||||
isDownload := strings.TrimSpace(c.GetString("is_download")) == "on"
|
||||
enableShare := strings.TrimSpace(c.GetString("enable_share")) == "on"
|
||||
isUseFirstDocument := strings.TrimSpace(c.GetString("is_use_first_document")) == "on"
|
||||
autoSave := strings.TrimSpace(c.GetString("auto_save")) == "on"
|
||||
|
||||
if strings.Count(description, "") > 500 {
|
||||
c.JsonResult(6004, "项目描述不能大于500字")
|
||||
@@ -170,6 +171,7 @@ func (c *BookController) SaveBook() {
|
||||
book.HistoryCount = historyCount
|
||||
book.IsDownload = 0
|
||||
|
||||
|
||||
if autoRelease {
|
||||
book.AutoRelease = 1
|
||||
} else {
|
||||
@@ -190,6 +192,11 @@ func (c *BookController) SaveBook() {
|
||||
} else {
|
||||
book.IsUseFirstDocument = 0
|
||||
}
|
||||
if autoSave {
|
||||
book.AutoSave = 1
|
||||
}else{
|
||||
book.AutoSave = 0
|
||||
}
|
||||
if err := book.Update(); err != nil {
|
||||
c.JsonResult(6006, "保存失败")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user