diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6 index 2b82d2ea17e..302a5451949 100644 --- a/app/assets/javascripts/discourse/components/d-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/d-editor.js.es6 @@ -802,15 +802,6 @@ export default Ember.Component.extend({ let html = clipboard.getData("text/html"); let handled = false; - if (plainText) { - plainText = plainText.trim().replace(/\r/g, ""); - const table = this._extractTable(plainText); - if (table) { - this.appEvents.trigger("composer:insert-text", table); - handled = true; - } - } - const { pre, lineVal } = this._getSelected(null, { lineVal: true }); const isInlinePasting = pre.match(/[^\n]$/); @@ -823,6 +814,15 @@ export default Ember.Component.extend({ ); } else { canPasteHtml = !isInside(pre, /(^|\n)```/g); + + if (canPasteHtml) { + plainText = plainText.trim().replace(/\r/g, ""); + const table = this._extractTable(plainText); + if (table) { + this.appEvents.trigger("composer:insert-text", table); + handled = true; + } + } } }