mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
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:
parent
abecb3aea8
commit
dc2ee78f7a
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user