A platform for community discussion. Free, open, simple.
Clear old text and URL when showing up the "Insert Hyperink" modal. (#6138)
Dan Ungureanu44a5c29d4270
diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6index d3d4c8ba010..1293d032d42 100644--- a/app/assets/javascripts/discourse/components/d-editor.js.es6+++ b/app/assets/javascripts/discourse/components/d-editor.js.es6@@ -874,6 +874,9 @@ export default Ember.Component.extend({return;}+ this.set("linkUrl", "");+ this.set("linkText", "");+this._lastSel = this._getSelected();if (this._lastSel) {@@ -947,9 +950,6 @@ export default Ember.Component.extend({this._selectText(sel.start + 1, origLink.length);}}-- this.set("linkUrl", "");- this.set("linkText", "");},emoji() {diff --git a/test/javascripts/components/d-editor-test.js.es6 b/test/javascripts/components/d-editor-test.js.es6index 4bf18bca967..58e4f88b305 100644--- a/test/javascripts/components/d-editor-test.js.es6+++ b/test/javascripts/components/d-editor-test.js.es6@@ -241,6 +241,17 @@ testCase("link modal (cancel)", function(assert) {});});+testCase("link modal (cancel clears inputs)", async function(assert) {+ await click("button.link");+ await fillIn(".insert-link input.link-url", "https://meta.discourse.org/");+ await fillIn(".insert-link input.link-text", "Discourse Meta");+ await click(".insert-link button.btn-danger");++ await click("button.link");+ assert.equal(this.$(".insert-link input.link-url")[0].value, "");+ assert.equal(this.$(".insert-link input.link-text")[0].value, "");+});+testCase("link modal (simple link)", function(assert, textarea) {click("button.link");