Vanessa 2025-04-30 14:19:56 +08:00
parent 708da7c753
commit 74b5badbbc
2 changed files with 6 additions and 4 deletions

View file

@ -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;
}

View file

@ -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)) {