summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-04-13 15:31:27 +0200
committerChristophe Simonis <chs@odoo.com>2017-04-13 15:31:27 +0200
commitb0992d082da329abd7b0711b64a3706f9f5ee4fc (patch)
tree09c013e2f1f9efdf310e59916ea21d9da849a44e /addons/web_editor/static/src
parentf3cff93f5c95d0007e8e4b54e4c7a1e803b4ea5b (diff)
parent8f30e707e53d020b127908ae1eeb34c6ea9b04b3 (diff)
[MERGE] forward port branch saas-14 up to 8f30e707e53
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/rte.summernote.js10
-rw-r--r--addons/web_editor/static/src/js/widgets.js12
2 files changed, 15 insertions, 7 deletions
diff --git a/addons/web_editor/static/src/js/rte.summernote.js b/addons/web_editor/static/src/js/rte.summernote.js
index 9f908a245bc..60c096603d8 100644
--- a/addons/web_editor/static/src/js/rte.summernote.js
+++ b/addons/web_editor/static/src/js/rte.summernote.js
@@ -292,7 +292,15 @@ eventHandler.modules.popover.update = function ($popover, oStyle, isAirMode) {
$imagePopover.find('.o_image_alt').text( (alt || "").replace(/&quot;/g, '"') ).parent().toggle(oStyle.image.tagName === "IMG");
$imagePopover.show();
- range.createFromNode(dom.firstChild(oStyle.image)).select();
+ // for video tag (non-void) we select the range over the tag,
+ // for other media types we get the first descendant leaf element
+ var target_node = oStyle.image;
+ if (!oStyle.image.className.match(/(^|\s)media_iframe_video(\s|$)/i)) {
+ target_node = dom.firstChild(target_node);
+ }
+ range.createFromNode(target_node).select();
+ // save range on the editor so it is not lost if restored
+ eventHandler.modules.editor.saveRange(dom.makeLayoutInfo(target_node).editable());
} else {
$(".note-control-selection").hide();
}
diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js
index e0ecc658110..aa1d3123db6 100644
--- a/addons/web_editor/static/src/js/widgets.js
+++ b/addons/web_editor/static/src/js/widgets.js
@@ -636,9 +636,12 @@ var fontIconsDialog = Widget.extend({
},
renderElement: function () { // extract list of font (like awesome) from the cheatsheet.
this.iconsParser = fontIcons;
- this.icons = _.flatten(_.map(fontIcons, function (data) {
+ this.icons = _.flatten(_.map(fontIcons, function (data) { // TODO maybe useless now
return data.icons;
}));
+ this.alias = _.flatten(_.map(fontIcons, function (data) {
+ return data.alias;
+ }));
this._super.apply(this, arguments);
},
search: function (needle) {
@@ -740,11 +743,8 @@ var fontIconsDialog = Widget.extend({
case '': continue;
default:
$(".font-icons-icon").removeClass("o_selected").filter("[data-alias*=',"+cls+",']").addClass("o_selected");
- for (var k=0; k<this.icons.length; k++) {
- if (this.icons.indexOf(cls) !== -1) {
- this.$('#fa-icon').val(cls);
- break;
- }
+ if (this.alias.indexOf(cls) !== -1) {
+ this.$('#fa-icon').val(cls);
}
}
}