diff --git a/app/src/block/Panel.ts b/app/src/block/Panel.ts index 39d82a431..357ee44a2 100644 --- a/app/src/block/Panel.ts +++ b/app/src/block/Panel.ts @@ -156,7 +156,7 @@ export class BlockPanel { 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_CONTEXT); action.push(Constants.CB_GET_HL); } diff --git a/app/src/boot/onGetConfig.ts b/app/src/boot/onGetConfig.ts index 5feae88ba..b515186f7 100644 --- a/app/src/boot/onGetConfig.ts +++ b/app/src/boot/onGetConfig.ts @@ -281,7 +281,7 @@ export const initWindow = (app: App) => { openFileById({ app, id, - action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: focus, }); ipcRenderer.send(Constants.SIYUAN_SHOW, getCurrentWindow().id); diff --git a/app/src/constants.ts b/app/src/constants.ts index 8afcb2807..260e75d66 100644 --- a/app/src/constants.ts +++ b/app/src/constants.ts @@ -69,6 +69,7 @@ export abstract class Constants { public static readonly CB_GET_UNUNDO = "cb-get-unundo"; // 不需要记录历史 public static readonly CB_GET_SCROLL = "cb-get-scroll"; // 滚动到指定位置 public static readonly CB_GET_CONTEXT = "cb-get-context"; // 包含上下文 + public static readonly CB_GET_ROOTSCROLL = "cb-get-rootscroll"; // 如果为 rootID 就滚动到指定位置 public static readonly CB_GET_HTML = "cb-get-html"; // 直接渲染,不需要再 /api/block/getDocInfo,否则搜索表格无法定位 public static readonly CB_GET_HISTORY = "cb-get-history"; // 历史渲染 diff --git a/app/src/index.ts b/app/src/index.ts index bc75f6c45..074a85b60 100644 --- a/app/src/index.ts +++ b/app/src/index.ts @@ -190,7 +190,7 @@ window.openFileByURL = (openURL) => { openFileById({ app: siyuanApp, id: getIdFromSYProtocol(openURL), - action: isZoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: isZoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: isZoomIn }); return true; diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts index b00221d89..26cbebe8a 100644 --- a/app/src/layout/Wnd.ts +++ b/app/src/layout/Wnd.ts @@ -474,7 +474,7 @@ export class Wnd { openFileById({ app: this.app, id: keepCursorId, - action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT] + action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL] }); } currentTab.headElement.removeAttribute("keep-cursor"); diff --git a/app/src/layout/dock/Bookmark.ts b/app/src/layout/dock/Bookmark.ts index a5a64802e..1fdb8e311 100644 --- a/app/src/layout/dock/Bookmark.ts +++ b/app/src/layout/dock/Bookmark.ts @@ -89,7 +89,7 @@ export class Bookmark extends Model { openFileById({ app, id, - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: foldResponse.data }); }); @@ -103,7 +103,7 @@ export class Bookmark extends Model { app, id: element.getAttribute("data-node-id"), keepCursor: true, - action: [Constants.CB_GET_CONTEXT] + action: [Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL] }); }, altClick(element: HTMLElement) { @@ -111,7 +111,7 @@ export class Bookmark extends Model { app, id: element.getAttribute("data-node-id"), position: "right", - action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT] + action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL] }); }, shiftClick(element: HTMLElement) { @@ -119,7 +119,7 @@ export class Bookmark extends Model { app, id: element.getAttribute("data-node-id"), position: "bottom", - action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT] + action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL] }); }, blockExtHTML: '', diff --git a/app/src/layout/dock/Graph.ts b/app/src/layout/dock/Graph.ts index b601ea522..10c596937 100644 --- a/app/src/layout/dock/Graph.ts +++ b/app/src/layout/dock/Graph.ts @@ -653,14 +653,14 @@ export class Graph extends Model { app: this.app, id: node.id, position: "bottom", - action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT] + action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL] }); } else if (window.siyuan.altIsPressed) { openFileById({ app: this.app, id: node.id, position: "right", - action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT] + action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL] }); } else if (window.siyuan.ctrlIsPressed) { window.siyuan.blockPanels.push(new BlockPanel({ @@ -674,7 +674,7 @@ export class Graph extends Model { openFileById({ app: this.app, id: node.id, - action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT] + action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL] }); } }); diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts index 2ae5dd8d1..77dd610fa 100644 --- a/app/src/layout/util.ts +++ b/app/src/layout/util.ts @@ -435,7 +435,7 @@ export const JSONToLayout = (app: App, isStart: boolean) => { openFileById({ app, id: idZoomIn.id, - action: idZoomIn.isZoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: idZoomIn.isZoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: idZoomIn.isZoomIn }); } else { diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index c0b7731e3..bbd82b0a9 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -193,7 +193,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => { openFileById({ app: protyle.app, id: refBlockId, - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: foldResponse.data }); }); @@ -207,7 +207,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => { openFileById({ app: protyle.app, id: refBlockId, - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], keepCursor: true, zoomIn: foldResponse.data }); @@ -224,7 +224,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => { app: protyle.app, id: refBlockId, position: "right", - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: foldResponse.data }); }); @@ -240,7 +240,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => { app: protyle.app, id: refBlockId, position: "bottom", - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: foldResponse.data }); }); diff --git a/app/src/mobile/dock/MobileBookmarks.ts b/app/src/mobile/dock/MobileBookmarks.ts index 71d0830fc..f95eb0356 100644 --- a/app/src/mobile/dock/MobileBookmarks.ts +++ b/app/src/mobile/dock/MobileBookmarks.ts @@ -39,7 +39,7 @@ export class MobileBookmarks { } } fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => { - openMobileFileById(app, id, foldResponse.data ? [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]); + openMobileFileById(app, id, foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); }); }, blockExtHTML: '', diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts index 63380459f..07f7e0924 100644 --- a/app/src/mobile/index.ts +++ b/app/src/mobile/index.ts @@ -130,7 +130,7 @@ window.hideKeyboardToolbar = hideKeyboardToolbar; window.openFileByURL = (openURL) => { if (openURL && isSYProtocol(openURL)) { openMobileFileById(siyuanApp, getIdFromSYProtocol(openURL), - getSearch("focus", openURL) === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]); + getSearch("focus", openURL) === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); return true; } return false; diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.ts index 809d337ce..0c7976e66 100644 --- a/app/src/mobile/menu/search.ts +++ b/app/src/mobile/menu/search.ts @@ -560,7 +560,7 @@ const initSearchEvent = (app: App, element: Element, config: ISearchOption) => { preventScroll(window.siyuan.mobile.editor.protyle); } fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => { - openMobileFileById(app, id, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]); + openMobileFileById(app, id, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); }); closePanel(); } else { diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts index f44c9e6c7..3a92cd921 100644 --- a/app/src/mobile/util/initFramework.ts +++ b/app/src/mobile/util/initFramework.ts @@ -119,7 +119,7 @@ export const initFramework = (app: App) => { const idZoomIn = getIdZoomInByPath(); if (idZoomIn.id) { openMobileFileById(app, idZoomIn.id, - idZoomIn.isZoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]); + idZoomIn.isZoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); return; } const localDoc = window.siyuan.storage[Constants.LOCAL_DOCINFO]; @@ -129,7 +129,7 @@ export const initFramework = (app: App) => { } else { fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => { if (response.data.length !== 0) { - openMobileFileById(app, response.data[0].id, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]); + openMobileFileById(app, response.data[0].id, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); } else { setEmpty(app); } diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.ts index c2c0c6748..4113273de 100644 --- a/app/src/protyle/index.ts +++ b/app/src/protyle/index.ts @@ -216,50 +216,48 @@ export class Protyle { removeLoading(this.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; + if (options.scrollAttr) { + getDocByScroll({ + protyle: this.protyle, + scrollAttr: options.scrollAttr, + mergedOptions, + cb: () => { + this.afterOnGet(mergedOptions); + } + }); + } else if (this.protyle.options.mode !== "preview" && + (mergedOptions.action.includes(Constants.CB_GET_SCROLL) || mergedOptions.action.includes(Constants.CB_GET_ROOTSCROLL))) { + fetchPost("/api/block/getDocInfo", { + id: options.blockId + }, (response) => { + if (!mergedOptions.action.includes(Constants.CB_GET_SCROLL) && + response.data.rootID !== options.blockId && mergedOptions.action.includes(Constants.CB_GET_ROOTSCROLL)) { + // 打开根文档保持上一次历史,否则按照原有 action 执行 https://github.com/siyuan-note/siyuan/issues/9082 + this.getDoc(mergedOptions); + return; + } + let scrollObj; + if (response.data.ial.scroll) { + try { + scrollObj = JSON.parse(response.data.ial.scroll.replace(/"/g, '"')); + } catch (e) { + scrollObj = undefined; } - let scrollObj; - if (response.data.ial.scroll) { - try { - scrollObj = JSON.parse(response.data.ial.scroll.replace(/"/g, '"')); - } catch (e) { - scrollObj = undefined; + } + if (scrollObj) { + scrollObj.rootId = response.data.rootID; + getDocByScroll({ + protyle: this.protyle, + scrollAttr: scrollObj, + mergedOptions, + cb: () => { + this.afterOnGet(mergedOptions); } - } - if (scrollObj) { - scrollObj.rootId = response.data.rootID; - getDocByScroll({ - protyle: this.protyle, - scrollAttr: scrollObj, - mergedOptions, - cb: () => { - this.afterOnGet(mergedOptions); - } - }); - } else { - this.getDoc(mergedOptions); - } - }); - } else { - getDocByScroll({ - protyle: this.protyle, - scrollAttr: options.scrollAttr, - mergedOptions, - cb: () => { - this.afterOnGet(mergedOptions); - } - }); - } + }); + } else { + this.getDoc(mergedOptions); + } + }); } else { this.getDoc(mergedOptions); } diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index bb893db50..16a1ff3b1 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -259,6 +259,7 @@ const setHTML = (options: { } // 屏幕太高的页签 https://github.com/siyuan-note/siyuan/issues/5018 if (!protyle.scroll.element.classList.contains("fn__none") && + !protyle.element.classList.contains("block__edit") && // 不能为浮窗,否则悬浮为根文档无法打开整个文档 https://github.com/siyuan-note/siyuan/issues/9082 protyle.wysiwyg.element.lastElementChild.getAttribute("data-eof") !== "2" && protyle.contentElement.scrollHeight > 0 && // 没有激活的页签 https://github.com/siyuan-note/siyuan/issues/5255 !options.action.includes(Constants.CB_GET_FOCUSFIRST) && // 防止 eof 为true https://github.com/siyuan-note/siyuan/issues/5291 diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 4b63ac309..bd2815425 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1699,7 +1699,7 @@ export class WYSIWYG { app: protyle.app, id: refBlockId, position: "bottom", - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: foldResponse.data }); } else if (event.altKey) { @@ -1707,14 +1707,14 @@ export class WYSIWYG { app: protyle.app, id: refBlockId, position: "right", - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: foldResponse.data }); } else if (ctrlIsPressed) { openFileById({ app: protyle.app, id: refBlockId, - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], keepCursor: true, zoomIn: foldResponse.data }); @@ -1722,7 +1722,7 @@ export class WYSIWYG { openFileById({ app: protyle.app, id: refBlockId, - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: foldResponse.data }); } diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index c57478569..2191f7236 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -1641,7 +1641,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { openFileById({ app: protyle.app, id, - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: foldResponse.data }); }); @@ -1654,7 +1654,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { openFileById({ app: protyle.app, id, - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], keepCursor: true, zoomIn: foldResponse.data }); @@ -1668,7 +1668,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { app: protyle.app, id, position: "right", - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: foldResponse.data }); }); @@ -1681,7 +1681,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { app: protyle.app, id, position: "bottom", - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], zoomIn: foldResponse.data }); }); diff --git a/app/src/search/util.ts b/app/src/search/util.ts index 4ee2d2545..b0b3cbfd8 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -739,7 +739,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo let isClick = event.detail === 1 let isDblClick = event.detail === 2 /// #if BROWSER - const newDate = new Date().getTime() + const newDate = new Date().getTime() isClick = newDate - lastClickTime > Constants.TIMEOUT_DBLCLICK isDblClick = !isClick; lastClickTime = newDate; @@ -763,7 +763,8 @@ 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_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : + (id === target.getAttribute("data-root-id") ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ROOTSCROLL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]), zoomIn: foldResponse.data, position: "right" }); @@ -803,7 +804,8 @@ 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_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : + (id === target.getAttribute("data-root-id") ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ROOTSCROLL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]), zoomIn: foldResponse.data }); if (closeCB) { @@ -862,7 +864,8 @@ 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_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : + (id === target.getAttribute("data-root-id") ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ROOTSCROLL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]), zoomIn: foldResponse.data }); if (closeCB) { @@ -891,7 +894,8 @@ 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_CONTEXT], + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : + (id === target.getAttribute("data-root-id") ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ROOTSCROLL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]), zoomIn: foldResponse.data }); if (closeCB) {