summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGorash <chm@odoo.com>2019-06-04 08:15:48 +0000
committerGorash <chm@odoo.com>2019-06-04 08:15:48 +0000
commit5b41b5c563c75e18f4cf8d2f7dd66d5e273e4341 (patch)
treef48d4444bcc8846fa15982a8ef39b212cfb78f15
parentb2b639b693dd7215e3ee501ac89c35f3a6b88bb5 (diff)
[FIX] web_editor: escape html tag when copy paste code and text content
closes odoo/odoo#33859 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
-rw-r--r--addons/web_editor/static/src/js/wysiwyg/plugin/text.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/text.js b/addons/web_editor/static/src/js/wysiwyg/plugin/text.js
index f2834c531f7..9014b367fee 100644
--- a/addons/web_editor/static/src/js/wysiwyg/plugin/text.js
+++ b/addons/web_editor/static/src/js/wysiwyg/plugin/text.js
@@ -780,7 +780,10 @@ var TextPlugin = AbstractPlugin.extend({
clipboardData = e.originalEvent.clipboardData.getData('text/plain');
// get that text as an array of text nodes separated by <br> where needed
var allNewlines = /\n/g;
- clipboardData = $('<p>' + clipboardData.replace(allNewlines, '<br>') + '</p>').contents().toArray();
+ clipboardData = _.str.trim(clipboardData)
+ .replace(/</g, '&lt;').replace(/>/g, '&gt;')
+ .replace(allNewlines, '<br>');
+ clipboardData = $('<p>' + clipboardData + '</p>').contents().toArray();
}
// Delete selection