mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 06:30:14 +01:00
🎨 Database index content/markdown values no longer contain zero-width spaces https://github.com/siyuan-note/siyuan/issues/15204
This commit is contained in:
parent
2673ae343f
commit
286223db84
4 changed files with 12 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ import (
|
|||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/88250/lute/ast"
|
||||
"github.com/88250/lute/editor"
|
||||
"github.com/88250/lute/lex"
|
||||
"github.com/88250/lute/parse"
|
||||
"github.com/araddon/dateparse"
|
||||
|
|
@ -69,6 +70,7 @@ func SetBlockReminder(id string, timed string) (err error) {
|
|||
}
|
||||
content := sql.NodeStaticContent(node, nil, false, false, false)
|
||||
content = gulu.Str.SubStr(content, 128)
|
||||
content = strings.ReplaceAll(content, editor.Zwsp, "")
|
||||
err = SetCloudBlockReminder(id, content, timedMills)
|
||||
if err != nil {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import (
|
|||
"github.com/88250/gulu"
|
||||
"github.com/88250/lute"
|
||||
"github.com/88250/lute/ast"
|
||||
"github.com/88250/lute/editor"
|
||||
"github.com/88250/lute/parse"
|
||||
"github.com/ClarkThan/ahocorasick"
|
||||
"github.com/dgraph-io/ristretto"
|
||||
|
|
@ -54,6 +55,7 @@ func getBlockVirtualRefKeywords(root *ast.Node) (ret []string) {
|
|||
}
|
||||
|
||||
content := sql.NodeStaticContent(n, nil, false, false, false)
|
||||
content = strings.ReplaceAll(content, editor.Zwsp, "")
|
||||
buf.WriteString(content)
|
||||
return ast.WalkContinue
|
||||
})
|
||||
|
|
|
|||
|
|
@ -23,6 +23,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/parse"
|
||||
"github.com/siyuan-note/logging"
|
||||
|
|
@ -117,6 +118,7 @@ func indexNode(tx *sql.Tx, id string) (err error) {
|
|||
}
|
||||
|
||||
content := NodeStaticContent(node, nil, true, indexAssetPath, true)
|
||||
content = strings.ReplaceAll(content, editor.Zwsp, "")
|
||||
stmt := "UPDATE blocks SET content = ? WHERE id = ?"
|
||||
if err = execStmtTx(tx, stmt, content, id); err != nil {
|
||||
tx.Rollback()
|
||||
|
|
|
|||
|
|
@ -36,6 +36,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/parse"
|
||||
"github.com/mattn/go-sqlite3"
|
||||
|
|
@ -867,6 +868,11 @@ func buildBlockFromNode(n *ast.Node, tree *parse.Tree) (block *Block, attributes
|
|||
length = utf8.RuneCountInString(content)
|
||||
}
|
||||
|
||||
// 剔除零宽空格 Database index content/markdown values no longer contain zero-width spaces https://github.com/siyuan-note/siyuan/issues/15204
|
||||
fcontent = strings.ReplaceAll(fcontent, editor.Zwsp, "")
|
||||
content = strings.ReplaceAll(content, editor.Zwsp, "")
|
||||
markdown = strings.ReplaceAll(markdown, editor.Zwsp, "")
|
||||
|
||||
block = &Block{
|
||||
ID: n.ID,
|
||||
ParentID: parentID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue