diff --git a/src/EditorFactory.js b/src/EditorFactory.js index 319e8f1ec65..39cd350dd59 100644 --- a/src/EditorFactory.js +++ b/src/EditorFactory.js @@ -67,7 +67,14 @@ const createEditor = ({ language, onCreate = () => {}, onUpdate = () => {}, exte FocusTrap, ] } else { - defaultExtensions = [PlainText, CodeBlockLowlight.configure({ lowlight, defaultLanguage: language })] + defaultExtensions = [ + PlainText, + CodeBlockLowlight.configure({ + lowlight, + defaultLanguage: language, + exitOnTripleEnter: false, + }), + ] } return new Editor({ diff --git a/src/tests/plaintext.spec.js b/src/tests/plaintext.spec.js index fdd68fa0eb4..0f6f194d1d2 100644 --- a/src/tests/plaintext.spec.js +++ b/src/tests/plaintext.spec.js @@ -79,4 +79,17 @@ describe('html as plain text', () => { expect(plaintextThroughEditor('"\';&.-#><')).toBe('"\';&.-#><') expect(plaintextThroughEditor(xssFuzzVectors)).toBe(xssFuzzVectors) }) +} ) + +describe('regression tests', () => { + test('tripple enter creates new lines at end (#6507)', () => { + const tiptap = createEditor({ + enableRichEditing: false + }) + tiptap.commands.enter() + tiptap.commands.enter() + tiptap.commands.enter() + expect(serializePlainText(tiptap.state.doc)) + .toEqual("\n\n\n") + }) })