This commit is contained in:
parent
7e8c1b39d7
commit
9e51621c68
12 changed files with 45 additions and 23 deletions
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"revisionCount": "Number of revisions",
|
||||
"flashcardNewCardLimit": "New Card Limit",
|
||||
"flashcardNewCardLimitTip": "If there are many new cards, you can set the number of new cards to review through this item",
|
||||
"flashcardReviewCardLimit": "Review Card Limit",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"revisionCount": "Número de revisiones",
|
||||
"flashcardNewCardLimit": "Límite de tarjeta nueva",
|
||||
"flashcardNewCardLimitTip": "Si hay muchas tarjetas nuevas, puede establecer la cantidad de tarjetas nuevas para revisar a través de este elemento",
|
||||
"flashcardReviewCardLimit": "Revisar límite de tarjeta",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"revisionCount": "Nombre de révisions",
|
||||
"flashcardNewCardLimit": "Nouvelle limite de carte",
|
||||
"flashcardNewCardLimitTip": "S'il y a beaucoup de nouvelles cartes, vous pouvez définir le nombre de nouvelles cartes à examiner via cet élément",
|
||||
"flashcardReviewCardLimit": "Revoir la limite de la carte",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"revisionCount": "複習次數",
|
||||
"flashcardNewCardLimit": "新卡上限",
|
||||
"flashcardNewCardLimitTip": "如果新卡較多,可以通過該項設置新卡複習的數量",
|
||||
"flashcardReviewCardLimit": "復習卡上限",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"revisionCount": "复习次数",
|
||||
"flashcardNewCardLimit": "新卡上限",
|
||||
"flashcardNewCardLimitTip": "如果新卡较多,可以通过该项设置新卡复习的数量",
|
||||
"flashcardReviewCardLimit": "复习卡上限",
|
||||
|
|
|
@ -362,10 +362,6 @@ html {
|
|||
opacity: .38;
|
||||
}
|
||||
|
||||
.block__icons .block__icon[disabled] {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
&__close {
|
||||
min-height: auto;
|
||||
transition: var(--b3-transition);
|
||||
|
|
|
@ -141,10 +141,14 @@
|
|||
background-color: var(--b3-theme-surface);
|
||||
}
|
||||
|
||||
&:hover .block__icon {
|
||||
&:hover .block__icon:not([disabled]) {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&:hover [disabled].block__icon {
|
||||
opacity: .38;
|
||||
}
|
||||
|
||||
.counter {
|
||||
background-color: var(--b3-theme-background);
|
||||
}
|
||||
|
@ -169,13 +173,14 @@
|
|||
background-color: var(--b3-list-icon-hover);
|
||||
}
|
||||
|
||||
&[disabled] {
|
||||
opacity: 0.38;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&--show {
|
||||
opacity: 1;
|
||||
|
||||
&.block__icon[disabled] {
|
||||
opacity: 0.38;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
svg {
|
||||
|
|
|
@ -124,7 +124,7 @@ export const makeCard = (ids: string[]) => {
|
|||
event.preventDefault();
|
||||
break;
|
||||
} else if (type === "view") {
|
||||
viewCards(target.parentElement.getAttribute("data-id"), escapeHtml(target.parentElement.getAttribute("data-name")),"", (removeResponse) => {
|
||||
viewCards(target.parentElement.getAttribute("data-id"), target.parentElement.getAttribute("data-name"), "", (removeResponse) => {
|
||||
target.parentElement.outerHTML = genCardItem(removeResponse.data);
|
||||
});
|
||||
event.stopPropagation();
|
||||
|
|
|
@ -2,7 +2,7 @@ import {Protyle} from "../protyle";
|
|||
import {fetchPost} from "../util/fetch";
|
||||
import {Dialog} from "../dialog";
|
||||
import {isMobile} from "../util/functions";
|
||||
import {escapeHtml} from "../util/escape";
|
||||
import {escapeAttr, escapeHtml} from "../util/escape";
|
||||
import {getDisplayName, getNotebookName} from "../util/pathName";
|
||||
import {getIconByType} from "../editor/getIcon";
|
||||
import {unicode2Emoji} from "../emoji";
|
||||
|
@ -19,8 +19,8 @@ export const viewCards = (deckID: string, title: string, deckType: "Tree" | "" |
|
|||
}, (response) => {
|
||||
const dialog = new Dialog({
|
||||
content: `<div class="fn__flex-column" style="height: 100%">
|
||||
<div class="fn__flex b3-form__space--small">
|
||||
<span class="fn__flex-center">${title}</span>
|
||||
<div class="block__icons">
|
||||
<span class="fn__flex-center">${escapeHtml(title)}</span>
|
||||
<div class="fn__flex-1"></div>
|
||||
<span class="fn__space"></span>
|
||||
<span data-type="previous" class="block__icon block__icon--show b3-tooltips b3-tooltips__ne" disabled="disabled" aria-label="${window.siyuan.languages.previousLabel}"><svg><use xlink:href='#iconLeft'></use></svg></span>
|
||||
|
@ -28,10 +28,12 @@ export const viewCards = (deckID: string, title: string, deckType: "Tree" | "" |
|
|||
<span data-type="next" class="block__icon block__icon--show b3-tooltips b3-tooltips__ne" disabled="disabled" aria-label="${window.siyuan.languages.nextLabel}"><svg><use xlink:href='#iconRight'></use></svg></span>
|
||||
<span class="fn__space"></span>
|
||||
<span class="fn__flex-center ft__on-surface">${pageIndex}/${response.data.pageCount || 1}</span>
|
||||
<span class="fn__space"></span>
|
||||
<span class="counter">${response.data.total}</span>
|
||||
</div>
|
||||
<div class="${isMobile() ? "fn__flex-column" : "fn__flex"} fn__flex-1" style="min-height: auto">
|
||||
<ul class="fn__flex-1 b3-list b3-list--background" style="user-select: none">
|
||||
${renderViewItem(response.data.blocks)}
|
||||
${renderViewItem(response.data.blocks, title, deckType)}
|
||||
</ul>
|
||||
<div id="cardPreview" class="fn__flex-1 fn__none"></div>
|
||||
<div class="fn__flex-1 card__empty">${window.siyuan.languages.emptyContent}</div>
|
||||
|
@ -85,7 +87,7 @@ export const viewCards = (deckID: string, title: string, deckType: "Tree" | "" |
|
|||
nextElement.removeAttribute("disabled");
|
||||
}
|
||||
nextElement.nextElementSibling.nextElementSibling.textContent = `${pageIndex}/${cardsResponse.data.pageCount || 1}`;
|
||||
listElement.innerHTML = renderViewItem(cardsResponse.data.blocks);
|
||||
listElement.innerHTML = renderViewItem(cardsResponse.data.blocks, title, deckType);
|
||||
getArticle(edit, dialog.element.querySelector(".b3-list-item--focus")?.getAttribute("data-id"));
|
||||
});
|
||||
event.stopPropagation();
|
||||
|
@ -104,7 +106,7 @@ export const viewCards = (deckID: string, title: string, deckType: "Tree" | "" |
|
|||
nextElement.removeAttribute("disabled");
|
||||
}
|
||||
nextElement.nextElementSibling.nextElementSibling.textContent = `${pageIndex}/${cardsResponse.data.pageCount || 1}`;
|
||||
listElement.innerHTML = renderViewItem(cardsResponse.data.blocks);
|
||||
listElement.innerHTML = renderViewItem(cardsResponse.data.blocks, title, deckType);
|
||||
getArticle(edit, dialog.element.querySelector(".b3-list-item--focus")?.getAttribute("data-id"));
|
||||
});
|
||||
event.stopPropagation();
|
||||
|
@ -154,20 +156,28 @@ export const viewCards = (deckID: string, title: string, deckType: "Tree" | "" |
|
|||
};
|
||||
|
||||
|
||||
const renderViewItem = (blocks: IBlock[]) => {
|
||||
const renderViewItem = (blocks: IBlock[], title: string, deckType: string) => {
|
||||
let listHTML = "";
|
||||
let isFirst = true;
|
||||
const pathArray = title.split("/");
|
||||
pathArray.splice(0, 1);
|
||||
blocks.forEach((item: IBlock) => {
|
||||
if (item.type) {
|
||||
const hPath = escapeHtml(getNotebookName(item.box)) + getDisplayName(item.hPath, false);
|
||||
let hPath
|
||||
if (deckType === "") {
|
||||
hPath = getNotebookName(item.box) + getDisplayName(Lute.UnEscapeHTMLStr(item.hPath), false);
|
||||
} else {
|
||||
hPath = getDisplayName(Lute.UnEscapeHTMLStr(item.hPath), false).replace("/" + pathArray.join("/"), "");
|
||||
}
|
||||
listHTML += `<div data-type="card-item" class="b3-list-item${isFirst ? " b3-list-item--focus" : ""}${isMobile() ? "" : " b3-list-item--hide-action"}" data-id="${item.id}">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#${getIconByType(item.type)}"></use></svg>
|
||||
${unicode2Emoji(item.ial.icon, false, "b3-list-item__graphic", true)}
|
||||
<span class="b3-list-item__text">${item.content}</span>
|
||||
<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}">
|
||||
<svg><use xlink:href="#iconTrashcan"></use></svg>
|
||||
</span>
|
||||
<span class="${isMobile() ? "fn__none " : ""}b3-list-item__meta b3-list-item__meta--ellipsis" title="${hPath}">${hPath}</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.revisionCount}" class="b3-tooltips b3-tooltips__w counter${item.riffCardReps === 0 ? " fn__none" : ""}">${item.riffCardReps}</span>
|
||||
</div>`;
|
||||
isFirst = false;
|
||||
} else {
|
||||
|
|
|
@ -137,7 +137,7 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
|
|||
iconHTML: Constants.ZWSP,
|
||||
label: window.siyuan.languages.mgmt,
|
||||
click: () => {
|
||||
viewCards(notebookId, escapeHtml(name), "Notebook");
|
||||
viewCards(notebookId, name, "Notebook");
|
||||
/// #if MOBILE
|
||||
closePanel();
|
||||
/// #endif
|
||||
|
@ -346,7 +346,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
|
|||
iconHTML: Constants.ZWSP,
|
||||
label: window.siyuan.languages.mgmt,
|
||||
click: () => {
|
||||
viewCards(id, name, "Tree");
|
||||
viewCards(id, pathPosix().join(getNotebookName(notebookId), name), "Tree");
|
||||
/// #if MOBILE
|
||||
closePanel();
|
||||
/// #endif
|
||||
|
|
|
@ -36,6 +36,7 @@ import {transferBlockRef} from "../../menus/block";
|
|||
import {openCardByData} from "../../card/openCard";
|
||||
import {makeCard, quickMakeCard} from "../../card/makeCard";
|
||||
import {viewCards} from "../../card/viewCards";
|
||||
import {getNotebookName, pathPosix} from "../../util/pathName";
|
||||
|
||||
export class Title {
|
||||
public element: HTMLElement;
|
||||
|
@ -379,7 +380,11 @@ export class Title {
|
|||
iconHTML: Constants.ZWSP,
|
||||
label: window.siyuan.languages.mgmt,
|
||||
click: () => {
|
||||
viewCards(protyle.block.rootID, escapeHtml(this.editElement.textContent), "Tree");
|
||||
fetchPost("/api/filetree/getHPathByID", {
|
||||
id: protyle.block.rootID
|
||||
}, (response) => {
|
||||
viewCards(protyle.block.rootID, pathPosix().join(getNotebookName(protyle.notebookId), (response.data)), "Tree");
|
||||
});
|
||||
}
|
||||
}, {
|
||||
iconHTML: Constants.ZWSP,
|
||||
|
|
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
@ -608,6 +608,7 @@ declare interface IBlockTree {
|
|||
}
|
||||
|
||||
declare interface IBlock {
|
||||
riffCardReps? :number // 闪卡复习次数
|
||||
depth?: number,
|
||||
box?: string;
|
||||
path?: string;
|
||||
|
|
Loading…
Add table
Reference in a new issue