diff --git a/app/src/util/newFile.ts b/app/src/util/newFile.ts index 953cfeb47..41a5470e8 100644 --- a/app/src/util/newFile.ts +++ b/app/src/util/newFile.ts @@ -246,7 +246,10 @@ export const newFileBySelect = (protyle: IProtyle, selectText: string, nodeEleme }, (idResponse) => { const refText = escapeHtml(newFileName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen)); if (idResponse.data && idResponse.data.length > 0) { - insertHTML(`${refText}`, protyle, false, true); + protyle.toolbar.setInlineMark(protyle, "block-ref", "range", { + type: "id", + color: `${idResponse.data[0]}${Constants.ZWSP}d${Constants.ZWSP}${refText}` + }); } else { fetchPost("/api/filetree/createDocWithMd", { notebook: targetNotebookId, @@ -254,7 +257,10 @@ export const newFileBySelect = (protyle: IProtyle, selectText: string, nodeEleme parentID: protyle.notebookId === targetNotebookId ? protyle.block.rootID : "", markdown: "" }, response => { - insertHTML(`${refText}`, protyle, false, true); + protyle.toolbar.setInlineMark(protyle, "block-ref", "range", { + type: "id", + color: `${response.data}${Constants.ZWSP}d${Constants.ZWSP}${refText}` + }); }); } hideElements(["toolbar"], protyle);