Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: disable conversion of 2 single spaced lines into 1 double spaced line

Abdullah Atta6116daf9ba8b
diff --git a/packages/editor/src/extensions/paragraph/paragraph.ts b/packages/editor/src/extensions/paragraph/paragraph.ts
index 74795f926..1b927c254 100644
--- a/packages/editor/src/extensions/paragraph/paragraph.ts
+++ b/packages/editor/src/extensions/paragraph/paragraph.ts
@@ -100,17 +100,18 @@ export const Paragraph = Node.create<ParagraphOptions>({
const { state } = editor;
const { selection } = state;
const { $from, empty, $to } = selection;
+ const atEnd = $to.parentOffset === $to.parent.content.size;
- if (!empty || $from.parent.type !== this.type || $from.depth > 1) {
+ if (
+ !empty ||
+ $from.parent.type !== this.type ||
+ $from.depth > 1 ||
+ atEnd
+ ) {
return false;
}
- const endsWithNewline = $from.nodeBefore === null;
- const atEnd = $to.parentOffset === $to.parent.content.size;
-
- if (endsWithNewline) {
- return createParagraph(editor, this.type, true, false);
- } else if (!atEnd) {
+ if (!atEnd) {
return createParagraph(editor, this.type, false, true);
}