Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art:编辑器动态加载块数由定值改为可配置 Fix https://github.com/siyuan-note/siyuan/issues/6415

Liang Ding5b51f18e464a
diff --git a/app/src/config/editor.ts b/app/src/config/editor.ts
index 4b6a95f604..e7949dc82c 100644
--- a/app/src/config/editor.ts
+++ b/app/src/config/editor.ts
@@ -261,6 +261,16 @@ export const editor = {
});
const setEditor = () => {
+ let dynamicLoadBlocks = parseInt((editor.element.querySelector("#dynamicLoadBlocks") as HTMLInputElement).value)
+ if (128 > dynamicLoadBlocks) {
+ dynamicLoadBlocks = 128;
+ (editor.element.querySelector("#dynamicLoadBlocks") as HTMLInputElement).value = "128";
+ }
+ if (1024 < dynamicLoadBlocks) {
+ dynamicLoadBlocks = 1024;
+ (editor.element.querySelector("#dynamicLoadBlocks") as HTMLInputElement).value = "1024";
+ }
+
fetchPost("/api/setting/setEditor", {
fullWidth: (editor.element.querySelector("#fullWidth") as HTMLInputElement).checked,
readOnly: (editor.element.querySelector("#readOnly") as HTMLInputElement).checked,
@@ -277,7 +287,7 @@ export const editor = {
virtualBlockRefInclude: (editor.element.querySelector("#virtualBlockRefInclude") as HTMLInputElement).value,
virtualBlockRefExclude: (editor.element.querySelector("#virtualBlockRefExclude") as HTMLInputElement).value,
blockRefDynamicAnchorTextMaxLen: parseInt((editor.element.querySelector("#blockRefDynamicAnchorTextMaxLen") as HTMLInputElement).value),
- dynamicLoadBlocks: parseInt((editor.element.querySelector("#dynamicLoadBlocks") as HTMLInputElement).value),
+ dynamicLoadBlocks: dynamicLoadBlocks,
codeLigatures: (editor.element.querySelector("#codeLigatures") as HTMLInputElement).checked,
codeTabSpaces: parseInt((editor.element.querySelector("#codeTabSpaces") as HTMLInputElement).value),
fontSize: parseInt((editor.element.querySelector("#fontSize") as HTMLInputElement).value),
diff --git a/kernel/model/conf.go b/kernel/model/conf.go
index 867e9b09a2..90eb23a05c 100644
--- a/kernel/model/conf.go
+++ b/kernel/model/conf.go
@@ -257,9 +257,12 @@ func InitConf() {
if 1 > Conf.Editor.HistoryRetentionDays {
Conf.Editor.HistoryRetentionDays = 7
}
- if 1 > Conf.Editor.DynamicLoadBlocks {
+ if 128 > Conf.Editor.DynamicLoadBlocks {
Conf.Editor.DynamicLoadBlocks = 128
}
+ if 1024 < Conf.Editor.DynamicLoadBlocks {
+ Conf.Editor.DynamicLoadBlocks = 1024
+ }
if nil == Conf.Search {
Conf.Search = conf.NewSearch()