UX: Only do plain text table detection in outside code if HTML pasting enabled

Co-authored-by: Tim Lange <tim.lange@titanhq.de>
PR: https://github.com/discourse/discourse/pull/7436
This commit is contained in:
Vinoth Kannan 2019-04-26 09:20:10 +05:30
parent abecb3aea8
commit dc2ee78f7a
1 changed files with 9 additions and 9 deletions

View File

@ -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;
}
}
}
}