A platform for community discussion. Free, open, simple.
FEATURE: keep formatting when quoting
Régis Hanol71f5215711cc
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.jsindex a1888006db1..e7e9db37b4c 100644--- a/app/assets/javascripts/application.js+++ b/app/assets/javascripts/application.js@@ -9,6 +9,8 @@//= require ./deprecated// Stuff we need to load first+//= require ./discourse/helpers/parse-html+//= require ./discourse/lib/to-markdown//= require ./discourse/lib/utilities//= require ./discourse/lib/page-visible//= require ./discourse/lib/logoutdiff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6index 3a8782ab4a9..46448d84471 100644--- a/app/assets/javascripts/discourse/controllers/topic.js.es6+++ b/app/assets/javascripts/discourse/controllers/topic.js.es6@@ -131,7 +131,6 @@ export default Ember.Controller.extend(BufferedContent, {return this.get('model.postStream').loadPost(postId).then(post => {const composer = this.get('composer');const viewOpen = composer.get('model.viewOpen');-const quotedText = Quote.build(post, buffer);// If we can't create a post, delegate to reply as new topicdiff --git a/app/assets/javascripts/discourse/lib/utilities.js.es6 b/app/assets/javascripts/discourse/lib/utilities.js.es6index 987e8682479..0e14caabc95 100644--- a/app/assets/javascripts/discourse/lib/utilities.js.es6+++ b/app/assets/javascripts/discourse/lib/utilities.js.es6@@ -1,4 +1,5 @@import { escape } from 'pretty-text/sanitizer';+import toMarkdown from 'discourse/lib/to-markdown';const homepageSelector = 'meta[name=discourse_current_homepage]';@@ -113,12 +114,8 @@ export function selectedText() {$div.find(".clicks").remove();// replace emojis$div.find("img.emoji").replaceWith(function() { return this.title; });- // replace br with newlines- $div.find("br").replaceWith(() => "\n");- // enforce newline at the end of paragraphs- $div.find("p").append(() => "\n");- return String($div.text()).trim().replace(/(^\s*\n)+/gm, "\n");+ return toMarkdown($div.html());}// Determine the row and col of the caret in an element