This commit is contained in:
Vanessa 2023-09-02 00:21:57 +08:00
parent 7ac33b0a34
commit a21831eb9a
3 changed files with 14 additions and 4 deletions

View file

@ -159,7 +159,11 @@ export class BlockPanel {
const action = [];
if (response.data.rootID !== this.nodeIds[index]) {
action.push(Constants.CB_GET_ALL);
} else {
action.push(Constants.CB_GET_SCROLL);
action.push(Constants.CB_GET_HL);
}
if (this.isBacklink) {
action.push(Constants.CB_GET_BACKLINK);
}

View file

@ -216,11 +216,17 @@ export class Protyle {
return;
}
if (options.scrollAttr ||
mergedOptions.action.includes(Constants.CB_GET_CONTEXT) ||
(mergedOptions.action.includes(Constants.CB_GET_SCROLL) && this.protyle.options.mode !== "preview")) {
if (!options.scrollAttr) {
fetchPost("/api/block/getDocInfo", {
id: options.blockId
}, (response) => {
if (response.data.rootID !== options.blockId && mergedOptions.action.includes(Constants.CB_GET_CONTEXT)) {
// 搜索打开文档等情况需保持上一次历史 https://github.com/siyuan-note/siyuan/issues/9082
this.getDoc(mergedOptions);
return;
}
let scrollObj;
if (response.data.ial.scroll) {
try {

View file

@ -756,7 +756,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
openFileById({
app,
id,
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL],
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT],
zoomIn: foldResponse.data,
position: "right"
});
@ -796,7 +796,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
openFileById({
app,
id,
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL],
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT],
zoomIn: foldResponse.data
});
if (closeCB) {
@ -855,7 +855,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
app,
id,
position: "right",
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL],
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT],
zoomIn: foldResponse.data
});
if (closeCB) {
@ -884,7 +884,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
openFileById({
app,
id,
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL],
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT],
zoomIn: foldResponse.data
});
if (closeCB) {