164df578fcf601bed34413ba289dfc8ae20da22b
Short read version: This commit gives the Wysiwyg class the attribution of switching between the two types of text editor toolbar (floating or part of the sidebar), instead of the SnippetsMenu class, as Wysiwyg owns the Toolbar instance and has the methods to configure it. The switching between toolbars is now done by having one instance of each type (and properly displaying/hiding them), rather than moving the toolbar element of place in the DOM and reconfiguring it (button handlers, CSS classes, displayed/hidded buttons, etc), so that the configuration steps of each toolbar can be done only once. The floating toolbar is needed for mailings based on the "basic" theme, where no sidebar/SnippetsMenu is available. Note that it will be only instantiated if needed. Long read version: The 'basic' theme in mass_mailing has no sidebar (SnippetsMenu), so the floating toolbar should be available instead, in order to give users access to the text editor's features. Commit [1] added the `setFolded` method to the SnippetsMenu class, which folds (hides) the snippets menu and recovers the floating toolbar from the sidebar container and vice-versa. While the recovered toolbar works well when `isMobile` is `true` (although with some minor issues described below), the one for the non-mobile case does not (as it must be properly reconfigured using the document's Jquery, and not the iframe's, among other details). This commit proposes a different approach to the toolbar recovery issue: if the floating toolbar is needed (mobile or basic theme), a new Toolbar instance is instantiated and properly configured. That way the Wysiwyg instance will hold two instances of the toolbar: the one embedded in the sidebar (snippets menu) and the floating one. This allows for easy switching between the two types of toolbar, without the need to run the configuration steps for the toolbar on every switch. Such toolbar switching is needed in mass_mailing, where a single instance of the wysiwyg is kept while the user can switch between different records of mailings. Some of these records could be based on the 'basic' theme (thus, no sidebar), and other ones based on other themes that do offer the snippets menu. After this commit, the toolbar switching is handled by the Wysiwyg class instead of SnippetsMenu, as Wysiwyg owns the Toolbar instance(s) and has the methods to configure it. The `folded` property of SnippetsMenu and the `setFolded` method are leveraged by this commit, keeping its original purpose and meaning (except for the toolbar handling). Before this commit the floating toolbar for the mobile case had the following issues, that are fixed by this commit: - The "table" button was (incorrectly) displayed; - The default colors of the color picker (the top row) were undefined; - The 'Link' powerbox command and the toolbar icon should open the Dialog, and not the LinkTools (part of the sidebar). Finally, this commit removes the SCSS rules that hide the SnippetsMenu when the theme in "basic", as its display is already handled by SnippetsMenu's `setFolded` method, introduced by [1]. [1] https://github.com/odoo/odoo/pull/105472/commits/c589939eeaff928997bf6f9735b19710036f9ad6 task-3133259 opw-3165111 Part-of: odoo/odoo#117166
…
…
…
…
…
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%