🎨 Fixed mirroring database display view https://github.com/siyuan-note/siyuan/issues/15279

This commit is contained in:
Daniel 2025-07-18 10:01:24 +08:00
parent 09f5569663
commit 7a64af1e88
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -1283,6 +1283,26 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
upsertAvBlockRel(updatedNode)
if ast.NodeAttributeView == updatedNode.Type {
// 设置视图 https://github.com/siyuan-note/siyuan/issues/15279
attrView, parseErr := av.ParseAttributeView(updatedNode.AttributeViewID)
if nil == parseErr {
v := attrView.GetView(attrView.ViewID)
if nil != v {
updatedNode.AttributeViewType = string(v.LayoutType)
attrs := parse.IAL2Map(updatedNode.KramdownIAL)
if "" == attrs[av.NodeAttrView] {
attrs[av.NodeAttrView] = v.ID
err = setNodeAttrs(updatedNode, tree, attrs)
if err != nil {
logging.LogWarnf("set node [%s] attrs failed: %s", operation.BlockID, err)
return &TxErr{code: TxErrCodeBlockNotFound, id: id}
}
}
}
}
}
checkUpsertInUserGuide(tree)
return
}