🐛 Some emoji exceptions in the document title https://github.com/siyuan-note/siyuan/issues/11480
This commit is contained in:
parent
ffddff7436
commit
47f884f2bb
1 changed files with 10 additions and 2 deletions
|
@ -1666,7 +1666,7 @@ func RenameDoc(boxID, p, title string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
title = gulu.Str.RemoveInvisible(title)
|
||||
title = removeInvisibleCharsInTitle(title)
|
||||
if 512 < utf8.RuneCountInString(title) {
|
||||
// 限制笔记本名和文档名最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299
|
||||
return errors.New(Conf.Language(106))
|
||||
|
@ -1706,7 +1706,7 @@ func RenameDoc(boxID, p, title string) (err error) {
|
|||
}
|
||||
|
||||
func createDoc(boxID, p, title, dom string) (tree *parse.Tree, err error) {
|
||||
title = gulu.Str.RemoveInvisible(title)
|
||||
title = removeInvisibleCharsInTitle(title)
|
||||
if 512 < utf8.RuneCountInString(title) {
|
||||
// 限制笔记本名和文档名最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299
|
||||
err = errors.New(Conf.Language(106))
|
||||
|
@ -1819,6 +1819,14 @@ func createDoc(boxID, p, title, dom string) (tree *parse.Tree, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func removeInvisibleCharsInTitle(title string) string {
|
||||
// 不要踢掉 零宽连字符,否则有的 Emoji 会变形 https://github.com/siyuan-note/siyuan/issues/11480
|
||||
title = strings.ReplaceAll(title, string(gulu.ZWJ), "__@ZWJ@__")
|
||||
title = gulu.Str.RemoveInvisible(title)
|
||||
title = strings.ReplaceAll(title, "__@ZWJ@__", string(gulu.ZWJ))
|
||||
return title
|
||||
}
|
||||
|
||||
func moveSorts(rootID, fromBox, toBox string) {
|
||||
root := treenode.GetBlockTree(rootID)
|
||||
if nil == root {
|
||||
|
|
Loading…
Add table
Reference in a new issue