Skip to content

A platform for community discussion. Free, open, simple.

UX: remove auto-conversion from .. -> … (#31770)

Renato Atilio6a80c6bf4335
diff --git a/app/assets/javascripts/discourse-markdown-it/src/features/custom-typographer-replacements.js b/app/assets/javascripts/discourse-markdown-it/src/features/custom-typographer-replacements.js
index d058b3b54df..97bb8451528 100644
--- a/app/assets/javascripts/discourse-markdown-it/src/features/custom-typographer-replacements.js
+++ b/app/assets/javascripts/discourse-markdown-it/src/features/custom-typographer-replacements.js
@@ -14,7 +14,7 @@
// (r) (R) → ®
// (p) (P) -> §
-export const RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--|-->|<--|->|<-|<->|<-->/;
+export const RARE_RE = /\+-|\.\.\.|\?\?\?\?|!!!!|,,|--|-->|<--|->|<-|<->|<-->/;
export const SCOPED_ABBR_RE = /\((tm|pa)\)/gi;
let SCOPED_ABBR = {
@@ -49,9 +49,9 @@ export function replaceRareStr(str) {
.replace(/(^|\s)-{1,2}>(\s|$)/gm, "\u0020\u2192\u0020")
.replace(/(^|\s)<-{1,2}(\s|$)/gm, "\u0020\u2190\u0020")
.replace(/(^|\s)<-{1,2}>(\s|$)/gm, "\u0020\u2194\u0020")
- // .., ..., ....... -> …
+ // ..., ....... -> …
// but ?..... & !..... -> ?.. & !..
- .replace(/\.{2,}/g, "…")
+ .replace(/\.{3,}/g, "…")
.replace(/([?!])…/g, "$1..")
.replace(/([?!]){4,}/g, "$1$1$1")
.replace(/,{2,}/g, ",")
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/pretty-text-test.js b/app/assets/javascripts/discourse/tests/unit/lib/pretty-text-test.js
index 186d78c89ce..3170c66672a 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/pretty-text-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/pretty-text-test.js
@@ -1577,7 +1577,7 @@ var bar = 'bar';
assert.cookedOptions(
"test.. test... test..... test?..... test!...",
enabledTypographer,
- "<p>test… test… test… test?.. test!..</p>"
+ "<p>test.. test… test… test?.. test!..</p>"
);
assert.cookedOptions(
"!!!!!! ???? ,,",
diff --git a/spec/system/composer/prosemirror_editor_spec.rb b/spec/system/composer/prosemirror_editor_spec.rb
index eec2fb39918..611e75f6797 100644
--- a/spec/system/composer/prosemirror_editor_spec.rb
+++ b/spec/system/composer/prosemirror_editor_spec.rb
@@ -130,7 +130,7 @@ describe "Composer - ProseMirror editor", type: :system do
it "supports typographer replacements" do
open_composer_and_toggle_rich_editor
composer.type_content(
- "foo +- bar.. test???? wow!!!! x,, y-- a--> b<-- c-> d<- e<-> f<--> (tm) (pa)",
+ "foo +- bar... test???? wow!!!! x,, y-- a--> b<-- c-> d<- e<-> f<--> (tm) (pa)",
)
expect(rich).to have_css(