diff --git a/app/src/editor/rename.ts b/app/src/editor/rename.ts index 49a2bc3c8..24d68f840 100644 --- a/app/src/editor/rename.ts +++ b/app/src/editor/rename.ts @@ -177,6 +177,6 @@ export const newFileBySelect = (fileName: string, protyle: IProtyle) => { title: newName, md: "" }, () => { - insertHTML(genEmptyBlock(false, false, `${escapeHtml(newName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen))}`), protyle); + insertHTML(`${escapeHtml(newName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen))}`, protyle); }); }; diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts index 7cc72cd7e..54acb654a 100644 --- a/app/src/protyle/hint/index.ts +++ b/app/src/protyle/hint/index.ts @@ -517,7 +517,7 @@ ${unicode2Emoji(emoji.unicode, true)}`; title: "Untitled", md: "" }, () => { - insertHTML(genEmptyBlock(false, false, `Untitled`), protyle); + insertHTML(`Untitled`, protyle); /// #if MOBILE openMobileFileById(newSubDocId, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]); /// #else diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts index aaad002c1..123e5240e 100644 --- a/app/src/protyle/util/editorCommonEvent.ts +++ b/app/src/protyle/util/editorCommonEvent.ts @@ -620,7 +620,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => { selectedIds.forEach(item => { html += `{{select * from blocks where id='${item}'}}\n`; }); - insertHTML(protyle.lute.SpinBlockDOM(html), protyle); + insertHTML(protyle.lute.SpinBlockDOM(html), protyle, true); blockRender(protyle, protyle.wysiwyg.element); } else if (targetElement) { const targetClass = targetElement.className.split(" "); diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts index ca3e45e41..2c6b223f1 100644 --- a/app/src/protyle/util/paste.ts +++ b/app/src/protyle/util/paste.ts @@ -222,6 +222,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven } else if (textHTML.endsWith(Constants.ZWSP)) { // 编辑器内部粘贴 tempElement.innerHTML = textHTML.substr(0, textHTML.length - 1).replace('', ""); + let isBlock = false; tempElement.querySelectorAll("[data-node-id]").forEach((e) => { const newId = Lute.NewNodeID(); e.setAttribute("data-node-id", newId); @@ -229,13 +230,17 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven if (e.getAttribute("updated")) { e.setAttribute("updated", newId.split("-")[0]); } + isBlock = true }); + if (nodeElement.classList.contains("table")) { + isBlock = false; + } // 从历史中复制后粘贴 tempElement.querySelectorAll('[spellcheck="false"][contenteditable="false"]').forEach((e) => { e.setAttribute("contenteditable", "true"); }); const tempInnerHTML = tempElement.innerHTML; - insertHTML(tempInnerHTML, protyle); + insertHTML(tempInnerHTML, protyle, isBlock); filterClipboardHint(protyle, tempInnerHTML); } else { tempElement.innerHTML = textHTML;