mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-14 12:48:51 +01:00
🎨 行级元素支持嵌套和交叉 https://github.com/siyuan-note/siyuan/issues/2911
This commit is contained in:
parent
3fccbf0889
commit
f0a6c2be8a
6 changed files with 21 additions and 19 deletions
|
|
@ -32,6 +32,7 @@ import (
|
|||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/88250/lute/ast"
|
||||
"github.com/88250/lute/editor"
|
||||
"github.com/88250/lute/html"
|
||||
"github.com/88250/lute/lex"
|
||||
"github.com/88250/lute/parse"
|
||||
|
|
@ -1363,7 +1364,7 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros bool) (ret *parse.T
|
|||
n.Unlink()
|
||||
}
|
||||
for _, emptyParagraph := range emptyParagraphs {
|
||||
emptyParagraph.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(parse.Zwj)})
|
||||
emptyParagraph.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(editor.Zwj)})
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ import (
|
|||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/88250/lute/ast"
|
||||
"github.com/88250/lute/editor"
|
||||
"github.com/88250/lute/parse"
|
||||
util2 "github.com/88250/lute/util"
|
||||
"github.com/emirpasic/gods/sets/hashset"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/logging"
|
||||
|
|
@ -423,7 +423,7 @@ func (tx *Transaction) doPrependInsert(operation *Operation) (ret *TxErr) {
|
|||
return &TxErr{code: TxErrCodeBlockNotFound, id: block.ID}
|
||||
}
|
||||
|
||||
data := strings.ReplaceAll(operation.Data.(string), util2.FrontEndCaret, "")
|
||||
data := strings.ReplaceAll(operation.Data.(string), editor.FrontEndCaret, "")
|
||||
luteEngine := NewLute()
|
||||
subTree := luteEngine.BlockDOM2Tree(data)
|
||||
insertedNode := subTree.Root.FirstChild
|
||||
|
|
@ -511,7 +511,7 @@ func (tx *Transaction) doAppendInsert(operation *Operation) (ret *TxErr) {
|
|||
return &TxErr{code: TxErrCodeBlockNotFound, id: block.ID}
|
||||
}
|
||||
|
||||
data := strings.ReplaceAll(operation.Data.(string), util2.FrontEndCaret, "")
|
||||
data := strings.ReplaceAll(operation.Data.(string), editor.FrontEndCaret, "")
|
||||
luteEngine := NewLute()
|
||||
subTree := luteEngine.BlockDOM2Tree(data)
|
||||
insertedNode := subTree.Root.FirstChild
|
||||
|
|
@ -720,7 +720,7 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
|
|||
return &TxErr{code: TxErrCodeBlockNotFound, id: block.ID}
|
||||
}
|
||||
|
||||
data := strings.ReplaceAll(operation.Data.(string), util2.FrontEndCaret, "")
|
||||
data := strings.ReplaceAll(operation.Data.(string), editor.FrontEndCaret, "")
|
||||
luteEngine := NewLute()
|
||||
subTree := luteEngine.BlockDOM2Tree(data)
|
||||
|
||||
|
|
@ -853,7 +853,7 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
|
|||
return &TxErr{code: TxErrCodeBlockNotFound, id: id}
|
||||
}
|
||||
|
||||
data := strings.ReplaceAll(operation.Data.(string), util2.FrontEndCaret, "")
|
||||
data := strings.ReplaceAll(operation.Data.(string), editor.FrontEndCaret, "")
|
||||
if "" == data {
|
||||
logging.LogErrorf("update data is nil")
|
||||
return &TxErr{code: TxErrCodeBlockNotFound, id: id}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue