mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-16 20:18:06 +01:00
This commit is contained in:
parent
bfe50d9009
commit
ff909fa149
3 changed files with 24 additions and 20 deletions
|
|
@ -249,10 +249,13 @@ export const newFileBySelect = (protyle: IProtyle, selectText: string, nodeEleme
|
|||
}, (idResponse) => {
|
||||
const refText = newFileName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen);
|
||||
if (idResponse.data && idResponse.data.length > 0) {
|
||||
protyle.toolbar.setInlineMark(protyle, "block-ref", "range", {
|
||||
const refElement = protyle.toolbar.setInlineMark(protyle, "block-ref", "range", {
|
||||
type: "id",
|
||||
color: `${idResponse.data[0]}${Constants.ZWSP}d${Constants.ZWSP}${refText}`
|
||||
});
|
||||
if (refElement[0]) {
|
||||
protyle.toolbar.range.selectNodeContents(refElement[0]);
|
||||
}
|
||||
} else {
|
||||
fetchPost("/api/filetree/createDocWithMd", {
|
||||
notebook: targetNotebookId,
|
||||
|
|
@ -260,10 +263,13 @@ export const newFileBySelect = (protyle: IProtyle, selectText: string, nodeEleme
|
|||
parentID: protyle.notebookId === targetNotebookId ? protyle.block.rootID : "",
|
||||
markdown: ""
|
||||
}, response => {
|
||||
protyle.toolbar.setInlineMark(protyle, "block-ref", "range", {
|
||||
const refElement = protyle.toolbar.setInlineMark(protyle, "block-ref", "range", {
|
||||
type: "id",
|
||||
color: `${response.data}${Constants.ZWSP}d${Constants.ZWSP}${refText}`
|
||||
});
|
||||
if (refElement[0]) {
|
||||
protyle.toolbar.range.selectNodeContents(refElement[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
hideElements(["toolbar"], protyle);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue