Vanessa 2025-10-02 18:02:13 +08:00
parent bf1172b05e
commit 41b14025b4
5 changed files with 4 additions and 21 deletions

View file

@ -161,10 +161,8 @@ const getEditor = (id: string, protyle: IProtyle, element: Element, currentCard:
updateReadonly: true,
data: response,
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_ALL],
afterCB: () => {
protyle.title.element.removeAttribute("data-render");
protyle.title.render(protyle, docResponse);
let hasHide = false;
if (!window.siyuan.config.flashcard.superBlock &&
!window.siyuan.config.flashcard.heading &&

View file

@ -313,11 +313,7 @@ const getArticle = (edit: Protyle, id: string) => {
updateReadonly: true,
data: getResponse,
protyle: edit.protyle,
action: getResponse.data.rootID === getResponse.data.id ? [Constants.CB_GET_HTML] : [Constants.CB_GET_ALL, Constants.CB_GET_HTML],
afterCB() {
edit.protyle.title.element.removeAttribute("data-render");
edit.protyle.title.render(edit.protyle, response);
}
action: getResponse.data.rootID === getResponse.data.id ? [] : [Constants.CB_GET_ALL],
});
});
});

View file

@ -351,7 +351,7 @@ export class Title {
}
public render(protyle: IProtyle, response: IWebSocketData) {
if (this.element.getAttribute("data-render") === "true") {
if (this.element.getAttribute("data-render") === "true" && this.element.dataset.nodeId === protyle.block.rootID) {
return false;
}
if (protyle.options.render.hideTitleOnZoom) {

View file

@ -91,17 +91,6 @@ 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;
}

View file

@ -1118,7 +1118,7 @@ export const getArticle = (options: {
updateReadonly: true,
data: getResponse,
protyle: options.edit.protyle,
action: zoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_HTML],
action: zoomIn ? [Constants.CB_GET_ALL] : [],
});
const contentRect = options.edit.protyle.contentElement.getBoundingClientRect();