diff --git a/app/src/card/openCard.ts b/app/src/card/openCard.ts index bda8f8026..e6e995091 100644 --- a/app/src/card/openCard.ts +++ b/app/src/card/openCard.ts @@ -496,6 +496,11 @@ export const openCardByData = async (app: App, cardsData: ICardData, cardType: T if (lastRange) { focusByRange(lastRange); } + }, + resizeCallback(type: string) { + if (type !== "d" && type !== "t" && editor) { + editor.resize(); + } } }); (dialog.element.querySelector(".b3-dialog__scrim") as HTMLElement).style.backgroundColor = "var(--b3-theme-background)"; @@ -509,6 +514,7 @@ export const openCardByData = async (app: App, cardsData: ICardData, cardType: T cardType, dialog }); + editor.resize(); dialog.editors = { card: editor }; diff --git a/app/src/card/viewCards.ts b/app/src/card/viewCards.ts index b72717cb6..a0ff303a2 100644 --- a/app/src/card/viewCards.ts +++ b/app/src/card/viewCards.ts @@ -57,6 +57,11 @@ export const viewCards = (app: App, deckID: string, title: string, deckType: "Tr window.siyuan.mobile.popEditor = null; } } + }, + resizeCallback(type: string) { + if (type !== "d" && type !== "t" && edit) { + edit.resize(); + } } }); if (response.data.blocks.length > 0) { @@ -73,6 +78,7 @@ export const viewCards = (app: App, deckID: string, title: string, deckType: "Tr dialog.editors = { card: edit }; + edit.resize(); getArticle(edit, dialog.element.querySelector(".b3-list-item--focus")?.getAttribute("data-id")); } const previousElement = dialog.element.querySelector('[data-type="previous"]'); diff --git a/app/src/search/util.ts b/app/src/search/util.ts index a5430654c..a450011fd 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -407,6 +407,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo breadcrumbDocName: true }, }); + edit.resize(); const unRefEdit = new Protyle(app, element.querySelector("#searchUnRefPreview") as HTMLElement, { blockId: "", render: { @@ -414,6 +415,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo breadcrumbDocName: true }, }); + unRefEdit.resize(); if (closeCB) { if (data.layout === 1) { if (data.col) {