This commit is contained in:
Vanessa 2022-10-03 16:22:18 +08:00
parent 436f439dd1
commit c8ab7693f1
11 changed files with 58 additions and 60 deletions

View file

@ -157,7 +157,7 @@ export class Backlink extends Model {
this.mTree = new Tree({
element: this.element.querySelector(".backlinkMList") as HTMLElement,
data: null,
click: (element, event) => {
click: (element) => {
this.toggleItem(element, true);
},
ctrlClick(element) {
@ -283,7 +283,7 @@ export class Backlink extends Model {
private toggleItem(liElement: HTMLElement, isMention: boolean) {
const svgElement = liElement.firstElementChild.firstElementChild;
const docId = liElement.getAttribute("data-node-id")
const docId = liElement.getAttribute("data-node-id");
if (svgElement.classList.contains("b3-list-item__arrow--open")) {
svgElement.classList.remove("b3-list-item__arrow--open");
this.editors.find((item, index) => {
@ -302,8 +302,8 @@ export class Backlink extends Model {
}, (response) => {
const editorElement = document.createElement("div");
editorElement.style.minHeight = "auto";
editorElement.setAttribute("data-defid", this.blockId)
editorElement.setAttribute("data-ismention", isMention? "true" : "false")
editorElement.setAttribute("data-defid", this.blockId);
editorElement.setAttribute("data-ismention", isMention? "true" : "false");
liElement.after(editorElement);
const editor = new Protyle(editorElement, {
blockId: "",
@ -316,7 +316,7 @@ export class Backlink extends Model {
breadcrumb: false,
}
});
editor.protyle.block.rootID = docId
editor.protyle.block.rootID = docId;
this.editors.push(editor);
});
}

View file

@ -162,15 +162,15 @@ export const countBlockWord = (ids: string[]) => {
export const renderStatusbarCounter = (stat: { runeCount: number, wordCount: number, linkCount: number, imageCount: number, refCount: number }) => {
let html = `<span class="ft__on-surface">${window.siyuan.languages.runeCount}</span>&nbsp;${stat.runeCount}<span class="fn__space"></span>
<span class="ft__on-surface">${window.siyuan.languages.wordCount}</span>&nbsp;${stat.wordCount}<span class="fn__space"></span>`
<span class="ft__on-surface">${window.siyuan.languages.wordCount}</span>&nbsp;${stat.wordCount}<span class="fn__space"></span>`;
if (0 < stat.linkCount) {
html += `<span class="ft__on-surface">${window.siyuan.languages.link}</span>&nbsp;${stat.linkCount}<span class="fn__space"></span>`
html += `<span class="ft__on-surface">${window.siyuan.languages.link}</span>&nbsp;${stat.linkCount}<span class="fn__space"></span>`;
}
if (0 < stat.imageCount) {
html += `<span class="ft__on-surface">${window.siyuan.languages.image}</span>&nbsp;${stat.imageCount}<span class="fn__space"></span>`
html += `<span class="ft__on-surface">${window.siyuan.languages.image}</span>&nbsp;${stat.imageCount}<span class="fn__space"></span>`;
}
if (0 < stat.refCount) {
html += `<span class="ft__on-surface">${window.siyuan.languages.ref}</span>&nbsp;${stat.refCount}<span class="fn__space"></span>`
html += `<span class="ft__on-surface">${window.siyuan.languages.ref}</span>&nbsp;${stat.refCount}<span class="fn__space"></span>`;
}
document.querySelector("#status .status__counter").innerHTML = html;
}
};