From 12530b1f6eab493e371e05365e4d2e40106d3834 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 27 Apr 2023 11:36:12 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/8010 --- app/src/protyle/wysiwyg/keydown.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 056383a3e..ce93fc323 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -1068,7 +1068,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { if (!selectText.trim()) { selectAll(protyle, nodeElement, range); } - const newFileName = replaceFileName(selectText.trim() ? selectText.trim() : protyle.lute.BlockDOM2Content(nodeElement.outerHTML)) || "Untitled"; + const newFileName = replaceFileName(selectText.trim() ? selectText.trim() : protyle.lute.BlockDOM2Content(nodeElement.outerHTML).replace(/\n/g, "")) || "Untitled"; fetchPost("/api/filetree/getHPathByPath", { notebook: protyle.notebookId, path: protyle.path, @@ -1096,7 +1096,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { selectAll(protyle, nodeElement, range); } getSavePath(protyle.path, protyle.notebookId, (pathString) => { - const newFileName = replaceFileName(selectText.trim() ? selectText.trim() : protyle.lute.BlockDOM2Content(nodeElement.outerHTML)) || "Untitled"; + const newFileName = replaceFileName(selectText.trim() ? selectText.trim() : protyle.lute.BlockDOM2Content(nodeElement.outerHTML).replace(/\n/g, "")) || "Untitled"; fetchPost("/api/filetree/createDocWithMd", { notebook: protyle.notebookId, path: pathPosix().join(pathString, newFileName),