Skip to content

Commit

Permalink
🎨 #9564
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Nov 16, 2023
1 parent 04bb964 commit 2651609
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions app/src/card/viewCards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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>`;
Expand Down

0 comments on commit 2651609

Please sign in to comment.