+ const blockRefHTML = `
${oldValue}`
+ searchHTML += `
`;
}
range.deleteContents();
// 新建文件
- if (Constants.BLOCK_HINT_KEYS.includes(this.splitChar) && value.startsWith("((newFile ") && value.endsWith(`${Lute.Caret}"))`)) {
+ if (Constants.BLOCK_HINT_KEYS.includes(this.splitChar) && value.startsWith("((newFile ") && value.endsWith(`${Lute.Caret}'))`)) {
focusByRange(range);
- const fileName = value.substring(11, value.length - 4);
+ const fileNames = value.substring(11, value.length - 4).split(`"${Constants.ZWSP}'`)
+ const realFileName = fileNames.length === 1 ? fileNames[0] : fileNames[1];
getSavePath(protyle.path, protyle.notebookId, (pathString) => {
fetchPost("/api/filetree/createDocWithMd", {
notebook: protyle.notebookId,
- path: pathPosix().join(pathString, fileName),
+ path: pathPosix().join(pathString, realFileName),
markdown: ""
}, response => {
- insertHTML(genEmptyBlock(false, false, `
${escapeHtml(fileName)}`), protyle);
+ let blockRefHTML = `
${escapeHtml(realFileName)}`
+ if (fileNames.length === 2) {
+ blockRefHTML = `
${escapeHtml(fileNames[0])}`
+ }
+ insertHTML(genEmptyBlock(false, false, blockRefHTML), protyle);
});
});
return;