summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2019-07-16 16:02:41 +0200
committerMartin Trigaux <mat@odoo.com>2019-07-16 16:36:40 +0200
commitbeba36416fdf25df74cf8a581c66948a418173b6 (patch)
treed24b8a373560afcc78bde4c9c06338800809abfa /addons/web_editor/static/src/js
parent044904b9d50d61c5c7e5432a1b4615dda145704c (diff)
parent40421be73c94551ba902856984c0155d062cb449 (diff)
[MERGE] Forward port of saas-12.3 to saas-12.4 up to 40421be73c94551b
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/wysiwyg/plugin/helper.js3
-rw-r--r--addons/web_editor/static/src/js/wysiwyg/plugin/text.js5
2 files changed, 7 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/helper.js b/addons/web_editor/static/src/js/wysiwyg/plugin/helper.js
index a025d6a0082..1738e6e7b48 100644
--- a/addons/web_editor/static/src/js/wysiwyg/plugin/helper.js
+++ b/addons/web_editor/static/src/js/wysiwyg/plugin/helper.js
@@ -1885,6 +1885,9 @@ var HelperPlugin = AbstractPlugin.extend({
// Create empty text node to have a range into the node
if (range.sc.tagName && !dom.isVoid(range.sc) && !range.sc.childNodes[range.so]) {
$(range.sc).append(invisible);
+ if (invisible.previousSibling && invisible.previousSibling.tagName === "BR") {
+ invisible.previousSibling.remove();
+ }
range = this.context.invoke('editor.setRange', invisible, 0);
}
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