From b9d4ccfc8db1f3425b8ee0e8d6311ebaac0f26b2 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 23 Sep 2020 13:45:21 +0000 Subject: [FIX] website: restore top editor bar for translate mode The text tools were moved in the right panel with a temporary solution but as there is no right panel in translate mode, the text tools were just floating summernote-way. This commit restores the top editor bar in that case while waiting for the new editor. Part of https://github.com/odoo/odoo/pull/58347 closes odoo/odoo#58347 Signed-off-by: Quentin Smetz (qsm) --- .../static/src/js/editor/wysiwyg_multizone_translate.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'addons/website/static/src/js') diff --git a/addons/website/static/src/js/editor/wysiwyg_multizone_translate.js b/addons/website/static/src/js/editor/wysiwyg_multizone_translate.js index 0541d60bf33..978ac4d98a6 100644 --- a/addons/website/static/src/js/editor/wysiwyg_multizone_translate.js +++ b/addons/website/static/src/js/editor/wysiwyg_multizone_translate.js @@ -91,6 +91,9 @@ var WysiwygTranslate = WysiwygMultizone.extend({ */ start: function () { var self = this; + // Hacky way to keep the top editor toolbar in translate mode for now + this.$webEditorTopEdit = $('
').prependTo(document.body); + this.options.toolbarHandler = this.$webEditorTopEdit; this.editor = new (this.Editor)(this, Object.assign({Editor: RTETranslatorWidget}, this.options)); this.$editor = this.editor.rte.editable(); var promise = this.editor.prependTo(this.$editor[0].ownerDocument.body); @@ -133,6 +136,13 @@ var WysiwygTranslate = WysiwygMultizone.extend({ self._markTranslatableNodes(); }); }, + /** + * @override + */ + destroy: function () { + this._super(...arguments); + this.$webEditorTopEdit.remove(); + }, //-------------------------------------------------------------------------- // Public -- cgit v1.2.3