diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js index 4591670f29f..53bdf4301ad 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js @@ -408,6 +408,7 @@ export class OdooEditor extends EventTarget { this._tableUiContainer = this.document.createElement('div'); this._tableUiContainer.classList.add('o_table_ui_container'); const parser = new DOMParser(); + const isRTL = this.options.direction === "rtl"; for (const direction of ['row', 'column']) { // Create the containers and the menu toggler. const iconClass = (direction === 'row') ? 'fa-ellipsis-v' : 'fa-ellipsis-h'; @@ -418,13 +419,19 @@ export class OdooEditor extends EventTarget { `, 'text/html').body.firstElementChild; const uiMenu = ui.querySelector('.o_table_ui_menu'); - // Create the move buttons. if (direction === 'column') { - uiMenu.append(...parser.parseFromString(` -
` + this.options._t('Move left') + `
-
` + this.options._t('Move right') + `
- `, 'text/html').body.children); + if (isRTL) { + uiMenu.append(...parser.parseFromString(` +
` + this.options._t('Move left') + `
+
` + this.options._t('Move right') + `
+ `, 'text/html').body.children); + } else { + uiMenu.append(...parser.parseFromString(` +
` + this.options._t('Move left') + `
+
` + this.options._t('Move right') + `
+ `, 'text/html').body.children); + } this.addDomListener(uiMenu.querySelector('.o_move_left'), 'click', this._onTableMoveLeftClick); this.addDomListener(uiMenu.querySelector('.o_move_right'), 'click', this._onTableMoveRightClick); } else { @@ -438,10 +445,17 @@ export class OdooEditor extends EventTarget { // Create the add buttons. if (direction === 'column') { - uiMenu.append(...parser.parseFromString(` -
` + this.options._t('Insert left') + `
-
` + this.options._t('Insert right') +`
- `, 'text/html').body.children); + if (isRTL) { + uiMenu.append(...parser.parseFromString(` +
` + this.options._t('Insert left') + `
+
` + this.options._t('Insert right') + `
+ `, 'text/html').body.children); + } else { + uiMenu.append(...parser.parseFromString(` +
` + this.options._t('Insert left') + `
+
` + this.options._t('Insert right') + `
+ `, 'text/html').body.children); + } this.addDomListener(uiMenu.querySelector('.o_insert_left'), 'click', () => this.execCommand('addColumn', 'before', this._columnUiTarget)); this.addDomListener(uiMenu.querySelector('.o_insert_right'), 'click', () => this.execCommand('addColumn', 'after', this._columnUiTarget)); } else {