[FIX] web_editor, website: fix website edition with rtl languages
Before this commit, for the following flow: - Add arabic language (or any other rtl language), - On one of the websites, set it as the only website's language, - Reload and go to the client action, => The frontend is correctly displayed in rtl, - Click on edit, => The frontend, in the iframe, is reverted to ltr, The WysiwygAdapter, introduced in [1], was not passing the correct direction option to the OdooEditor, which would revert the editable to the default 'ltr' direction. [1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b task-2687506 X-original-commit: 2f463ca65b149122c85a04b20b4f82e0be479fc8 Part-of: odoo/odoo#101972
This commit is contained in:
@@ -202,7 +202,7 @@ const Wysiwyg = Widget.extend({
|
||||
commands: powerboxOptions.commands,
|
||||
categories: powerboxOptions.categories,
|
||||
plugins: options.editorPlugins,
|
||||
direction: localization.direction || 'ltr',
|
||||
direction: options.direction || localization.direction || 'ltr',
|
||||
collaborationClientAvatarUrl: `${browser.location.origin}/web/image?model=res.users&field=avatar_128&id=${this.getSession().uid}`,
|
||||
}, editorCollaborationOptions));
|
||||
|
||||
|
||||
@@ -279,6 +279,7 @@ export class WysiwygAdapterComponent extends ComponentAdapter {
|
||||
showEmptyElementHint: false,
|
||||
getReadOnlyAreas: this._getReadOnlyAreas.bind(this),
|
||||
getUnremovableElements: this._getUnremovableElements.bind(this),
|
||||
direction: this.websiteService.currentWebsite.metadata.direction,
|
||||
...this.props.wysiwygOptions,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ export const websiteService = {
|
||||
editable: !!document.getElementById('wrapwrap'),
|
||||
viewXmlid: viewXmlid,
|
||||
lang: document.documentElement.getAttribute('lang').replace('-', '_'),
|
||||
direction: document.documentElement.querySelector('#wrapwrap.o_rtl') ? 'rtl' : 'ltr',
|
||||
};
|
||||
}
|
||||
contentWindow = document.defaultView;
|
||||
|
||||
Reference in New Issue
Block a user