mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-05 04:10:16 +01:00
🚨
This commit is contained in:
parent
0014c8b5f3
commit
d1e67e055b
5 changed files with 36 additions and 36 deletions
|
|
@ -158,8 +158,8 @@ class Protyle {
|
|||
});
|
||||
setPadding(this.protyle);
|
||||
if (options.backlinkData) {
|
||||
renderBacklink(this.protyle, options.backlinkData)
|
||||
return
|
||||
renderBacklink(this.protyle, options.backlinkData);
|
||||
return;
|
||||
}
|
||||
fetchPost("/api/filetree/getDoc", {
|
||||
id: options.blockId,
|
||||
|
|
|
|||
|
|
@ -1374,10 +1374,10 @@ export class WYSIWYG {
|
|||
let shiftStartElement: HTMLElement;
|
||||
this.element.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {
|
||||
hideElements(["hint", "util"], protyle);
|
||||
const backlinkBreadcrumbItemElement = hasClosestByClassName(event.target, "protyle-breadcrumb__item")
|
||||
const backlinkBreadcrumbItemElement = hasClosestByClassName(event.target, "protyle-breadcrumb__item");
|
||||
if (backlinkBreadcrumbItemElement) {
|
||||
loadBreadcrumb(backlinkBreadcrumbItemElement);
|
||||
event.stopPropagation()
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
if (!window.siyuan.shiftIsPressed) {
|
||||
|
|
|
|||
|
|
@ -7,25 +7,25 @@ export const renderBacklink = (protyle: IProtyle, backlinkData: {
|
|||
blockPaths: IBreadcrumb[],
|
||||
dom: string
|
||||
}[]) => {
|
||||
protyle.block.showAll = true
|
||||
let html = ""
|
||||
protyle.block.showAll = true;
|
||||
let html = "";
|
||||
backlinkData.forEach(item => {
|
||||
html += genBreadcrumb(item.blockPaths) + item.dom
|
||||
html += genBreadcrumb(item.blockPaths) + item.dom;
|
||||
});
|
||||
protyle.wysiwyg.element.innerHTML = html
|
||||
protyle.wysiwyg.element.innerHTML = html;
|
||||
removeLoading(protyle);
|
||||
}
|
||||
};
|
||||
|
||||
export const loadBreadcrumb = (element: HTMLElement) => {
|
||||
if (element.classList.contains("protyle-breadcrumb__item--active")) {
|
||||
return;
|
||||
}
|
||||
element.parentElement.querySelector(".protyle-breadcrumb__item--active").classList.remove("protyle-breadcrumb__item--active")
|
||||
element.classList.add("protyle-breadcrumb__item--active")
|
||||
let nextElement = element.parentElement.nextElementSibling
|
||||
element.parentElement.querySelector(".protyle-breadcrumb__item--active").classList.remove("protyle-breadcrumb__item--active");
|
||||
element.classList.add("protyle-breadcrumb__item--active");
|
||||
let nextElement = element.parentElement.nextElementSibling;
|
||||
while (nextElement && !nextElement.classList.contains("protyle-breadcrumb__bar")) {
|
||||
const tempElement = nextElement
|
||||
nextElement = nextElement.nextElementSibling
|
||||
const tempElement = nextElement;
|
||||
nextElement = nextElement.nextElementSibling;
|
||||
tempElement.remove();
|
||||
}
|
||||
fetchPost("/api/filetree/getDoc", {
|
||||
|
|
@ -33,11 +33,11 @@ export const loadBreadcrumb = (element: HTMLElement) => {
|
|||
size: Constants.SIZE_GET_MAX,
|
||||
}, getResponse => {
|
||||
element.parentElement.insertAdjacentHTML("afterend", getResponse.data.content);
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const genBreadcrumb = (blockPaths: IBreadcrumb[]) => {
|
||||
let html = ''
|
||||
let html = "";
|
||||
blockPaths.forEach((item, index) => {
|
||||
if (index === 0) {
|
||||
return;
|
||||
|
|
@ -49,6 +49,6 @@ const genBreadcrumb = (blockPaths: IBreadcrumb[]) => {
|
|||
if (index !== blockPaths.length - 1) {
|
||||
html += '<svg class="protyle-breadcrumb__arrow"><use xlink:href="#iconRight"></use></svg>';
|
||||
}
|
||||
})
|
||||
});
|
||||
return `<div contenteditable="false" class="protyle-breadcrumb__bar protyle-breadcrumb__bar--nowrap">${html}</div>`;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue