diff --git a/app/components/Editor.js b/app/components/Editor.js index 50c45ed..1e9782b 100644 --- a/app/components/Editor.js +++ b/app/components/Editor.js @@ -160,11 +160,10 @@ const Editor = forwardRef(function Editor({ content, onUpdate, editable = true, useImperativeHandle(ref, () => ({ insertText: (text) => { if (!editor) return; - // 合并连续空行(3+ → 1 空行),然后按行拆分,每行包装为
- const cleaned = text.replace(/\n{3,}/g, '\n\n'); - const lines = cleaned.split('\n'); - const html = lines - .map(line => `
${line || '
'}
${p.replace(/\n/g, ' ').trim()}
`) .join(''); editor.chain().focus().insertContent(html).run(); },