Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-04-07 12:13:34 +08:00
commit c8765621ba
9 changed files with 31 additions and 29 deletions

View file

@ -1,5 +1,5 @@
{
"changelog": "Changelog",
"whatsNewInSiYuan": "What's New in SiYuan",
"returnDesktop": "Press back again to desktop",
"enterNew": "Enter to create",
"enterNewTip": "No documents found, Enter to create a new document.",

View file

@ -1,5 +1,5 @@
{
"changelog": "Registro de cambios",
"whatsNewInSiYuan": "Novedades en SiYuan",
"returnDesktop": "Presiona volver de nuevo al escritorio",
"enterNew": "Ingresar para crear",
"enterNewTip": "No se encontraron documentos, ingrese para crear un nuevo documento.",

View file

@ -1,5 +1,5 @@
{
"changelog": "Journal des modifications",
"whatsNewInSiYuan": "Quoi de neuf dans SiYuan",
"returnDesktop": "Appuyez à nouveau sur le bureau",
"enterNew": "Entrez pour créer",
"enterNewTip": "Aucun document trouvé, entrez pour créer un nouveau document.",

View file

@ -1,5 +1,5 @@
{
"changelog": "變更日誌",
"whatsNewInSiYuan": "思源筆記最新變化",
"returnDesktop": "再按一次返回桌面",
"enterNew": "回車創建",
"enterNewTip": "搜索結果為空,回車創建新文檔",

View file

@ -1,5 +1,5 @@
{
"changelog": "更新日志",
"whatsNewInSiYuan": "思源笔记最新变化",
"returnDesktop": "再按一次返回桌面",
"enterNew": "回车创建",
"enterNewTip": "搜索结果为空,回车创建新文档",

View file

@ -9,7 +9,7 @@ export const openChangelog = () => {
return;
}
const dialog = new Dialog({
title: `${window.siyuan.languages.changelog}`,
title: `${window.siyuan.languages.whatsNewInSiYuan}`,
width: isMobile() ? "90vw" : "768px",
content: `<div style="overflow:auto;height: ${isMobile() ? "80" : "70"}vh;" class="b3-dialog__content b3-typography b3-typography--default">${response.data.html}</div>`
});

View file

@ -177,11 +177,6 @@ func getLocalStorage(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
data, err := model.GetLocalStorage()
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
data := model.GetLocalStorage()
ret.Data = data
}

View file

@ -33,19 +33,26 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func renderOutline(node *ast.Node, luteEngine *lute.Lute) (ret string) {
if nil == node {
func renderOutline(heading *ast.Node, luteEngine *lute.Lute) (ret string) {
if nil == heading {
return ""
}
if ast.NodeDocument == node.Type {
return node.IALAttr("title")
if ast.NodeDocument == heading.Type {
return heading.IALAttr("title")
}
buf := bytes.Buffer{}
buf.Grow(4096)
ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus {
ast.Walk(heading, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering {
switch n.Type {
case ast.NodeHeading:
// Show heading block appearance style in the Outline Panel https://github.com/siyuan-note/siyuan/issues/7872
if style := n.IALAttr("style"); "" != style {
buf.WriteString("</span>")
}
}
return ast.WalkContinue
}
@ -57,6 +64,13 @@ func renderOutline(node *ast.Node, luteEngine *lute.Lute) (ret string) {
}
switch n.Type {
case ast.NodeHeading:
// Show heading block appearance style in the Outline Panel https://github.com/siyuan-note/siyuan/issues/7872
if style := n.IALAttr("style"); "" != style {
buf.WriteString("<span style=\"")
buf.WriteString(style)
buf.WriteString("\">")
}
case ast.NodeText, ast.NodeLinkText, ast.NodeCodeBlockCode, ast.NodeMathBlockContent:
tokens := html.EscapeHTML(n.Tokens)
tokens = bytes.ReplaceAll(tokens, []byte(" "), []byte("&nbsp;")) // 大纲面板条目中无法显示多个空格 https://github.com/siyuan-note/siyuan/issues/4370

View file

@ -293,11 +293,7 @@ func RemoveLocalStorageVals(keys []string) (err error) {
localStorageLock.Lock()
defer localStorageLock.Unlock()
localStorage, err := getLocalStorage()
if nil != err {
return
}
localStorage := getLocalStorage()
for _, key := range keys {
delete(localStorage, key)
}
@ -308,11 +304,7 @@ func SetLocalStorageVal(key string, val interface{}) (err error) {
localStorageLock.Lock()
defer localStorageLock.Unlock()
localStorage, err := getLocalStorage()
if nil != err {
return
}
localStorage := getLocalStorage()
localStorage[key] = val
return setLocalStorage(localStorage)
}
@ -323,7 +315,7 @@ func SetLocalStorage(val interface{}) (err error) {
return setLocalStorage(val)
}
func GetLocalStorage() (ret map[string]interface{}, err error) {
func GetLocalStorage() (ret map[string]interface{}) {
localStorageLock.Lock()
defer localStorageLock.Unlock()
return getLocalStorage()
@ -355,7 +347,8 @@ func setLocalStorage(val interface{}) (err error) {
return
}
func getLocalStorage() (ret map[string]interface{}, err error) {
func getLocalStorage() (ret map[string]interface{}) {
// When local.json is corrupted, clear the file to avoid being unable to enter the main interface https://github.com/siyuan-note/siyuan/issues/7911
ret = map[string]interface{}{}
lsPath := filepath.Join(util.DataDir, "storage/local.json")
if !gulu.File.IsExist(lsPath) {