REASON FOR THE FIX To correctly display the overlay over a rotated element, we need to reset the transform of the element, to be able to apply it on the overlay. Changing the style of the element in the SnippetEditor cover method would trigger a DOM mutation, which will result in setting the odooEditor observer unactive. The issue was that flushing the observer (when setting it unactive) would always send an event observerApply, even if no record was processed. It was an issue as the SnippetsMenu was triggering a content_changed event at the reception of this event, which would rerender the SnippetEditor overlay cover (and create an infinite loop of events). SOLUTION To avoid that, the observerApply event is sent only if records were processed. Part of https://github.com/odoo/odoo/pull/74592 task-2554608
Odoo editor
A fast wysiwyg editor targeting documents and website structures.
Key features
Unbreakable nodes
When editing some sections of a website, there is a possibility for a selection to start or end within a node that is contained in an unbreakable.
If the user deletes the content of the selection, the unbreakable node should not be merged with another one.
Demo
To open the demo page:
http://<host:port>/web_editor/static/lib/odoo-editor/demo/index.html
Tests
To open the test page, go to
http://<host:port>/web_editor/static/lib/odoo-editor/test/editor-test.html
Prettify
# install prettier
npm install -g prettier
# prettify
prettier --config '<odoo-path>/addons/web_editor/static/lib/odoo-editor/_prettierrc.js' --ignore-path='<odoo-path>/odoo/addons/web_editor/static/lib/odoo-editor/_prettierignore' '<odoo-path>/odoo/addons/web_editor/static/lib/odoo-editor/**/*.js' --write
Prettify with vscode
Install vscode extention esbenp.prettier-vscode.
Add the following configuration in your vscode user config or workspace config:
"prettier.requireConfig": true,
"prettier.configPath": "<odoo-path>/odoo/addons/web_editor/static/lib/odoo-editor/.prettierrc.js",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
Then you can use the command Format Document or use ctrl+h to format a file.