diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6 index dbb67f50bfa..bde8bca1291 100644 --- a/app/assets/javascripts/discourse/components/d-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/d-editor.js.es6 @@ -78,7 +78,7 @@ class Toolbar { group: 'insertions', icon: 'quote-right', shortcut: 'Shift+9', - perform: e => e.applySurround('> ', '', 'code_text') + perform: e => e.applyList('> ', 'blockquote_text') }); this.addButton({id: 'code', group: 'insertions', shortcut: 'Shift+C', action: 'formatCode'}); diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 8aa17f9e58a..73e86c46653 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1129,6 +1129,7 @@ en: options: "Options" whisper: "whisper" unlist: "unlisted" + blockquote_text: "Blockquote" add_warning: "This is an official warning." toggle_whisper: "Toggle Whisper" diff --git a/test/javascripts/components/d-editor-test.js.es6 b/test/javascripts/components/d-editor-test.js.es6 index c36640c32dc..3847121cece 100644 --- a/test/javascripts/components/d-editor-test.js.es6 +++ b/test/javascripts/components/d-editor-test.js.es6 @@ -515,29 +515,37 @@ third line` testCase('quote button', function(assert, textarea) { - click('button.quote'); - andThen(() => { - assert.equal(this.get('value'), 'hello world.'); - }); andThen(() => { textarea.selectionStart = 6; - textarea.selectionEnd = 11; + textarea.selectionEnd = 9; }); click('button.quote'); andThen(() => { - assert.equal(this.get('value'), 'hello > world.'); - assert.equal(textarea.selectionStart, 6); - assert.equal(textarea.selectionEnd, 13); + assert.equal(this.get('value'), 'hello\n\n> wor\n\nld.'); + assert.equal(textarea.selectionStart, 7); + assert.equal(textarea.selectionEnd, 12); + }); + + click('button.quote'); + + andThen(() => { + assert.equal(this.get('value'), 'hello\n\nwor\n\nld.'); + assert.equal(textarea.selectionStart, 7); + assert.equal(textarea.selectionEnd, 10); + }); + + andThen(() => { + textarea.selectionStart = 15; + textarea.selectionEnd = 15; }); click('button.quote'); andThen(() => { - assert.equal(this.get('value'), 'hello world.'); - assert.equal(textarea.selectionStart, 6); - assert.equal(textarea.selectionEnd, 11); + assert.equal(this.get('value'), 'hello\n\nwor\n\nld.\n\n> Blockquote'); }); + }); testCase(`bullet button with no selection`, function(assert, textarea) {