diff options
| author | Vincent Schippefilt <vsc@odoo.com> | 2019-03-06 14:02:33 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2019-03-06 20:07:17 +0100 |
| commit | 226a6a9e677b1ebded9240e181cc2ea83fa49d72 (patch) | |
| tree | db1caaa11b9905589031b10580db28a5486b2b20 /addons/website/static/src/js/editor/editor_menu.js | |
| parent | c39033bc1cff578626b6925ed542cfc8f709e15c (diff) | |
[REF] website: adapt code after jQuery update
Part of task 1896658
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
Co-authored-by: svs-odoo <svs@odoo.com>
Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
Diffstat (limited to 'addons/website/static/src/js/editor/editor_menu.js')
| -rw-r--r-- | addons/website/static/src/js/editor/editor_menu.js | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/addons/website/static/src/js/editor/editor_menu.js b/addons/website/static/src/js/editor/editor_menu.js index ee504413e2f..46c3fc0b6b1 100644 --- a/addons/website/static/src/js/editor/editor_menu.js +++ b/addons/website/static/src/js/editor/editor_menu.js @@ -75,15 +75,17 @@ var EditorMenu = Widget.extend({ */ cancel: function (reload) { var self = this; - var def = $.Deferred(); - if (!this.wysiwyg.isDirty()) { - def.resolve(); - } else { - var confirm = Dialog.confirm(this, _t("If you discard the current edition, all unsaved changes will be lost. You can cancel to return to the edition mode."), { - confirm_callback: def.resolve.bind(def), - }); - confirm.on('closed', def, def.reject); - } + var def = new Promise(function (resolve, reject) { + if (!self.wysiwyg.isDirty()) { + resolve(); + } else { + var confirm = Dialog.confirm(self, _t("If you discard the current edition, all unsaved changes will be lost. You can cancel to return to the edition mode."), { + confirm_callback: resolve, + }); + confirm.on('closed', self, reject); + } + }); + return def.then(function () { self.trigger_up('edition_will_stopped'); var $wrapwrap = $('#wrapwrap'); @@ -110,10 +112,10 @@ var EditorMenu = Widget.extend({ save: function (reload) { var self = this; this.trigger_up('edition_will_stopped'); - return this.wysiwyg.save().then(function (dirty) { + return this.wysiwyg.save().then(function (result) { var $wrapwrap = $('#wrapwrap'); self.editable($wrapwrap).removeClass('o_editable'); - if (dirty && reload !== false) { + if (result.isDirty && reload !== false) { // remove top padding because the connected bar is not visible $('body').removeClass('o_connected_user'); return self._reload(); @@ -180,7 +182,7 @@ var EditorMenu = Widget.extend({ this.$el.hide(); window.location.hash = 'scrollTop=' + window.document.body.scrollTop; window.location.reload(true); - return $.Deferred(); + return new Promise(function () {}); }, //-------------------------------------------------------------------------- |
