Vanessa 2023-02-19 00:05:38 +08:00
parent 83777a14ed
commit a2dba45103
12 changed files with 228 additions and 163 deletions

View file

@ -7,7 +7,7 @@ import {confirmDialog} from "../dialog/confirmDialog";
import {hideElements} from "../protyle/ui/hideElements";
import {viewCards} from "./viewCards";
export const genCardItem = (item: ICard) => {
export const genCardItem = (item: ICardPackage) => {
return `<li data-id="${item.id}" class="b3-list-item b3-list-item--narrow${isMobile() ? "" : " b3-list-item--hide-action"}">
<span class="b3-list-item__text">${item.name}</span>
<span class="counter b3-tooltips b3-tooltips__w${isMobile() ? "" : " fn__none"}" aria-label="${window.siyuan.languages.riffCard}">${item.size}</span>
@ -48,7 +48,7 @@ export const makeCard = (nodeElement: Element[]) => {
}
ids.push(item.getAttribute("data-node-id"));
});
response.data.forEach((item: ICard) => {
response.data.forEach((item: ICardPackage) => {
html += genCardItem(item);
});
const dialog = new Dialog({
@ -170,5 +170,19 @@ export const makeCard = (nodeElement: Element[]) => {
});
};
export const quickMakeCard = (nodeElement: Element[]) => {
const ids: string[] = [];
nodeElement.forEach(item => {
if (item.getAttribute("data-type") === "NodeThematicBreak") {
return;
}
ids.push(item.getAttribute("data-node-id"));
});
fetchPost("/api/riff/addRiffCards", {
deckID: "20230218211946-2kw8jgx",
blockIDs: ids
});
}