summaryrefslogtreecommitdiff
path: root/addons/web_editor/static
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-10-17 11:42:05 +0200
committerChristophe Simonis <chs@odoo.com>2017-10-17 11:42:05 +0200
commitcbca27d0052430743fe2c996964d7aca0ca682c9 (patch)
tree09a4e7e6a8e1c0cde24d464e595b786e3ea247ad /addons/web_editor/static
parent25725eae578d126f79c69f72a7a4e3b4136b4e5d (diff)
parentd5c0cae60b5cf7834ca9d669f9408a7c55694ff9 (diff)
[MERGE] forward port branch 9.0 up to d5c0cae60b5
Diffstat (limited to 'addons/web_editor/static')
-rw-r--r--addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js12
-rw-r--r--addons/web_editor/static/src/js/rte.js2
-rw-r--r--addons/web_editor/static/src/js/rte.summernote.js2
3 files changed, 14 insertions, 2 deletions
diff --git a/addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js b/addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js
index 8b42726ff7a..955b49437a8 100644
--- a/addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js
+++ b/addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js
@@ -206,6 +206,18 @@ define([
r.select();
}
+ // If only pasting a <p/> element in an unique <p/> element, only paste
+ // the <p/> element text
+ var $p = $arch.children('p');
+ var onlyAP = ($p.length === 1 && $arch.children().length === 1);
+ if (onlyAP) {
+ var $p1 = $(r.sc).closest('p');
+ var $p2 = $(r.ec).closest('p');
+ if ($p1.length && $p2.length && $p1[0] === $p2[0]) {
+ $arch.html($p.text());
+ }
+ }
+
/*
insert content
*/
diff --git a/addons/web_editor/static/src/js/rte.js b/addons/web_editor/static/src/js/rte.js
index b0366583aea..c7dc268251d 100644
--- a/addons/web_editor/static/src/js/rte.js
+++ b/addons/web_editor/static/src/js/rte.js
@@ -429,7 +429,7 @@ var RTE = Widget.extend({
saveElement: function ($el, context) {
// remove multi edition
if ($el.data('oe-model')) {
- var key = $el.data('oe-model')+":"+$el.data('oe-id')+":"+$el.data('oe-field')+":"+$el.data('oe-type')+":"+$el.data('oe-expression');
+ var key = $el.data('oe-model')+":"+$el.data('oe-id')+":"+$el.data('oe-field')+":"+$el.data('oe-type')+":"+$el.data('oe-expression')+":"+$el.data('oe-xpath');
if (this.__saved[key]) return $.when();
this.__saved[key] = true;
}
diff --git a/addons/web_editor/static/src/js/rte.summernote.js b/addons/web_editor/static/src/js/rte.summernote.js
index 4ab1e7bed06..a3bf079aa30 100644
--- a/addons/web_editor/static/src/js/rte.summernote.js
+++ b/addons/web_editor/static/src/js/rte.summernote.js
@@ -454,7 +454,7 @@ $.summernote.pluginEvents.visible = function (event, editor, layoutInfo) {
if (($node.is('[data-oe-type="html"]') || $node.is('[data-oe-field="arch"]')) &&
$node.hasClass("o_editable") &&
!$node[0].children.length &&
- "h1 h2 h3 h4 h5 h6 p b bold i u code sup strong small pre th td".toUpperCase().indexOf($node[0].nodeName) === -1) {
+ "h1 h2 h3 h4 h5 h6 p b bold i u code sup strong small pre th td label".toUpperCase().indexOf($node[0].nodeName) === -1) {
var p = $('<p><br/></p>')[0];
$node.append( p );
range.createFromNode(p.firstChild).select();