An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/5362
Vanessabd33e98274e2
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex 1b8cc76b9d..5dd91669ff 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -1,4 +1,6 @@{+ "crossKeepLazyLoad": "Cross-page multi-selection needs to select [Keep Loaded Content] in the more menu",+ "keepLazyLoad": "Keep loaded content","localSnapshot": "Local Snapshot","localTagSnapshot": "Local Tag Snapshot","cloudTagSnapshot": "Cloud Tag Snapshot",diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex 6dc4d00d93..0207ae6e6e 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -1,4 +1,6 @@{+ "crossKeepLazyLoad": "La selección múltiple entre páginas debe seleccionar [Mantener contenido cargado] en el menú más",+ "keepLazyLoad": "Mantener el contenido cargado","localSnapshot": "Instantánea local","localTagSnapshot": "Instantánea de etiqueta local","cloudTagSnapshot": "Instantánea de etiquetas en la nube",diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex ce58811ffa..735c25f7c4 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -1,4 +1,6 @@{+ "crossKeepLazyLoad": "La multi-sélection sur plusieurs pages doit sélectionner [Conserver le contenu chargé] dans le menu plus",+ "keepLazyLoad": "Conserver le contenu chargé","localSnapshot": "Instantané local","localTagSnapshot": "Instantané de balise locale","cloudTagSnapshot": "Instantané de balise cloud",diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex 5b782f776d..ae76a5f63f 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -1,4 +1,6 @@{+ "crossKeepLazyLoad": "跨頁多選需在更多菜單中選中【保持已加載內容】",+ "keepLazyLoad": "保持已加載的內容","localSnapshot": "本地快照","localTagSnapshot": "本地標記的快照","cloudTagSnapshot": "雲端標記的快照",diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex 1f73ea0e5d..ccf2bdd990 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -1,4 +1,6 @@{+ "crossKeepLazyLoad": "跨页多选需在更多菜单中选中【保持已加载内容】",+ "keepLazyLoad": "保持已加载的内容","localSnapshot": "本地快照","localTagSnapshot": "本地标记的快照","cloudTagSnapshot": "云端标记的快照",diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.tsindex 5f355aecd1..2f67a76d4c 100644--- a/app/src/protyle/breadcrumb/index.ts+++ b/app/src/protyle/breadcrumb/index.ts@@ -215,9 +215,9 @@ export class Breadcrumb {}}).element);window.siyuan.menus.menu.append(new MenuItem({- label: window.siyuan.languages.optimizeTypography,+ label: window.siyuan.languages.netImg2LocalAsset,click: () => {- fetchPost("/api/format/autoSpace", {+ fetchPost("/api/format/netImg2LocalAssets", {id: protyle.block.rootID}, () => {/// #if MOBILE@@ -245,9 +245,9 @@ export class Breadcrumb {}}).element);window.siyuan.menus.menu.append(new MenuItem({- label: window.siyuan.languages.netImg2LocalAsset,+ label: window.siyuan.languages.optimizeTypography,click: () => {- fetchPost("/api/format/netImg2LocalAssets", {+ fetchPost("/api/format/autoSpace", {id: protyle.block.rootID}, () => {/// #if MOBILE@@ -274,6 +274,15 @@ export class Breadcrumb {});}}).element);+ if (!protyle.scroll?.element.classList.contains("fn__none")) {+ window.siyuan.menus.menu.append(new MenuItem({+ current: protyle.scroll.keepLazyLoad,+ label: window.siyuan.languages.keepLazyLoad,+ click: () => {+ protyle.scroll.keepLazyLoad = !protyle.scroll.keepLazyLoad;+ }+ }).element);+ }window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);window.siyuan.menus.menu.append(new MenuItem({icon: "iconRefresh",diff --git a/app/src/protyle/scroll/index.ts b/app/src/protyle/scroll/index.tsindex a900c838c3..41735a98ac 100644--- a/app/src/protyle/scroll/index.ts+++ b/app/src/protyle/scroll/index.ts@@ -7,6 +7,7 @@ export class Scroll {private inputElement: HTMLInputElement;public blockSize: number;public lastScrollTop: number;+ public keepLazyLoad: boolean;constructor(protyle: IProtyle) {const divElement = document.createElement("div");@@ -14,6 +15,7 @@ export class Scroll {divElement.className = "fn__none protyle-scroll b3-tooltips b3-tooltips__s";divElement.setAttribute("aria-label", "Blocks 1/1");this.element = divElement;+ this.keepLazyLoad = false;if (!protyle.options.render.scroll) {this.element.classList.add("fn__none");}diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex 2aa885c86a..b91bf536e0 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -104,7 +104,7 @@ const setHTML = (options: { content: string, action?: string[] }, protyle: IProtconst REMOVED_OVER_HEIGHT = protyle.contentElement.clientHeight * 8;if (options.action.includes(Constants.CB_GET_APPEND)) {// 动态加载移除- if (protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT) {+ if (!protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select") && !protyle.scroll.keepLazyLoad && protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT) {preventScroll(protyle);let removeElement = protyle.wysiwyg.element.firstElementChild as HTMLElement;const removeElements = [];@@ -130,9 +130,11 @@ const setHTML = (options: { content: string, action?: string[] }, protyle: IProtprotyle.wysiwyg.element.insertAdjacentHTML("afterbegin", options.content);protyle.contentElement.scrollTop = protyle.contentElement.scrollTop + (lastElement.getBoundingClientRect().top - lastTop);// 动态加载移除- while (protyle.wysiwyg.element.childElementCount > 2 && protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT &&- protyle.wysiwyg.element.lastElementChild.getBoundingClientRect().top > window.innerHeight) {- protyle.wysiwyg.element.lastElementChild.remove();+ if (!protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select") && !protyle.scroll.keepLazyLoad) {+ while (protyle.wysiwyg.element.childElementCount > 2 && protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT &&+ protyle.wysiwyg.element.lastElementChild.getBoundingClientRect().top > window.innerHeight) {+ protyle.wysiwyg.element.lastElementChild.remove();+ }}} else {protyle.wysiwyg.element.innerHTML = options.content;diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex f45102afcd..7b44573795 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -1813,6 +1813,10 @@ export class WYSIWYG {shiftStartElement = undefined;} else {const ids: string[] = [];+ if (!protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select") && protyle.scroll && !protyle.scroll.element.classList.contains("fn__none") && !protyle.scroll.keepLazyLoad &&+ (startElement.getBoundingClientRect().top < -protyle.contentElement.clientHeight * 2 || endElement.getBoundingClientRect().bottom > protyle.contentElement.clientHeight * 2)) {+ showMessage(window.siyuan.languages.crossKeepLazyLoad);+ }selectElements.forEach(item => {item.classList.add("protyle-wysiwyg--select");ids.push(item.getAttribute("data-node-id"));