[FIX] web_editor: fix _getEditorOptions traceback

Before this commit, a traceback would be thrown when no options were
passed to `_getEditorOptions` because of a code mistake using the
variable `options` rather than `finalOptions`.

Also, this error revealed that the `this.options` of the wysiwyg could
be wrongly reset if no argument `options` was passed to `resetEditor`.

task-3149085

closes odoo/odoo#111100

X-original-commit: 475775d3dfc230c06c7a2b127b67bc22543e8a27
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
This commit is contained in:
Nicolas Bayet
2023-01-26 19:55:58 +01:00
parent 04487da7c5
commit 2a0e8d1993
@@ -2013,7 +2013,7 @@ const Wysiwyg = Widget.extend({
// autohideToolbar is true by default (false by default if navbar present).
finalOptions.autohideToolbar = typeof finalOptions.autohideToolbar === 'boolean'
? finalOptions.autohideToolbar
: !options.snippets;
: !finalOptions.snippets;
return finalOptions;
},
@@ -2535,8 +2535,10 @@ const Wysiwyg = Widget.extend({
this._collaborationStopBus && this._collaborationStopBus();
},
resetEditor: function (value, options) {
this.options = this._getEditorOptions(options);
const {collaborationChannel} = options;
if (options) {
this.options = this._getEditorOptions(options);
}
const {collaborationChannel} = this.options;
this._stopPeerToPeer();
// If there is no collaborationResId, the record has been deleted.
if (!collaborationChannel || !collaborationChannel.collaborationResId) {