|
|
|
@@ -11,6 +11,7 @@ import {addLoading} from "../protyle/ui/initUI";
|
|
|
|
|
import {Constants} from "../constants";
|
|
|
|
|
import {onGet} from "../protyle/util/onGet";
|
|
|
|
|
import {App} from "../index";
|
|
|
|
|
import {confirmDialog} from "../dialog/confirmDialog";
|
|
|
|
|
|
|
|
|
|
export const viewCards = (app: App, deckID: string, title: string, deckType: "Tree" | "" | "Notebook", cb?: (response: IWebSocketData) => void) => {
|
|
|
|
|
let pageIndex = 1;
|
|
|
|
@@ -24,7 +25,7 @@ export const viewCards = (app: App, deckID: string, title: string, deckType: "Tr
|
|
|
|
|
<div class="block__icons">
|
|
|
|
|
<span class="fn__flex-1 fn__flex-center resize__move">${escapeHtml(title)}</span>
|
|
|
|
|
<span class="fn__space"></span>
|
|
|
|
|
<span data-type="resetAll" class="block__icon block__icon--show b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.reset}"><svg><use xlink:href='#iconUndo'></use></svg></span>
|
|
|
|
|
<span data-type="resetAll" class="block__icon block__icon--show b3-tooltips b3-tooltips__w${(deckType === "" && deckID === "") ? " fn__none" : ""}" aria-label="${window.siyuan.languages.reset}"><svg><use xlink:href='#iconUndo'></use></svg></span>
|
|
|
|
|
<span class="fn__space"></span>
|
|
|
|
|
<span data-type="previous" class="block__icon block__icon--show b3-tooltips b3-tooltips__w" disabled="disabled" aria-label="${window.siyuan.languages.previousLabel}"><svg><use xlink:href='#iconLeft'></use></svg></span>
|
|
|
|
|
<span class="fn__space"></span>
|
|
|
|
@@ -156,18 +157,25 @@ export const viewCards = (app: App, deckID: string, title: string, deckType: "Tr
|
|
|
|
|
deckID: deckType === "" ? deckID : Constants.QUICK_DECK_ID,
|
|
|
|
|
id: deckID,
|
|
|
|
|
blockIDs: [target.getAttribute("data-id")],
|
|
|
|
|
}, (removeResponse) => {
|
|
|
|
|
|
|
|
|
|
}, () => {
|
|
|
|
|
target.parentElement.querySelector(".ariaLabel.b3-list-item__meta").textContent = dayjs().format("YYYY-MM-DD")
|
|
|
|
|
});
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
break;
|
|
|
|
|
} else if (type === "resetAll") {
|
|
|
|
|
fetchPost("/api/riff/resetRiffCards", {
|
|
|
|
|
deckID: deckType === "" ? deckID : Constants.QUICK_DECK_ID,
|
|
|
|
|
}, (removeResponse) => {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
confirmDialog(window.siyuan.languages.reset,
|
|
|
|
|
window.siyuan.languages.resetCardTip.replace("${x}", dialog.element.querySelector(".counter").textContent), () => {
|
|
|
|
|
fetchPost("/api/riff/resetRiffCards", {
|
|
|
|
|
type: deckType === "" ? "deck" : deckType.toLowerCase(),
|
|
|
|
|
deckID: deckType === "" ? deckID : Constants.QUICK_DECK_ID,
|
|
|
|
|
id: deckID,
|
|
|
|
|
}, () => {
|
|
|
|
|
dialog.element.querySelectorAll(".ariaLabel.b3-list-item__meta").forEach(item => {
|
|
|
|
|
item.textContent = dayjs().format("YYYY-MM-DD")
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
break;
|
|
|
|
@@ -238,12 +246,12 @@ const renderViewItem = (blocks: IBlock[], title: string, deckType: string) => {
|
|
|
|
|
${unicode2Emoji(item.ial.icon, "b3-list-item__graphic", true)}
|
|
|
|
|
<span class="b3-list-item__text">${item.content || Constants.ZWSP}</span>
|
|
|
|
|
<span class="${(isMobile() || !hPath) ? "fn__none " : ""}b3-list-item__meta b3-list-item__meta--ellipsis" title="${escapeAttr(hPath)}">${escapeHtml(hPath)}</span>
|
|
|
|
|
<span aria-label="${window.siyuan.languages.nextDue}" class="ariaLabel b3-list-item__meta${!item.riffCard?.due ? " fn__none" : ""}">${dayjs(item.riffCard?.due).format("YYYY-MM-DD")}</span>
|
|
|
|
|
<span aria-label="${window.siyuan.languages.revisionCount}" class="ariaLabel counter${item.riffCard?.reps === 0 ? " fn__none" : ""}">${item.riffCard?.reps}</span>
|
|
|
|
|
<span data-type="reset" data-id="${item.id}" class="b3-list-item__action ariaLabel" aria-label="${window.siyuan.languages.reset}">
|
|
|
|
|
<span data-position="parentE" aria-label="${window.siyuan.languages.revisionCount}" class="ariaLabel counter${item.riffCard?.reps === 0 ? " fn__none" : ""}">${item.riffCard?.reps}</span>
|
|
|
|
|
<span data-position="parentE" aria-label="${window.siyuan.languages.nextDue}" class="ariaLabel b3-list-item__meta${!item.riffCard?.due ? " fn__none" : ""}">${dayjs(item.riffCard?.due).format("YYYY-MM-DD")}</span>
|
|
|
|
|
<span data-position="parentE" data-type="reset" data-id="${item.id}" class="b3-list-item__action ariaLabel" aria-label="${window.siyuan.languages.reset}">
|
|
|
|
|
<svg><use xlink:href="#iconUndo"></use></svg>
|
|
|
|
|
</span>
|
|
|
|
|
<span data-type="remove" data-id="${item.id}" class="b3-list-item__action ariaLabel" aria-label="${window.siyuan.languages.removeDeck}">
|
|
|
|
|
<span data-position="parentE" data-type="remove" data-id="${item.id}" class="b3-list-item__action ariaLabel" aria-label="${window.siyuan.languages.removeDeck}">
|
|
|
|
|
<svg><use xlink:href="#iconTrashcan"></use></svg>
|
|
|
|
|
</span>
|
|
|
|
|
</div>`;
|
|
|
|
@@ -252,7 +260,7 @@ ${unicode2Emoji(item.ial.icon, "b3-list-item__graphic", true)}
|
|
|
|
|
// 块被删除的情况
|
|
|
|
|
listHTML += `<div data-type="card-item" class="b3-list-item${isMobile() ? "" : " b3-list-item--hide-action"}">
|
|
|
|
|
<span class="b3-list-item__text">${item.content}</span>
|
|
|
|
|
<span data-type="remove" data-id="${item.id}" class="b3-list-item__action ariaLabel" aria-label="${window.siyuan.languages.removeDeck}">
|
|
|
|
|
<span data-position="parentE" data-type="remove" data-id="${item.id}" class="b3-list-item__action ariaLabel" aria-label="${window.siyuan.languages.removeDeck}">
|
|
|
|
|
<svg><use xlink:href="#iconTrashcan"></use></svg>
|
|
|
|
|
</span>
|
|
|
|
|
</div>`;
|
|
|
|
|