mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
This commit is contained in:
parent
541d5613fd
commit
783573ee8a
6 changed files with 8 additions and 6 deletions
|
|
@ -125,7 +125,8 @@ export abstract class Constants {
|
||||||
public static readonly CB_GET_HL = "cb-get-hl"; // 高亮
|
public static readonly CB_GET_HL = "cb-get-hl"; // 高亮
|
||||||
public static readonly CB_GET_FOCUS = "cb-get-focus"; // 光标定位
|
public static readonly CB_GET_FOCUS = "cb-get-focus"; // 光标定位
|
||||||
public static readonly CB_GET_FOCUSFIRST = "cb-get-focusfirst"; // 动态定位到第一个块
|
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_ALL = "cb-get-all"; // 获取所有块
|
||||||
public static readonly CB_GET_BACKLINK = "cb-get-backlink"; // 悬浮窗为传递型需展示上下文
|
public static readonly CB_GET_BACKLINK = "cb-get-backlink"; // 悬浮窗为传递型需展示上下文
|
||||||
public static readonly CB_GET_UNUNDO = "cb-get-unundo"; // 不需要记录历史
|
public static readonly CB_GET_UNUNDO = "cb-get-unundo"; // 不需要记录历史
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,7 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
|
||||||
highlightById(editor.editor.protyle, options.id, true);
|
highlightById(editor.editor.protyle, options.id, true);
|
||||||
} else if (options.action?.includes(Constants.CB_GET_FOCUS)) {
|
} else if (options.action?.includes(Constants.CB_GET_FOCUS)) {
|
||||||
if (nodeElement) {
|
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) {
|
if (newRange) {
|
||||||
editor.editor.protyle.toolbar.range = newRange;
|
editor.editor.protyle.toolbar.range = newRange;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ export class Outline extends Model {
|
||||||
openFileById({
|
openFileById({
|
||||||
app: options.app,
|
app: options.app,
|
||||||
id,
|
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],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ export class MobileOutline {
|
||||||
document.getElementById(id)?.scrollIntoView();
|
document.getElementById(id)?.scrollIntoView();
|
||||||
} else {
|
} else {
|
||||||
checkFold(id, (zoomIn) => {
|
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]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -450,7 +450,7 @@ const focusElementById = (protyle: IProtyle, action: string[], scrollAttr?: IScr
|
||||||
if (scrollAttr && scrollAttr.focusId) {
|
if (scrollAttr && scrollAttr.focusId) {
|
||||||
range = focusByOffset(focusElement, scrollAttr.focusStart, scrollAttr.focusEnd) as Range;
|
range = focusByOffset(focusElement, scrollAttr.focusStart, scrollAttr.focusEnd) as Range;
|
||||||
} else {
|
} 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 !MOBILE
|
||||||
if (!action.includes(Constants.CB_GET_UNUNDO)) {
|
if (!action.includes(Constants.CB_GET_UNUNDO)) {
|
||||||
|
|
|
||||||
3
app/src/types/protyle.d.ts
vendored
3
app/src/types/protyle.d.ts
vendored
|
|
@ -26,7 +26,8 @@ type TProtyleAction = "cb-get-append" | // 向下滚动加载
|
||||||
"cb-get-hl" | // 高亮
|
"cb-get-hl" | // 高亮
|
||||||
"cb-get-focus" | // 光标定位
|
"cb-get-focus" | // 光标定位
|
||||||
"cb-get-focusfirst" | // 动态定位到第一个块
|
"cb-get-focusfirst" | // 动态定位到第一个块
|
||||||
"cb-get-setid" | // 重置 blockid
|
"cb-get-setid" | // 无折叠大纲点击 重置 blockid
|
||||||
|
"cb-get-outline" | // 大纲点击
|
||||||
"cb-get-all" | // 获取所有块
|
"cb-get-all" | // 获取所有块
|
||||||
"cb-get-backlink" | // 悬浮窗为传递型需展示上下文
|
"cb-get-backlink" | // 悬浮窗为传递型需展示上下文
|
||||||
"cb-get-unundo" | // 不需要记录历史
|
"cb-get-unundo" | // 不需要记录历史
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue