summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-04-13 13:22:27 +0200
committerChristophe Simonis <chs@odoo.com>2017-04-13 13:22:27 +0200
commit13ad16104afa58fd7d3d70f502ada972727084eb (patch)
tree85cf1db6e9bd45960cc76e2b04122c460d945337 /addons/web_editor/static/src/js
parentbb5e0a3cfa08845dc935b1bc4881807f56e116c8 (diff)
parent00e169c05a270a0943a74fbeb0a884009946c7cd (diff)
[MERGE] forward port branch 10.0 up to 00e169c05a2
Diffstat (limited to 'addons/web_editor/static/src/js')
-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 44b6b9502d1..6e7a6784351 100644
--- a/addons/web_editor/static/src/js/widgets.js
+++ b/addons/web_editor/static/src/js/widgets.js
@@ -637,9 +637,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) {
@@ -741,11 +744,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);
}
}
}