diff --git a/app/src/constants.ts b/app/src/constants.ts index dc2e37fdd..e8c1ff93c 100644 --- a/app/src/constants.ts +++ b/app/src/constants.ts @@ -125,7 +125,8 @@ export abstract class Constants { public static readonly CB_GET_HL = "cb-get-hl"; // 高亮 public static readonly CB_GET_FOCUS = "cb-get-focus"; // 光标定位 public static readonly CB_GET_FOCUSFIRST = "cb-get-focusfirst"; // 动态定位到第一个块 - public static readonly CB_GET_SETID = "cb-get-setid"; // 重置 blockid + public static readonly CB_GET_SETID = "cb-get-setid"; // 无折叠大纲点击 重置 blockid + public static readonly CB_GET_OUTLINE = "cb-get-outline"; // 大纲点击 public static readonly CB_GET_ALL = "cb-get-all"; // 获取所有块 public static readonly CB_GET_BACKLINK = "cb-get-backlink"; // 悬浮窗为传递型需展示上下文 public static readonly CB_GET_UNUNDO = "cb-get-unundo"; // 不需要记录历史 diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts index 89d83f1a0..537ff3285 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, undefined, options.action?.includes(Constants.CB_GET_SETID) ? false : true); + const newRange = focusBlock(nodeElement, undefined, options.action?.includes(Constants.CB_GET_OUTLINE) ? false : true); if (newRange) { editor.editor.protyle.toolbar.range = newRange; } diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts index ccaa99681..95b9f6dc3 100644 --- a/app/src/layout/dock/Outline.ts +++ b/app/src/layout/dock/Outline.ts @@ -129,7 +129,7 @@ export class Outline extends Model { openFileById({ app: options.app, id, - action: zoomIn ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML], + action: zoomIn ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL, Constants.CB_GET_HTML, Constants.CB_GET_OUTLINE] : [Constants.CB_GET_FOCUS, Constants.CB_GET_OUTLINE, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML], }); }); } diff --git a/app/src/mobile/dock/MobileOutline.ts b/app/src/mobile/dock/MobileOutline.ts index 6b76fe2c3..b2a2666f1 100644 --- a/app/src/mobile/dock/MobileOutline.ts +++ b/app/src/mobile/dock/MobileOutline.ts @@ -37,7 +37,7 @@ export class MobileOutline { document.getElementById(id)?.scrollIntoView(); } else { checkFold(id, (zoomIn) => { - openMobileFileById(app, id, zoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_HL, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML]); + openMobileFileById(app, id, zoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_HTML, Constants.CB_GET_OUTLINE] : [Constants.CB_GET_HL, Constants.CB_GET_OUTLINE, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML]); }); } } diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index f7b455285..d5eaec8b1 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -450,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, undefined, action.includes(Constants.CB_GET_SETID) ? false : true); + focusBlock(focusElement, undefined, action.includes(Constants.CB_GET_OUTLINE) ? false : true); } /// #if !MOBILE if (!action.includes(Constants.CB_GET_UNUNDO)) { diff --git a/app/src/types/protyle.d.ts b/app/src/types/protyle.d.ts index 584fc0c24..c4ebdea18 100644 --- a/app/src/types/protyle.d.ts +++ b/app/src/types/protyle.d.ts @@ -26,7 +26,8 @@ type TProtyleAction = "cb-get-append" | // 向下滚动加载 "cb-get-hl" | // 高亮 "cb-get-focus" | // 光标定位 "cb-get-focusfirst" | // 动态定位到第一个块 - "cb-get-setid" | // 重置 blockid + "cb-get-setid" | // 无折叠大纲点击 重置 blockid + "cb-get-outline" | // 大纲点击 "cb-get-all" | // 获取所有块 "cb-get-backlink" | // 悬浮窗为传递型需展示上下文 "cb-get-unundo" | // 不需要记录历史