From bf1172b05ecd75f36d2062309986b9084e63b403 Mon Sep 17 00:00:00 2001 From: Achuan-2 Date: Thu, 2 Oct 2025 17:17:12 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(search):=20=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=96=87=E6=A1=A3=E6=A0=87=E9=A2=98=20(#1596?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在搜索功能中新增标题渲染选项 - 更新相关的渲染配置 --- app/src/protyle/util/onGet.ts | 11 +++++++++++ app/src/search/util.ts | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index beedd4fe5..9528eb0f4 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -91,6 +91,17 @@ export const onGet = (options: { isSyncing: options.data.data.isSyncing, afterCB: options.afterCB, }, options.protyle); + + // 如果需要渲染标题且包含 CB_GET_HTML,需要获取文档信息来更新标题 + if (options.protyle.options.render.title && options.action.includes(Constants.CB_GET_HTML)) { + fetchPost("/api/block/getDocInfo", { + id: options.protyle.block.rootID + }, (response) => { + options.protyle.title.element.removeAttribute("data-render"); + options.protyle.title.render(options.protyle, response); + }); + } + removeLoading(options.protyle); return; } diff --git a/app/src/search/util.ts b/app/src/search/util.ts index 9d7e46d39..664d9ee30 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -239,7 +239,8 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele blockId: "", render: { gutter: true, - breadcrumbDocName: true + breadcrumbDocName: true, + title: true }, }); edit.resize(); @@ -247,7 +248,8 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele blockId: "", render: { gutter: true, - breadcrumbDocName: true + breadcrumbDocName: true, + title: true }, }); unRefEdit.resize();