feat(search): 搜索显示文档标题 (#15969)

- 在搜索功能中新增标题渲染选项
- 更新相关的渲染配置
This commit is contained in:
Achuan-2 2025-10-02 17:17:12 +08:00 committed by GitHub
parent 95a2bd0a83
commit bf1172b05e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View file

@ -91,6 +91,17 @@ export const onGet = (options: {
isSyncing: options.data.data.isSyncing, isSyncing: options.data.data.isSyncing,
afterCB: options.afterCB, afterCB: options.afterCB,
}, options.protyle); }, 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); removeLoading(options.protyle);
return; return;
} }

View file

@ -239,7 +239,8 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
blockId: "", blockId: "",
render: { render: {
gutter: true, gutter: true,
breadcrumbDocName: true breadcrumbDocName: true,
title: true
}, },
}); });
edit.resize(); edit.resize();
@ -247,7 +248,8 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
blockId: "", blockId: "",
render: { render: {
gutter: true, gutter: true,
breadcrumbDocName: true breadcrumbDocName: true,
title: true
}, },
}); });
unRefEdit.resize(); unRefEdit.resize();