Vanessa 2023-11-16 23:10:29 +08:00
parent 04bb9642f3
commit 265160969c

View file

@ -24,6 +24,8 @@ 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 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>
<span data-type="next" class="block__icon block__icon--show b3-tooltips b3-tooltips__w" disabled="disabled" aria-label="${window.siyuan.languages.nextLabel}"><svg><use xlink:href='#iconRight'></use></svg></span>
@ -148,6 +150,27 @@ export const viewCards = (app: App, deckID: string, title: string, deckType: "Tr
event.stopPropagation();
event.preventDefault();
break;
} else if (type === "reset") {
fetchPost("/api/riff/resetRiffCards", {
type: deckType === "" ? "deck" : deckType.toLowerCase(),
deckID: deckType === "" ? deckID : Constants.QUICK_DECK_ID,
id: deckID,
blockIDs: [target.getAttribute("data-id")],
}, (removeResponse) => {
});
event.stopPropagation();
event.preventDefault();
break;
} else if (type === "resetAll") {
fetchPost("/api/riff/resetRiffCards", {
deckID: deckType === "" ? deckID : Constants.QUICK_DECK_ID,
}, (removeResponse) => {
});
event.stopPropagation();
event.preventDefault();
break;
} else if (type === "card-item") {
getArticle(edit, target.getAttribute("data-id"));
listElement.querySelector(".b3-list-item--focus")?.classList.remove("b3-list-item--focus");
@ -214,19 +237,22 @@ const renderViewItem = (blocks: IBlock[], title: string, deckType: string) => {
<svg class="b3-list-item__graphic"><use xlink:href="#${getIconByType(item.type)}"></use></svg>
${unicode2Emoji(item.ial.icon, "b3-list-item__graphic", true)}
<span class="b3-list-item__text">${item.content || Constants.ZWSP}</span>
<span data-type="remove" data-id="${item.id}" class="b3-list-item__action b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.removeDeck}">
<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}">
<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}">
<svg><use xlink:href="#iconTrashcan"></use></svg>
</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="b3-tooltips b3-tooltips__w 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="b3-tooltips b3-tooltips__w counter${item.riffCard?.reps === 0 ? " fn__none" : ""}">${item.riffCard?.reps}</span>
</div>`;
isFirst = false;
} else {
// 块被删除的情况
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 b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.removeDeck}">
<span 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>`;