Vanessa 2025-08-09 10:43:08 +08:00
parent 36c7a99311
commit 02196ef3d1
4 changed files with 18 additions and 5 deletions

View file

@ -150,8 +150,8 @@ export const genCardHTML = (options: {
const getEditor = (id: string, protyle: IProtyle, element: Element, currentCard: ICard) => { const getEditor = (id: string, protyle: IProtyle, element: Element, currentCard: ICard) => {
fetchPost("/api/block/getDocInfo", { fetchPost("/api/block/getDocInfo", {
id, id,
}, (response) => { }, (docResponse) => {
protyle.wysiwyg.renderCustom(response.data.ial); protyle.wysiwyg.renderCustom(docResponse.data.ial);
fetchPost("/api/filetree/getDoc", { fetchPost("/api/filetree/getDoc", {
id, id,
mode: 0, mode: 0,
@ -163,6 +163,8 @@ const getEditor = (id: string, protyle: IProtyle, element: Element, currentCard:
protyle, protyle,
action: response.data.rootID === response.data.id ? [Constants.CB_GET_HTML] : [Constants.CB_GET_ALL, Constants.CB_GET_HTML], action: response.data.rootID === response.data.id ? [Constants.CB_GET_HTML] : [Constants.CB_GET_ALL, Constants.CB_GET_HTML],
afterCB: () => { afterCB: () => {
protyle.title.element.removeAttribute("data-render");
protyle.title.render(protyle, docResponse);
let hasHide = false; let hasHide = false;
if (!window.siyuan.config.flashcard.superBlock && if (!window.siyuan.config.flashcard.superBlock &&
!window.siyuan.config.flashcard.heading && !window.siyuan.config.flashcard.heading &&
@ -199,7 +201,7 @@ const getEditor = (id: string, protyle: IProtyle, element: Element, currentCard:
if (btnIndex < 2) { if (btnIndex < 2) {
return; return;
} }
element.previousElementSibling.textContent = currentCard.nextDues[btnIndex-1]; element.previousElementSibling.textContent = currentCard.nextDues[btnIndex - 1];
}); });
actionElements[1].classList.remove("fn__none"); actionElements[1].classList.remove("fn__none");
} else { } else {
@ -250,6 +252,8 @@ export const bindCardEvent = async (options: {
background: false, background: false,
gutter: true, gutter: true,
breadcrumbDocName: true, breadcrumbDocName: true,
title: true,
hideTitleOnZoom: true,
}, },
typewriterMode: false typewriterMode: false
}); });
@ -418,7 +422,7 @@ export const bindCardEvent = async (options: {
if (btnIndex < 2) { if (btnIndex < 2) {
return; return;
} }
element.previousElementSibling.textContent = currentCard.nextDues[btnIndex-1]; element.previousElementSibling.textContent = currentCard.nextDues[btnIndex - 1];
}); });
options.cardsData.unreviewedOldCardCount--; options.cardsData.unreviewedOldCardCount--;
options.cardsData.unreviewedNewCardCount++; options.cardsData.unreviewedNewCardCount++;
@ -650,7 +654,7 @@ export const bindCardEvent = async (options: {
if (btnIndex < 2) { if (btnIndex < 2) {
return; return;
} }
element.previousElementSibling.textContent = currentCard.nextDues[btnIndex-1]; element.previousElementSibling.textContent = currentCard.nextDues[btnIndex - 1];
}); });
actionElements[1].classList.remove("fn__none"); actionElements[1].classList.remove("fn__none");
emitEvent(options.app, currentCard, type); emitEvent(options.app, currentCard, type);

View file

@ -344,6 +344,13 @@ export class Title {
if (this.element.getAttribute("data-render") === "true") { if (this.element.getAttribute("data-render") === "true") {
return false; return false;
} }
if (protyle.options.render.hideTitleOnZoom) {
if (protyle.block.showAll) {
this.element.classList.add("fn__none");
} else {
this.element.classList.remove("fn__none");
}
}
this.element.setAttribute("data-node-id", protyle.block.rootID); this.element.setAttribute("data-node-id", protyle.block.rootID);
if (response.data.ial[Constants.CUSTOM_RIFF_DECKS]) { if (response.data.ial[Constants.CUSTOM_RIFF_DECKS]) {
this.element.setAttribute(Constants.CUSTOM_RIFF_DECKS, response.data.ial[Constants.CUSTOM_RIFF_DECKS]); this.element.setAttribute(Constants.CUSTOM_RIFF_DECKS, response.data.ial[Constants.CUSTOM_RIFF_DECKS]);

View file

@ -15,6 +15,7 @@ export class Options {
scroll: false, scroll: false,
breadcrumb: true, breadcrumb: true,
breadcrumbDocName: false, breadcrumbDocName: false,
hideTitleOnZoom: false,
}, },
action: [], action: [],
after: undefined, after: undefined,

View file

@ -459,6 +459,7 @@ interface IProtyleOptions {
scroll?: boolean scroll?: boolean
breadcrumb?: boolean breadcrumb?: boolean
breadcrumbDocName?: boolean breadcrumbDocName?: boolean
hideTitleOnZoom?: boolean
} }
/** 内部调试时使用 */ /** 内部调试时使用 */
_lutePath?: string; _lutePath?: string;