summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/widgets.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2015-08-28 15:07:16 +0200
committerChristophe Simonis <chs@odoo.com>2015-08-28 15:07:16 +0200
commitedeceba7df84a1782c125641ea39df31c93715b4 (patch)
tree21a123009ad9f0d3833c5b1bd5d96ef36f568470 /addons/web_editor/static/src/js/widgets.js
parent31518bc09b1ae2be37c3555799e2c122f0a4dbcd (diff)
parent7a768a495168e9b74c7f6b768aa9a975601501be (diff)
[MERGE] forward port of branch saas-6 up to 7a768a4
Due to `sale` rewrite (94716a3f14d929574c46ef165e4364d12a5903ed), the commit 503820acb6d82a85c0c49ac26f7e7f8cd73851dd has been partially ignored (in sale.order.line) and will be rewritten later using new-api.
Diffstat (limited to 'addons/web_editor/static/src/js/widgets.js')
-rw-r--r--addons/web_editor/static/src/js/widgets.js23
1 files changed, 12 insertions, 11 deletions
diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js
index 5e852a1c5ef..56ada20729a 100644
--- a/addons/web_editor/static/src/js/widgets.js
+++ b/addons/web_editor/static/src/js/widgets.js
@@ -129,10 +129,12 @@ var MediaDialog = Dialog.extend({
this.imageDialog.appendTo(this.$("#editor-media-image"));
this.documentDialog = new ImageDialog(this, this.media, _.extend({'document': true}, this.options));
this.documentDialog.appendTo(this.$("#editor-media-document"));
- this.iconDialog = new fontIconsDialog(this, this.media, this.options);
- this.iconDialog.appendTo(this.$("#editor-media-icon"));
- this.videoDialog = new VideoDialog(this, this.media, this.options);
- this.videoDialog.appendTo(this.$("#editor-media-video"));
+ if (!this.only_images) {
+ this.iconDialog = new fontIconsDialog(this, this.media, this.options);
+ this.iconDialog.appendTo(this.$("#editor-media-icon"));
+ this.videoDialog = new VideoDialog(this, this.media, this.options);
+ this.videoDialog.appendTo(this.$("#editor-media-video"));
+ }
this.active = this.imageDialog;
@@ -175,10 +177,11 @@ var MediaDialog = Dialog.extend({
if (this.active !== this.documentDialog) {
this.documentDialog.clear();
}
- if (this.active !== this.iconDialog) {
+ // if not mode only_images
+ if (this.iconDialog && this.active !== this.iconDialog) {
this.iconDialog.clear();
}
- if (this.active !== this.videoDialog) {
+ if (this.videoDialog && this.active !== this.videoDialog) {
this.videoDialog.clear();
}
} else {
@@ -574,7 +577,7 @@ var getCssSelectors = function(filter) {
}
return cacheCssSelectors[filter] = css;
};
-function computeFonts() {
+var computeFonts = _.once(function() {
_.each(fontIcons, function (data) {
data.cssData = getCssSelectors(data.parser);
data.alias = [];
@@ -583,7 +586,7 @@ function computeFonts() {
return css[2];
});
});
-}
+});
rte.Class.include({
init: function (EditorBar) {
@@ -632,9 +635,7 @@ var fontIconsDialog = Widget.extend({
this._super();
this.parent = parent;
this.media = media;
- if (_.find(fontIcons, function (data) {return !data.icons;})) {
- computeFonts();
- }
+ computeFonts();
},
start: function () {
return this._super().then(this.proxy('load_data'));