🎨 Alert users when .sy file or database .json exceed 8MB https://github.com/siyuan-note/siyuan/issues/15451

This commit is contained in:
Daniel 2025-08-24 10:49:13 +08:00
parent f3cc641005
commit eb13c34fe5
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
22 changed files with 98 additions and 15 deletions

View file

@ -52,6 +52,14 @@ export const fileTree = {
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="useSingleLineSave" type="checkbox"${window.siyuan.config.fileTree.useSingleLineSave ? " checked" : ""}/>
</label>
<div class="fn__flex b3-label config__item">
<div class="fn__flex-1">
${window.siyuan.languages.fileTree22}
<div class="b3-label__text">${window.siyuan.languages.fileTree23}</div>
</div>
<span class="fn__space"></span>
<input class="b3-text-field fn__flex-center fn__size200" id="largeFileWarningSize" type="number" min="2" max="10240" value="${window.siyuan.config.fileTree.largeFileWarningSize}">
</div>
<div class="fn__flex b3-label config__item">
<div class="fn__flex-1">
${window.siyuan.languages.fileTree16}
@ -113,6 +121,7 @@ export const fileTree = {
allowCreateDeeper: (fileTree.element.querySelector("#allowCreateDeeper") as HTMLInputElement).checked,
removeDocWithoutConfirm: (fileTree.element.querySelector("#removeDocWithoutConfirm") as HTMLInputElement).checked,
useSingleLineSave: (fileTree.element.querySelector("#useSingleLineSave") as HTMLInputElement).checked,
largeFileWarningSize: parseInt((fileTree.element.querySelector("#largeFileWarningSize") as HTMLInputElement).value),
maxListCount: parseInt((fileTree.element.querySelector("#maxListCount") as HTMLInputElement).value),
maxOpenTabCount: inputMaxOpenTabCount,
}, response => {

View file

@ -30,6 +30,12 @@ export const initFileTree = () => {
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="useSingleLineSave" type="checkbox"${window.siyuan.config.fileTree.useSingleLineSave ? " checked" : ""}/>
</label>
<div class="b3-label">
${window.siyuan.languages.fileTree22}
<span class="fn__hr"></span>
<input class="b3-text-field fn__block" id="largeFileWarningSize" type="number" min="2" max="10240" value="${window.siyuan.config.fileTree.largeFileWarningSize}">
<div class="b3-label__text">${window.siyuan.languages.fileTree23}</div>
</div>
<div class="b3-label">
${window.siyuan.languages.fileTree16}
<span class="fn__hr"></span>
@ -69,6 +75,7 @@ export const initFileTree = () => {
allowCreateDeeper: (modelMainElement.querySelector("#allowCreateDeeper") as HTMLInputElement).checked,
removeDocWithoutConfirm: (modelMainElement.querySelector("#removeDocWithoutConfirm") as HTMLInputElement).checked,
useSingleLineSave: (modelMainElement.querySelector("#useSingleLineSave") as HTMLInputElement).checked,
largeFileWarningSize: parseInt((modelMainElement.querySelector("#largeFileWarningSize") as HTMLInputElement).value),
maxListCount: parseInt((modelMainElement.querySelector("#maxListCount") as HTMLInputElement).value),
maxOpenTabCount: window.siyuan.config.fileTree.maxOpenTabCount,
}, response => {

View file

@ -643,6 +643,10 @@ declare namespace Config {
* Whether to save the content of the .sy file as a single-line JSON object
*/
useSingleLineSave: boolean;
/**
* The .sy and database .json files larger than this value will prompt a warning (unit: MB)
*/
largeFileWarningSize: number;
}
/**