diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts index ef2e067f5..89d83f1a0 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 7c2f36e2f..f7b455285 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)) {