diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-09-28 16:28:31 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-09-28 16:28:31 +0200 |
| commit | a7ba6cde9c7951fa54cf031deb3bebc8d511bf95 (patch) | |
| tree | 89e2e1f62bc3973dde713099af357a33264256dd /addons/web_editor/static/src/js/widgets.js | |
| parent | d04a42022b2338d529d245080fa506f72cdc8daa (diff) | |
| parent | 7134affc89c3ad04b365e64b49b911c8bc3f433e (diff) | |
[MERGE] forward port branch saas-12 up to 7134aff
Diffstat (limited to 'addons/web_editor/static/src/js/widgets.js')
| -rw-r--r-- | addons/web_editor/static/src/js/widgets.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js index 00a693d40f2..7a3ab09dd76 100644 --- a/addons/web_editor/static/src/js/widgets.js +++ b/addons/web_editor/static/src/js/widgets.js @@ -34,11 +34,11 @@ Dialog = Dialog.extend({ self.$('input:first').focus(); }); this.on("closed", this, function () { - this.trigger(this.destroyAction); + this.trigger(this.destroyAction, this.final_data || null); }); }, save: function () { - this.destroyAction = "saved"; + this.destroyAction = "save"; this.close(); }, }); @@ -164,8 +164,8 @@ var MediaDialog = Dialog.extend({ }, save: function () { if (this.options.select_images) { - this.trigger("saved", this.active.save()); - this.close(); + this.final_data = this.active.save(); + this._super.apply(this, arguments); return; } if(this.rte) { @@ -198,8 +198,8 @@ var MediaDialog = Dialog.extend({ } var media = this.active.media; - $(document.body).trigger("media-saved", [media, self.old_media]); - self.trigger("saved", [media, self.old_media]); + this.final_data = [media, self.old_media]; + $(document.body).trigger("media-saved", this.final_data); // Update editor bar after image edition (in case the image change to icon or other) _.defer(function () { @@ -312,10 +312,8 @@ var ImageDialog = Widget.extend({ }, save: function () { if (this.options.select_images) { - this.parent.trigger("save", this.images); return this.images; } - this.parent.trigger("save", this.media); var img = this.images[0]; if (!img) { @@ -668,7 +666,6 @@ var fontIconsDialog = Widget.extend({ */ save: function () { var self = this; - this.parent.trigger("save", this.media); var style = this.media.attributes.style ? this.media.attributes.style.value : ''; var classes = (this.media.className||"").split(/\s+/); var custom_classes = /^fa(-[1-5]x|spin|rotate-(9|18|27)0|flip-(horizont|vertic)al|fw|border)?$/; @@ -684,6 +681,8 @@ var fontIconsDialog = Widget.extend({ style = style.replace(/\s*width:[^;]+/, ''); } $(this.media).attr("class", _.compact(final_classes).join(' ')).attr("style", style); + + return this.media; }, /** * return the data font object (with base, parser and icons) or null @@ -907,7 +906,6 @@ var VideoDialog = Widget.extend({ return false; }, save: function () { - this.parent.trigger("save", this.media); var video_id = this.$("#video_id").val(); if (!video_id) { this.$("button.btn-primary").click(); @@ -921,6 +919,8 @@ var VideoDialog = Widget.extend({ '</div>'); $(this.media).replaceWith($iframe); this.media = $iframe[0]; + + return this.media; }, clear: function () { if (this.media.dataset.src) { @@ -1095,7 +1095,7 @@ var LinkDialog = Dialog.extend({ if (classes.replace(/(^|[ ])(btn-default|btn-success|btn-primary|btn-info|btn-warning|btn-danger)([ ]|$)/gi, ' ')) { self.data.style = {'background-color': '', 'color': ''}; } - self.trigger("save", self.data); + self.final_data = self.data; }).then(_super); }, bind_data: function () { |
