🎨 Title localization when creating a document https://github.com/siyuan-note/siyuan/issues/10719

This commit is contained in:
Daniel 2024-03-24 22:15:19 +08:00
parent f5043a8c46
commit 2a8809bc7e
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
25 changed files with 72 additions and 61 deletions

View file

@ -40,6 +40,9 @@ func CreateBox(name string) (id string, err error) {
err = errors.New(Conf.Language(106))
return
}
if "" == name {
name = Conf.language(105)
}
WaitForWritingFiles()
@ -67,6 +70,16 @@ func RenameBox(boxID, name string) (err error) {
return errors.New(Conf.Language(0))
}
if 512 < utf8.RuneCountInString(name) {
// 限制笔记本名和文档名最大长度为 `512`
err = errors.New(Conf.Language(106))
return
}
if "" == name {
name = Conf.language(105)
}
boxConf := box.GetConf()
boxConf.Name = name
box.Name = name