From e209faa6cf0987ccab7903403782bd5763e0ee77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Fri, 18 May 2018 19:32:10 +0200 Subject: [PATCH] UX: ensure whitespace isn't removed when playing with quotes --- .../javascripts/discourse/components/quote-button.js.es6 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/components/quote-button.js.es6 b/app/assets/javascripts/discourse/components/quote-button.js.es6 index 5d41b049cc7..49ee520e95a 100644 --- a/app/assets/javascripts/discourse/components/quote-button.js.es6 +++ b/app/assets/javascripts/discourse/components/quote-button.js.es6 @@ -78,7 +78,10 @@ export default Ember.Component.extend({ const $quoteButton = this.$(); // remove the marker - markerElement.parentNode.removeChild(markerElement); + const parent = markerElement.parentNode; + parent.removeChild(markerElement); + // merge back all text nodes so they don't get messed up + parent.normalize(); // work around Safari that would sometimes lose the selection if (isSafari) {