summaryrefslogtreecommitdiff
path: root/addons/web_editor/static
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-04-16 19:50:50 +0200
committerChristophe Simonis <chs@odoo.com>2018-04-16 19:50:50 +0200
commit74033eb007749c88b84ea883b006a5877355306e (patch)
tree8f8b6cb22cc2bf6046ba04e388ea29855a33c597 /addons/web_editor/static
parent71cdefd9f41881d9720433d5fc7732759098f9a4 (diff)
parent90f8f17fb4fc795c2c12d68d21900e81f3d7a223 (diff)
[MERGE] forward port branch saas-11.2 up to 90f8f17fb4f
Diffstat (limited to 'addons/web_editor/static')
-rw-r--r--addons/web_editor/static/src/js/editor/summernote.js11
-rw-r--r--addons/web_editor/static/src/js/widgets/widgets.js11
-rw-r--r--addons/web_editor/static/src/less/web_editor.backend.less2
3 files changed, 16 insertions, 8 deletions
diff --git a/addons/web_editor/static/src/js/editor/summernote.js b/addons/web_editor/static/src/js/editor/summernote.js
index 3e11cdc6886..b3e06fa1716 100644
--- a/addons/web_editor/static/src/js/editor/summernote.js
+++ b/addons/web_editor/static/src/js/editor/summernote.js
@@ -1802,12 +1802,17 @@ $.summernote.pluginEvents.indent = function (event, editor, layoutInfo, outdent)
var $dom = $(ancestor);
if (!dom.isList(ancestor)) {
+ // to indent a selection, we indent the child nodes of the common
+ // ancestor that contains this selection
$dom = $(dom.node(ancestor)).children();
}
- if (!$dom.length) {
- $dom = $(dom.ancestor(r.sc, dom.isList) || dom.ancestor(r.sc, dom.isCell));
+ if (!$dom.not('br').length) {
+ // if selection is inside a list, we indent its list items
+ $dom = $(dom.ancestor(r.sc, dom.isList));
if (!$dom.length) {
- $dom = $(r.sc).closest(options.styleTags.join(','));
+ // if the selection is contained in a single HTML node, we indent
+ // the first ancestor 'content block' (P, H1, PRE, ...) or TD
+ $dom = $(r.sc).closest(options.styleTags.join(',')+',td');
}
}
diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js
index 8a08c4e18f4..53df66e9ba7 100644
--- a/addons/web_editor/static/src/js/widgets/widgets.js
+++ b/addons/web_editor/static/src/js/widgets/widgets.js
@@ -455,11 +455,13 @@ var ImageWidget = MediaWidget.extend({
/**
* @private
*/
- _toggleImage: function (attachment, clearSearch) {
+ _toggleImage: function (attachment, clearSearch, force_select) {
if (this.multiImages) {
var img = _.select(this.images, function (v) { return v.id === attachment.id; });
if (img.length) {
- this.images.splice(this.images.indexOf(img[0]),1);
+ if (!force_select) {
+ this.images.splice(this.images.indexOf(img[0]),1);
+ }
} else {
this.images.push(attachment);
}
@@ -527,17 +529,18 @@ var ImageWidget = MediaWidget.extend({
/**
* @private
*/
- _onImageClick: function (ev) {
+ _onImageClick: function (ev, force_select) {
var $img = $(ev.currentTarget);
var attachment = _.find(this.records, function (record) {
return record.id === $img.data('id');
});
- this._toggleImage(attachment);
+ this._toggleImage(attachment, false, force_select);
},
/**
* @private
*/
_onImageDblClick: function (ev) {
+ this._onImageClick(ev, true);
this.trigger_up('save_request');
},
/**
diff --git a/addons/web_editor/static/src/less/web_editor.backend.less b/addons/web_editor/static/src/less/web_editor.backend.less
index a9d3c4e2198..7ddbaeaa7ce 100644
--- a/addons/web_editor/static/src/less/web_editor.backend.less
+++ b/addons/web_editor/static/src/less/web_editor.backend.less
@@ -5,7 +5,7 @@
font-family: inherit !important;
line-height: initial !important;
color: initial !important;
- p {
+ p, div {
font-family: 'Lucida Grande', Helvetica, Verdana, Arial, sans-serif;
font-size: 13px;
}