mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 18:10:12 +01:00
This commit is contained in:
parent
e8a501b6c7
commit
6d21234fb2
1 changed files with 8 additions and 2 deletions
|
|
@ -246,7 +246,10 @@ export const newFileBySelect = (protyle: IProtyle, selectText: string, nodeEleme
|
||||||
}, (idResponse) => {
|
}, (idResponse) => {
|
||||||
const refText = escapeHtml(newFileName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen));
|
const refText = escapeHtml(newFileName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen));
|
||||||
if (idResponse.data && idResponse.data.length > 0) {
|
if (idResponse.data && idResponse.data.length > 0) {
|
||||||
insertHTML(`<span data-type="block-ref" data-id="${idResponse.data[0]}" data-subtype="d">${refText}</span>`, protyle, false, true);
|
protyle.toolbar.setInlineMark(protyle, "block-ref", "range", {
|
||||||
|
type: "id",
|
||||||
|
color: `${idResponse.data[0]}${Constants.ZWSP}d${Constants.ZWSP}${refText}`
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
fetchPost("/api/filetree/createDocWithMd", {
|
fetchPost("/api/filetree/createDocWithMd", {
|
||||||
notebook: targetNotebookId,
|
notebook: targetNotebookId,
|
||||||
|
|
@ -254,7 +257,10 @@ export const newFileBySelect = (protyle: IProtyle, selectText: string, nodeEleme
|
||||||
parentID: protyle.notebookId === targetNotebookId ? protyle.block.rootID : "",
|
parentID: protyle.notebookId === targetNotebookId ? protyle.block.rootID : "",
|
||||||
markdown: ""
|
markdown: ""
|
||||||
}, response => {
|
}, response => {
|
||||||
insertHTML(`<span data-type="block-ref" data-id="${response.data}" data-subtype="d">${refText}</span>`, protyle, false, true);
|
protyle.toolbar.setInlineMark(protyle, "block-ref", "range", {
|
||||||
|
type: "id",
|
||||||
|
color: `${response.data}${Constants.ZWSP}d${Constants.ZWSP}${refText}`
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
hideElements(["toolbar"], protyle);
|
hideElements(["toolbar"], protyle);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue