This commit is contained in:
Daniel 2024-12-05 10:11:07 +08:00
parent 4b3f95e4bf
commit c1fd34f57b
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
6 changed files with 32 additions and 14 deletions

View file

@ -1061,8 +1061,14 @@ func getDoc(c *gin.Context) {
if nil != isBacklinkArg {
isBacklink = isBacklinkArg.(bool)
}
highlightArg := arg["highlight"]
highlight := true
if nil != highlightArg {
highlight = highlightArg.(bool)
}
blockCount, content, parentID, parent2ID, rootID, typ, eof, scroll, boxID, docPath, isBacklinkExpand, err := model.GetDoc(startID, endID, id, index, query, queryTypes, queryMethod, mode, size, isBacklink)
blockCount, content, parentID, parent2ID, rootID, typ, eof, scroll, boxID, docPath, isBacklinkExpand, err :=
model.GetDoc(startID, endID, id, index, query, queryTypes, queryMethod, mode, size, isBacklink, highlight)
if model.ErrBlockNotFound == err {
ret.Code = 3
return

View file

@ -145,7 +145,11 @@ func getDocHistoryContent(c *gin.Context) {
if nil != k {
keyword = k.(string)
}
id, rootID, content, isLargeDoc, err := model.GetDocHistoryContent(historyPath, keyword)
highlight := true
if val, ok := arg["highlight"]; ok {
highlight = val.(bool)
}
id, rootID, content, isLargeDoc, err := model.GetDocHistoryContent(historyPath, keyword, highlight)
if err != nil {
ret.Code = -1
ret.Msg = err.Error()

View file

@ -56,7 +56,11 @@ func getBackmentionDoc(c *gin.Context) {
if val, ok := arg["containChildren"]; ok {
containChildren = val.(bool)
}
backlinks := model.GetBackmentionDoc(defID, refTreeID, keyword, containChildren)
highlight := true
if val, ok := arg["highlight"]; ok {
highlight = val.(bool)
}
backlinks := model.GetBackmentionDoc(defID, refTreeID, keyword, containChildren, highlight)
ret.Data = map[string]interface{}{
"backmentions": backlinks,
}
@ -78,7 +82,11 @@ func getBacklinkDoc(c *gin.Context) {
if val, ok := arg["containChildren"]; ok {
containChildren = val.(bool)
}
backlinks := model.GetBacklinkDoc(defID, refTreeID, keyword, containChildren)
highlight := true
if val, ok := arg["highlight"]; ok {
highlight = val.(bool)
}
backlinks := model.GetBacklinkDoc(defID, refTreeID, keyword, containChildren, highlight)
ret.Data = map[string]interface{}{
"backlinks": backlinks,
}