From f0504433e3ccb28e76c86b4b004f4f20fa469eff Mon Sep 17 00:00:00 2001 From: Luke Merrick Date: Thu, 29 Oct 2020 13:54:42 -0400 Subject: [PATCH] Use whitespace class instead of space in end of sentence regex This fixes a really hard-to-reproduce error that sometimes happened when sentences were separated by two spaces instead of one. The error only seemed to happen when pasting rich text, not plain text. --- src/lib/selection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/selection.js b/src/lib/selection.js index ccc5317..1be014a 100644 --- a/src/lib/selection.js +++ b/src/lib/selection.js @@ -8,7 +8,7 @@ import { Decoration, DecorationSet } from "prosemirror-view"; import store from "../store"; // End of sentence punctuation -const EOSPuncRegex = /([.?!]) /g; +const EOSPuncRegex = /([.?!])\s/g; const nonWhitespaceRegex = /[^\s\\]/; // Styled in Home.js const sentenceClasses = {