From 5b51f18e464a6a3eda46c1bed0cf6ecedb2e595d Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 30 Oct 2022 23:35:29 +0800 Subject: [PATCH] =?UTF-8?q?:art:=E7=BC=96=E8=BE=91=E5=99=A8=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E5=8A=A0=E8=BD=BD=E5=9D=97=E6=95=B0=E7=94=B1=E5=AE=9A?= =?UTF-8?q?=E5=80=BC=E6=94=B9=E4=B8=BA=E5=8F=AF=E9=85=8D=E7=BD=AE=20Fix=20?= =?UTF-8?q?https://github.com/siyuan-note/siyuan/issues/6415?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/config/editor.ts | 12 +++++++++++- kernel/model/conf.go | 5 ++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/config/editor.ts b/app/src/config/editor.ts index 4b6a95f60..e7949dc82 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 867e9b09a..90eb23a05 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()