diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index a8953675d..01090c73d 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -810,7 +810,7 @@ "33": "Insufficient permissions to read and write files or access to the network, please check the permissions of the workspace folder and the settings of the anti-virus software/firewall. If you have run SiYuan as an administrator before, please consider switching to a new workspace directory, and do not run it as an administrator in the future (the current workspace directory may no longer be accessible by ordinary users)", "34": "This operation is not supported in read-only mode", "35": "Rebuilding index, please wait...", - "36": "TODO", + "36": "There is too much content in the historical document, in order not to affect performance, it has been switched to plain text display", "37": "Do not include spaces and special symbols in the name of the cloud sync directory", "38": "The number of mentioned keywords [%d] is too many, currently only supports up to [512] keywords", "39": "Deleting index %s", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 143805649..9c77cce42 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -810,7 +810,7 @@ "33": "Permisos insuficientes para leer y escribir archivos o acceso a la red, por favor comprueba los permisos de la carpeta del espacio de trabajo y la configuración del software antivirus/firewall. Si has ejecutado SiYuan como administrador antes, por favor considera cambiar a un nuevo directorio de espacio de trabajo, y no lo ejecutes como administrador en el futuro (el directorio de espacio de trabajo actual puede que ya no sea accesible por los usuarios ordinarios)", "34": "Esta operación no es compatible con el modo de sólo lectura", "35": "Reconstruyendo el índice, por favor espere...", - "36": "TODO", + "36": "Hay demasiado contenido en el documento historico, para no afectar el rendimiento, se ha cambiado a visualizacion de texto sin formato", "37": "No incluyas espacios ni símbolos especiales en el nombre del directorio de sincronización con la nube", "38": "El número de palabras clave mencionadas [%d] son demasiados, actualmente solo admite hasta [512] palabras clave", "39": "Eliminando índice %s", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index bf9aee973..307e8b169 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -810,7 +810,7 @@ "33": "Autorisations insuffisantes pour lire et écrire des fichiers ou accéder au réseau, veuillez vérifier les autorisations du dossier de l'espace de travail et les paramètres du logiciel anti-virus/pare-feu. Si vous avez déjà exécuté SiYuan en tant qu'administrateur, envisagez de passer à un nouveau répertoire d'espace de travail et ne l'exécutez plus en tant qu'administrateur à l'avenir (le répertoire d'espace de travail actuel peut ne plus être accessible aux utilisateurs ordinaires) ", "34": "Cette opération n'est pas supportée en mode lecture seule.", "35": "Recréation de l'index, veuillez patienter...", - "36": "TODO", + "36": "Il y a trop de contenu dans le document historique, afin de ne pas affecter les performances, il a été basculé sur l'affichage en texte brut", "37": "N'incluez pas d'espaces et de symboles spéciaux dans le nom du répertoire de synchronisation cloud", "38": "Le nombre de mots-clés mentionnés [%d] est trop élevé, ne prend actuellement en charge que jusqu'à [512] mots-clés", "39": "Suppression de l'index %s", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 70edd7677..715f38882 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -810,7 +810,7 @@ "33": "讀寫檔或存取網路權限不足,請檢查工作空間資料夾權限和防毒軟體/防火牆的設置。如果你曾經使用管理員身份運行過思源,請考慮切換到新的工作空間目錄,後續請勿使用管理員身份運行(當前的工作空間目錄可能已經無法使用普通用戶存取)", "34": "唯讀模式下不支援該操作", "35": "正在重建索引,請稍等...", - "36": "TODO", + "36": "歷史文檔內容太多,為了不影響性能,已經切換為純文本顯示", "37": "雲端同步目錄的名稱請勿包含空格和特殊符號", "38": "提及關鍵字數量 [%d] 過多,目前最多僅支援搜索 [512] 個關鍵字", "39": "正在刪除索引 %s", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 79f444178..2fbd874d8 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -811,7 +811,7 @@ "33": "读写文件或访问网络权限不足,请检查工作空间文件夹权限和杀毒软件/防火墙的设置。如果你曾经使用管理员身份运行过思源,请考虑切换到新的工作空间目录,后续请勿使用管理员身份运行(当前的工作空间目录可能已经无法使用普通用户访问)", "34": "只读模式下不支持该操作", "35": "正在重建索引,请稍等...", - "36": "TODO", + "36": "历史文档内容太多,为了不影响性能,已经切换为纯文本显示", "37": "云端同步目录的名称请勿包含空格和特殊符号", "38": "提及关键字数量 [%d] 过多,目前最多仅支持搜索 [512] 个关键字", "39": "正在删除索引 %s", diff --git a/kernel/model/history.go b/kernel/model/history.go index 35ea1e350..3f323bcac 100644 --- a/kernel/model/history.go +++ b/kernel/model/history.go @@ -161,62 +161,67 @@ func GetDocHistoryContent(historyPath, keyword string) (content string, isLargeD return } - renderTree := &parse.Tree{Root: &ast.Node{Type: ast.NodeDocument}} - keyword = strings.Join(strings.Split(keyword, " "), search.TermSep) - keywords := search.SplitKeyword(keyword) + if !isLargeDoc { + renderTree := &parse.Tree{Root: &ast.Node{Type: ast.NodeDocument}} + keyword = strings.Join(strings.Split(keyword, " "), search.TermSep) + keywords := search.SplitKeyword(keyword) - var unlinks []*ast.Node - ast.Walk(historyTree.Root, func(n *ast.Node, entering bool) ast.WalkStatus { - if !entering { - return ast.WalkContinue - } + var unlinks []*ast.Node + ast.Walk(historyTree.Root, func(n *ast.Node, entering bool) ast.WalkStatus { + if !entering { + return ast.WalkContinue + } - if ast.NodeBlockRef == n.Type { - appendRefTextRenderResultForBlockRef(n) - return ast.WalkSkipChildren - } + if ast.NodeBlockRef == n.Type { + appendRefTextRenderResultForBlockRef(n) + return ast.WalkSkipChildren + } - if ast.NodeText == n.Type { - if 0 < len(keywords) { - // 搜索高亮 - text := string(n.Tokens) - text = search.EncloseHighlighting(text, keywords, "", "", false) - n.Tokens = gulu.Str.ToBytes(text) - if bytes.Contains(n.Tokens, []byte("search-mark")) { - n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("\\"), []byte("\\\\")) - linkTree := parse.Inline("", n.Tokens, luteEngine.ParseOptions) - var children []*ast.Node - for c := linkTree.Root.FirstChild.FirstChild; nil != c; c = c.Next { - children = append(children, c) + if ast.NodeText == n.Type { + if 0 < len(keywords) { + // 搜索高亮 + text := string(n.Tokens) + text = search.EncloseHighlighting(text, keywords, "", "", false) + n.Tokens = gulu.Str.ToBytes(text) + if bytes.Contains(n.Tokens, []byte("search-mark")) { + n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("\\"), []byte("\\\\")) + linkTree := parse.Inline("", n.Tokens, luteEngine.ParseOptions) + var children []*ast.Node + for c := linkTree.Root.FirstChild.FirstChild; nil != c; c = c.Next { + children = append(children, c) + } + for _, c := range children { + n.InsertBefore(c) + } + unlinks = append(unlinks, n) + return ast.WalkContinue } - for _, c := range children { - n.InsertBefore(c) - } - unlinks = append(unlinks, n) - return ast.WalkContinue } } + return ast.WalkContinue + }) + + for _, unlink := range unlinks { + unlink.Unlink() } - return ast.WalkContinue - }) - for _, unlink := range unlinks { - unlink.Unlink() - } + var appends []*ast.Node + for n := historyTree.Root.FirstChild; nil != n; n = n.Next { + appends = append(appends, n) + } + for _, n := range appends { + renderTree.Root.AppendChild(n) + } - var appends []*ast.Node - for n := historyTree.Root.FirstChild; nil != n; n = n.Next { - appends = append(appends, n) - } - for _, n := range appends { - renderTree.Root.AppendChild(n) + historyTree = renderTree } if isLargeDoc { - formatRenderer := render.NewFormatRenderer(renderTree, luteEngine.RenderOptions) + util.PushMsg(Conf.Language(36), 3000) + formatRenderer := render.NewFormatRenderer(historyTree, luteEngine.RenderOptions) content = gulu.Str.FromBytes(formatRenderer.Render()) } else { - content = luteEngine.Tree2BlockDOM(renderTree, luteEngine.RenderOptions) + content = luteEngine.Tree2BlockDOM(historyTree, luteEngine.RenderOptions) } return }