mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
01c3412aaa
5 changed files with 37 additions and 7 deletions
|
|
@ -1,14 +1,13 @@
|
|||
import {escapeAriaLabel, escapeGreat, escapeHtml} from "../../util/escape";
|
||||
import {Tab} from "../Tab";
|
||||
import {Model} from "../Model";
|
||||
import {getInstanceById, setPanelFocus} from "../util";
|
||||
import {setPanelFocus} from "../util";
|
||||
import {getDockByType} from "../tabUtil";
|
||||
import {Constants} from "../../constants";
|
||||
import {getDisplayName, pathPosix, setNoteBook} from "../../util/pathName";
|
||||
import {newFile} from "../../util/newFile";
|
||||
import {initFileMenu, initNavigationMenu, sortMenu} from "../../menus/navigation";
|
||||
import {MenuItem} from "../../menus/Menu";
|
||||
import {Editor} from "../../editor";
|
||||
import {showMessage} from "../../dialog/message";
|
||||
import {fetchPost, fetchSyncPost} from "../../util/fetch";
|
||||
import {openEmojiPanel, unicode2Emoji} from "../../emoji";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ import {
|
|||
hasClosestBlock,
|
||||
hasClosestByClassName,
|
||||
hasClosestByTag,
|
||||
hasTopClosestByClassName, isInAVBlock,
|
||||
hasTopClosestByClassName,
|
||||
isInAVBlock,
|
||||
isInEmbedBlock
|
||||
} from "../util/hasClosest";
|
||||
import {getIconByType} from "../../editor/getIcon";
|
||||
|
|
@ -60,7 +61,6 @@ import {processClonePHElement} from "../render/util";
|
|||
import {openFileById} from "../../editor/util";
|
||||
/// #endif
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
import {copyTextByType} from "../toolbar/util";
|
||||
import {clearSelect} from "../util/clearSelect";
|
||||
|
||||
export class Gutter {
|
||||
|
|
|
|||
|
|
@ -225,7 +225,24 @@ func getAttributeViewKeysByAvID(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
avID := arg["avID"].(string)
|
||||
ret.Data = model.GetAttributeViewKeysByAvID(avID)
|
||||
ret.Data = model.GetAttributeViewKeysByID(avID)
|
||||
}
|
||||
|
||||
func getAttributeViewKeysByID(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
avID := arg["avID"].(string)
|
||||
keyIDsArg := arg["keyIDs"].([]interface{})
|
||||
var keyIDs []string
|
||||
for _, v := range keyIDsArg {
|
||||
keyIDs = append(keyIDs, v.(string
|
||||
}
|
||||
ret.Data = model.GetAttributeViewKeysByID(avID, keyIDs...)
|
||||
}
|
||||
|
||||
func getMirrorDatabaseBlocks(c *gin.Context) {
|
||||
|
|
|
|||
|
|
@ -461,6 +461,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/av/setDatabaseBlockView", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setDatabaseBlockView)
|
||||
ginServer.Handle("POST", "/api/av/getMirrorDatabaseBlocks", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getMirrorDatabaseBlocks)
|
||||
ginServer.Handle("POST", "/api/av/getAttributeViewKeysByAvID", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getAttributeViewKeysByAvID)
|
||||
ginServer.Handle("POST", "/api/av/getAttributeViewKeysByID", model.CheckAuth, getAttributeViewKeysByID)
|
||||
ginServer.Handle("POST", "/api/av/duplicateAttributeViewBlock", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, duplicateAttributeViewBlock)
|
||||
ginServer.Handle("POST", "/api/av/appendAttributeViewDetachedBlocksWithValues", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, appendAttributeViewDetachedBlocksWithValues)
|
||||
ginServer.Handle("POST", "/api/av/getCurrentAttrViewImages", model.CheckAuth, getCurrentAttrViewImages)
|
||||
|
|
|
|||
|
|
@ -1116,6 +1116,7 @@ func AppendAttributeViewDetachedBlocksWithValues(avID string, blocksValues [][]*
|
|||
}
|
||||
}
|
||||
|
||||
regenAttrViewGroups(attrView)
|
||||
if err = av.SaveAttributeView(attrView); err != nil {
|
||||
logging.LogErrorf("save attribute view [%s] failed: %s", avID, err)
|
||||
return
|
||||
|
|
@ -1178,7 +1179,7 @@ func DuplicateDatabaseBlock(avID string) (newAvID, newBlockID string, err error)
|
|||
return
|
||||
}
|
||||
|
||||
func GetAttributeViewKeysByAvID(avID string) (ret []*av.Key) {
|
||||
func GetAttributeViewKeysByID(avID string, keyIDs ...string) (ret []*av.Key) {
|
||||
ret = []*av.Key{}
|
||||
|
||||
attrView, err := av.ParseAttributeView(avID)
|
||||
|
|
@ -1187,9 +1188,21 @@ func GetAttributeViewKeysByAvID(avID string) (ret []*av.Key) {
|
|||
return
|
||||
}
|
||||
|
||||
if 1 > len(keyIDs) {
|
||||
for _, keyValues := range attrView.KeyValues {
|
||||
key := keyValues.Key
|
||||
ret = append(ret, key)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
for _, keyValues := range attrView.KeyValues {
|
||||
key := keyValues.Key
|
||||
ret = append(ret, key)
|
||||
for _, keyID := range keyIDs {
|
||||
if key.ID == keyID {
|
||||
ret = append(ret, key)
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue