An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/7761
Vanessa7469380d2af3
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex 55e69dd4c4..6b0e828c35 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -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",diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex 03207892dd..158bee11f8 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -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",diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex 6f71bdb5ec..f2a3813aa4 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -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",diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex 8e007069ae..b1054f31ef 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -1,4 +1,5 @@{+ "revisionCount": "複習次數","flashcardNewCardLimit": "新卡上限","flashcardNewCardLimitTip": "如果新卡較多,可以通過該項設置新卡複習的數量","flashcardReviewCardLimit": "復習卡上限",diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex 62d9e1864f..a926c62cd6 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -1,4 +1,5 @@{+ "revisionCount": "复习次数","flashcardNewCardLimit": "新卡上限","flashcardNewCardLimitTip": "如果新卡较多,可以通过该项设置新卡复习的数量","flashcardReviewCardLimit": "复习卡上限",diff --git a/app/src/assets/scss/base.scss b/app/src/assets/scss/base.scssindex 526f23cf18..b09b00c42d 100644--- a/app/src/assets/scss/base.scss+++ b/app/src/assets/scss/base.scss@@ -362,10 +362,6 @@ html {opacity: .38;}- .block__icons .block__icon[disabled] {- opacity: 0;- }-&__close {min-height: auto;transition: var(--b3-transition);diff --git a/app/src/assets/scss/business/_block.scss b/app/src/assets/scss/business/_block.scssindex f21df3eb17..da053ff6a5 100644--- a/app/src/assets/scss/business/_block.scss+++ b/app/src/assets/scss/business/_block.scss@@ -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 {diff --git a/app/src/card/makeCard.ts b/app/src/card/makeCard.tsindex c75f8d577f..bc2b15d7c3 100644--- a/app/src/card/makeCard.ts+++ b/app/src/card/makeCard.ts@@ -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();diff --git a/app/src/card/viewCards.ts b/app/src/card/viewCards.tsindex 373ddf26dc..0f2ae296c7 100644--- a/app/src/card/viewCards.ts+++ b/app/src/card/viewCards.ts@@ -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 {diff --git a/app/src/menus/navigation.ts b/app/src/menus/navigation.tsindex 19e7042164..722f0df41f 100644--- a/app/src/menus/navigation.ts+++ b/app/src/menus/navigation.ts@@ -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 MOBILEclosePanel();/// #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 MOBILEclosePanel();/// #endifdiff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.tsindex b10fb75445..b30f96d966 100644--- a/app/src/protyle/header/Title.ts+++ b/app/src/protyle/header/Title.ts@@ -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,diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex 634d50f789..b38bcd01d3 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -608,6 +608,7 @@ declare interface IBlockTree {}declare interface IBlock {+ riffCardReps? :number // 闪卡复习次数depth?: number,box?: string;path?: string;