Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/14725

Vanessa74b5badbbcc5
diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts
index ef2e067f50..89d83f1a05 100644
--- a/app/src/editor/util.ts
+++ b/app/src/editor/util.ts
@@ -387,7 +387,7 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
highlightById(editor.editor.protyle, options.id, true);
} else if (options.action?.includes(Constants.CB_GET_FOCUS)) {
if (nodeElement) {
- const newRange = focusBlock(nodeElement);
+ const newRange = focusBlock(nodeElement, undefined, options.action?.includes(Constants.CB_GET_SETID) ? false : true);
if (newRange) {
editor.editor.protyle.toolbar.range = newRange;
}
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts
index 7c2f36e2f5..f7b455285f 100644
--- a/app/src/protyle/util/onGet.ts
+++ b/app/src/protyle/util/onGet.ts
@@ -78,8 +78,10 @@ export const onGet = (options: {
options.protyle.wysiwyg.element.setAttribute("data-doc-type", options.data.data.type);
}
- // 防止动态加载加载过多的内容
- if (options.action.includes(Constants.CB_GET_APPEND) || options.action.includes(Constants.CB_GET_BEFORE) || options.action.includes(Constants.CB_GET_HTML)) {
+ if (options.protyle.options.render.title && options.protyle.title.element.getAttribute("data-render") !== "true") {
+ // 文档A的大纲,关闭文档A后,点击大纲无法渲染头部
+ } else if (options.action.includes(Constants.CB_GET_APPEND) || options.action.includes(Constants.CB_GET_BEFORE) || options.action.includes(Constants.CB_GET_HTML)) {
+ // 防止动态加载加载过多的内容
setHTML({
content: options.data.data.content,
expand: options.data.data.isBacklinkExpand,
@@ -448,7 +450,7 @@ const focusElementById = (protyle: IProtyle, action: string[], scrollAttr?: IScr
if (scrollAttr && scrollAttr.focusId) {
range = focusByOffset(focusElement, scrollAttr.focusStart, scrollAttr.focusEnd) as Range;
} else {
- focusBlock(focusElement);
+ focusBlock(focusElement, undefined, action.includes(Constants.CB_GET_SETID) ? false : true);
}
/// #if !MOBILE
if (!action.includes(Constants.CB_GET_UNUNDO)) {