🎨 /模板 搜索按名称自然升序排序 Fix https://github.com/siyuan-note/siyuan/issues/5916

This commit is contained in:
Liang Ding 2022-09-21 19:59:32 +08:00
parent a306fb4845
commit 7eafbf0171
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -23,6 +23,7 @@ import (
"io/fs"
"os"
"path/filepath"
"sort"
"strings"
"text/template"
"time"
@ -88,6 +89,7 @@ func SearchTemplate(keyword string) (ret []*Block) {
}
return nil
})
sort.Slice(ret, func(i, j int) bool { return util.PinYinCompare(filepath.Base(ret[i].Path), filepath.Base(ret[j].Path)) })
return
}