Vanessa 2025-05-06 13:20:58 +08:00
parent 541d5613fd
commit 783573ee8a
6 changed files with 8 additions and 6 deletions

View file

@ -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"; // 不需要记录历史

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

View file

@ -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],
});
});
}

View file

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

View file

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

View file

@ -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" | // 不需要记录历史