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
c222e0d6f7
7 changed files with 56 additions and 10 deletions
|
|
@ -29,6 +29,7 @@ type LayoutGallery struct {
|
|||
CardAspectRatio CardAspectRatio `json:"cardAspectRatio"` // 卡片宽高比
|
||||
CardSize CardSize `json:"cardSize"` // 卡片大小,0:小卡片,1:中卡片,2:大卡片
|
||||
FitImage bool `json:"fitImage"` // 是否适应封面图片大小
|
||||
DisplayFieldName bool `json:"displayFieldName"` // 是否显示字段名称
|
||||
|
||||
CardFields []*ViewGalleryCardField `json:"fields"` // 卡片字段
|
||||
|
||||
|
|
@ -94,6 +95,7 @@ type Gallery struct {
|
|||
CardAspectRatio CardAspectRatio `json:"cardAspectRatio"` // 卡片宽高比
|
||||
CardSize CardSize `json:"cardSize"` // 卡片大小
|
||||
FitImage bool `json:"fitImage"` // 是否适应封面图片大小
|
||||
DisplayFieldName bool `json:"displayFieldName"` // 是否显示字段名称
|
||||
Fields []*GalleryField `json:"fields"` // 卡片字段
|
||||
Cards []*GalleryCard `json:"cards"` // 卡片
|
||||
CardCount int `json:"cardCount"` // 总卡片数
|
||||
|
|
|
|||
|
|
@ -514,6 +514,36 @@ func setAttrViewFitImage(operation *Operation) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func (tx *Transaction) doSetAttrViewDisplayFieldName(operation *Operation) (ret *TxErr) {
|
||||
err := setAttrViewDisplayFieldName(operation)
|
||||
if err != nil {
|
||||
return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func setAttrViewDisplayFieldName(operation *Operation) (err error) {
|
||||
attrView, err := av.ParseAttributeView(operation.AvID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
view, err := getAttrViewViewByBlockID(attrView, operation.BlockID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
switch view.LayoutType {
|
||||
case av.LayoutTypeTable:
|
||||
return
|
||||
case av.LayoutTypeGallery:
|
||||
view.Gallery.DisplayFieldName = operation.Data.(bool)
|
||||
}
|
||||
|
||||
err = av.SaveAttributeView(attrView)
|
||||
return
|
||||
}
|
||||
|
||||
func (tx *Transaction) doSetAttrViewCardSize(operation *Operation) (ret *TxErr) {
|
||||
err := setAttrViewCardSize(operation)
|
||||
if err != nil {
|
||||
|
|
@ -2503,6 +2533,7 @@ func (tx *Transaction) doDuplicateAttrViewView(operation *Operation) (ret *TxErr
|
|||
view.Gallery.CoverFromAssetKeyID = masterView.Gallery.CoverFromAssetKeyID
|
||||
view.Gallery.CardSize = masterView.Gallery.CardSize
|
||||
view.Gallery.FitImage = masterView.Gallery.FitImage
|
||||
view.Gallery.DisplayFieldName = masterView.Gallery.DisplayFieldName
|
||||
view.Gallery.ShowIcon = masterView.Gallery.ShowIcon
|
||||
view.Gallery.WrapField = masterView.Gallery.WrapField
|
||||
}
|
||||
|
|
@ -4651,8 +4682,12 @@ func regenAttrViewViewGroups(attrView *av.AttributeView, keyID string) {
|
|||
|
||||
for _, g := range view.Groups {
|
||||
if view.Group.HideEmpty {
|
||||
if 2 != g.GroupHidden && 1 > len(g.GroupItemIDs) {
|
||||
g.GroupHidden = 1
|
||||
if 1 > len(g.GroupItemIDs) {
|
||||
if 0 == g.GroupHidden {
|
||||
g.GroupHidden = 1
|
||||
}
|
||||
} else {
|
||||
g.GroupHidden = 0
|
||||
}
|
||||
} else {
|
||||
if 2 != g.GroupHidden {
|
||||
|
|
|
|||
|
|
@ -677,6 +677,11 @@ func FullReindex() {
|
|||
}
|
||||
|
||||
func fullReindex() {
|
||||
pushSQLInsertBlocksFTSMsg = true
|
||||
defer func() {
|
||||
pushSQLInsertBlocksFTSMsg = false
|
||||
}()
|
||||
|
||||
util.PushEndlessProgress(Conf.language(35))
|
||||
defer util.PushClearProgress()
|
||||
|
||||
|
|
|
|||
|
|
@ -359,6 +359,8 @@ func init() {
|
|||
subscribeSQLEvents()
|
||||
}
|
||||
|
||||
var pushSQLInsertBlocksFTSMsg bool
|
||||
|
||||
func subscribeSQLEvents() {
|
||||
// 使用下面的 EvtSQLInsertBlocksFTS 就可以了
|
||||
//eventbus.Subscribe(eventbus.EvtSQLInsertBlocks, func(context map[string]interface{}, current, total, blockCount int, hash string) {
|
||||
|
|
@ -368,6 +370,12 @@ func subscribeSQLEvents() {
|
|||
// util.ContextPushMsg(context, msg)
|
||||
//})
|
||||
eventbus.Subscribe(eventbus.EvtSQLInsertBlocksFTS, func(context map[string]interface{}, blockCount int, hash string) {
|
||||
if !pushSQLInsertBlocksFTSMsg {
|
||||
// 如果不是全量重建索引,则不显示进度信息
|
||||
// Improve status bar index creation information prompt https://github.com/siyuan-note/siyuan/issues/15390
|
||||
return
|
||||
}
|
||||
|
||||
current := context["current"].(int)
|
||||
total := context["total"]
|
||||
msg := fmt.Sprintf(Conf.Language(90), current, total, blockCount, hash)
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ import (
|
|||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/conf"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
||||
"github.com/siyuan-note/siyuan/kernel/task"
|
||||
"github.com/siyuan-note/siyuan/kernel/treenode"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
|
|
@ -772,13 +771,7 @@ func checkoutRepo(id string) {
|
|||
return
|
||||
}
|
||||
|
||||
task.AppendTask(task.DatabaseIndexFull, fullReindex)
|
||||
task.AppendTask(task.DatabaseIndexRef, IndexRefs)
|
||||
go func() {
|
||||
sql.FlushQueue()
|
||||
ResetVirtualBlockRefCache()
|
||||
}()
|
||||
task.AppendTask(task.ReloadUI, util.ReloadUIResetScroll)
|
||||
FullReindex()
|
||||
|
||||
if syncEnabled {
|
||||
task.AppendAsyncTaskWithDelay(task.PushMsg, 7*time.Second, util.PushMsg, Conf.Language(134), 0)
|
||||
|
|
|
|||
|
|
@ -289,6 +289,8 @@ func performTx(tx *Transaction) (ret *TxErr) {
|
|||
ret = tx.doSetAttrViewCardSize(op)
|
||||
case "setAttrViewFitImage":
|
||||
ret = tx.doSetAttrViewFitImage(op)
|
||||
case "setDisplayFieldName":
|
||||
ret = tx.doSetAttrViewDisplayFieldName(op)
|
||||
case "setAttrViewShowIcon":
|
||||
ret = tx.doSetAttrViewShowIcon(op)
|
||||
case "setAttrViewWrapField":
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ func RenderAttributeViewGallery(attrView *av.AttributeView, view *av.View, query
|
|||
CardAspectRatio: view.Gallery.CardAspectRatio,
|
||||
CardSize: view.Gallery.CardSize,
|
||||
FitImage: view.Gallery.FitImage,
|
||||
DisplayFieldName: view.Gallery.DisplayFieldName,
|
||||
Fields: []*av.GalleryField{},
|
||||
Cards: []*av.GalleryCard{},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue