${data.shorthandTitle}
${linkHTML}
@@ -205,20 +219,39 @@ ${(Lute.New()).MarkdownStr("", data.shorthandContent)}
/// #endif
}
- private more(event: MouseEvent) {
+ private genItemHTML(item: IInbox) {
+ return `
+
+
+
+
+ ${item.shorthandTitle}
+ ${item.hCreated}
+`
+ }
+
+ private more(event: MouseEvent, itemElement?: HTMLElement) {
const detailsElement = this.element.querySelector(".inboxDetails");
window.siyuan.menus.menu.remove();
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.refresh,
icon: "iconRefresh",
click: () => {
- if (detailsElement.classList.contains("fn__none")) {
+ if (itemElement) {
+ fetchPost("/api/inbox/getShorthand", {
+ id: itemElement.dataset.id
+ }, (response) => {
+ this.data[response.data.oId] = response.data;
+ itemElement.outerHTML = this.genItemHTML(response.data);
+ });
+ } else if (detailsElement.classList.contains("fn__none")) {
this.currentPage = 1;
this.update();
} else {
fetchPost("/api/inbox/getShorthand", {
id: detailsElement.getAttribute("data-id")
}, (response) => {
+ this.data[response.data.oId] = response.data;
detailsElement.innerHTML = this.genDetail(response.data);
detailsElement.scrollTop = 0;
});
@@ -226,7 +259,9 @@ ${(Lute.New()).MarkdownStr("", data.shorthandContent)}
}
}).element);
let ids: string[] = [];
- if (detailsElement.classList.contains("fn__none")) {
+ if (itemElement) {
+ ids = [itemElement.dataset.id];
+ } else if (detailsElement.classList.contains("fn__none")) {
ids = this.selectIds;
} else {
ids = [detailsElement.getAttribute("data-id")];
@@ -243,8 +278,14 @@ ${(Lute.New()).MarkdownStr("", data.shorthandContent)}
label: window.siyuan.languages.remove,
icon: "iconTrashcan",
click: () => {
- confirmDialog(window.siyuan.languages.deleteOpConfirm, window.siyuan.languages.confirmDelete + "?", () => {
- if (detailsElement.classList.contains("fn__none")) {
+ let removeTitle = ""
+ ids.forEach((id, index) => {
+ removeTitle += "
" + escapeHtml(this.data[id].shorthandTitle) + "" + (index === ids.length - 1 ? "" : ",")
+ })
+ confirmDialog(window.siyuan.languages.deleteOpConfirm, `${window.siyuan.languages.confirmDelete} ${removeTitle}?`, () => {
+ if (itemElement) {
+ this.remove(itemElement.dataset.id);
+ } else if (detailsElement.classList.contains("fn__none")) {
this.remove();
} else {
this.remove(detailsElement.getAttribute("data-id"));
@@ -253,7 +294,6 @@ ${(Lute.New()).MarkdownStr("", data.shorthandContent)}
}
}).element);
}
-
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY + 16});
}
@@ -287,6 +327,7 @@ ${(Lute.New()).MarkdownStr("", data.shorthandContent)}
fetchPost("/api/inbox/getShorthand", {
id: item
}, (response) => {
+ this.data[response.data.oId] = response.data;
fetchPost("/api/filetree/createDoc", {
notebook: toNotebook[0],
path: pathPosix().join(getDisplayName(toPath[0], false, true), Lute.NewNodeID() + ".sy"),
@@ -327,15 +368,7 @@ ${(Lute.New()).MarkdownStr("", data.shorthandContent)}
} else {
html = '
";
@@ -358,7 +391,7 @@ ${(Lute.New()).MarkdownStr("", data.shorthandContent)}
previousElement.removeAttribute("disabled");
}
const selectCount = this.element.lastElementChild.querySelectorAll(".b3-list-item").length;
- this.element.firstElementChild.querySelector("input").checked = this.element.lastElementChild.querySelectorAll("input:checked").length === selectCount && selectCount !== 0;
+ this.element.firstElementChild.querySelector('[data-type="selectall"] use').setAttribute("xlink:href", (this.element.lastElementChild.querySelectorAll('[*|href="#iconCheck"]').length === selectCount && selectCount !== 0) ? "#iconCheck" : "#iconUncheck");
this.element.lastElementChild.scrollTop = 0;
});
}