mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-31 22:08:48 +01:00
This commit is contained in:
parent
cd4764a123
commit
12c9151ab3
1 changed files with 21 additions and 0 deletions
|
|
@ -13,6 +13,8 @@ import {initTabMenu} from "../../menus/tab";
|
|||
import {getInstanceById} from "../../layout/util";
|
||||
import {Tab} from "../../layout/Tab";
|
||||
import {hideTooltip} from "../../dialog/tooltip";
|
||||
import {fetchPost} from "../../util/fetch";
|
||||
import {openFileById} from "../../editor/util";
|
||||
|
||||
export const initWindowEvent = (app: App) => {
|
||||
document.body.addEventListener("mouseleave", () => {
|
||||
|
|
@ -151,6 +153,25 @@ export const initWindowEvent = (app: App) => {
|
|||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
const backlinkBreadcrumbItemElement = hasClosestByClassName(target, "protyle-breadcrumb__item");
|
||||
if (backlinkBreadcrumbItemElement) {
|
||||
const breadcrumbId = backlinkBreadcrumbItemElement.getAttribute("data-id")||backlinkBreadcrumbItemElement.getAttribute("data-node-id");
|
||||
if (breadcrumbId) {
|
||||
fetchPost("/api/block/checkBlockFold", {id: breadcrumbId}, (foldResponse) => {
|
||||
openFileById({
|
||||
app,
|
||||
id: breadcrumbId,
|
||||
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT],
|
||||
zoomIn: foldResponse.data
|
||||
});
|
||||
window.siyuan.menus.menu.remove();
|
||||
});
|
||||
}
|
||||
event.stopImmediatePropagation();
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue