From e1d1073273da11d30ff095fa4b89cba0ff08c46a Mon Sep 17 00:00:00 2001 From: Erick Guan Date: Wed, 27 Feb 2019 10:36:14 +0100 Subject: [PATCH] FIX: use * when apply italics in the editor instead of _ (#7063) --- app/assets/javascripts/discourse/components/d-editor.js.es6 | 2 +- test/javascripts/components/d-editor-test.js.es6 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6 index 73afe5e34e..e100688782 100644 --- a/app/assets/javascripts/discourse/components/d-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/d-editor.js.es6 @@ -80,7 +80,7 @@ class Toolbar { icon: "italic", label: getButtonLabel("composer.italic_label", "I"), shortcut: "I", - perform: e => e.applySurround("_", "_", "italic_text") + perform: e => e.applySurround("*", "*", "italic_text") }); if (opts.showLink) { diff --git a/test/javascripts/components/d-editor-test.js.es6 b/test/javascripts/components/d-editor-test.js.es6 index 746f32dfe2..55afb89aa7 100644 --- a/test/javascripts/components/d-editor-test.js.es6 +++ b/test/javascripts/components/d-editor-test.js.es6 @@ -157,7 +157,7 @@ testCase(`bold with a multiline selection`, async function(assert, textarea) { testCase(`italic button with no selection`, async function(assert, textarea) { await click(`button.italic`); const example = I18n.t(`composer.italic_text`); - assert.equal(this.get("value"), `hello world._${example}_`); + assert.equal(this.get("value"), `hello world.*${example}*`); assert.equal(textarea.selectionStart, 13); assert.equal(textarea.selectionEnd, 13 + example.length); @@ -168,7 +168,7 @@ testCase(`italic button with a selection`, async function(assert, textarea) { textarea.selectionEnd = 11; await click(`button.italic`); - assert.equal(this.get("value"), `hello _world_.`); + assert.equal(this.get("value"), `hello *world*.`); assert.equal(textarea.selectionStart, 7); assert.equal(textarea.selectionEnd, 12); @@ -185,7 +185,7 @@ testCase(`italic with a multiline selection`, async function(assert, textarea) { textarea.selectionEnd = 12; await click(`button.italic`); - assert.equal(this.get("value"), `_hello_\n\n_world_\n\ntest.`); + assert.equal(this.get("value"), `*hello*\n\n*world*\n\ntest.`); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 16);