[IMP] web_editor,*: Refactoring the wysiwyg editor and 'html' field
* Creating a new structure by transforming all the plugins in the
library using the odoo inheritance system. Plugins are easier to
implement with the AbstractPlugin to add Odoo behaviors.
* From now on, the methods of the library (in this case Summernote) can
no longer be called by other modules or files. Only the wysiwyg
widgets can access it, to simplify the updating process. The wysiwyg
object serves as an interface.
* Depending on the options the snippets will be loaded or not, the
editor will be in an iframe or not... all of this is transparent from
the outside.
* Regarding iframes, all controllers related to editing have been
removed: the new API no longer needs them. This speeds up loading,
eases testing and removes complexity for the same
features.
PUBLIC FEATURES
There are several public methods on the Wysiwyg class:
* Wysiwyg.prepare (WidgetParent): returns a deferred resolved when the
library (xml, lazy, assets...) is loaded.
* Wysiwyg.getRange (DOM): returns the range (selection in the dom)
* Wysiwyg.setRange (startNode, startOffset, endNode, endOffset): creates
a range (selection in the dom)
* Wysiwyg.setRangeFromNode (DOM, options) that creates a range from an
element (option available to select all, start or end)
A jQuery selector was added: :o_editable, which indicates whether the
current element is editable. That is, if it is contained in a tag with
the attribute 'contentEditable = "true"' or in a tag with the class
o_editable.
Several methods are also present:
* focusIn: makes a focus and places the cursor at the beginning of the
element
* focusInEnd: makes a focus and places the cursor at the end of the
element
* selectContent: makes a focus and selects the content
HTML FIELD
The HTML field can receive different options:
* style-inline: {boolean} transforms a class into an inline style when
saving and vice versa when reading.
* no-attachment: {boolean} prevents the use of attachments (in media
dialog)
* cssEdit: {xml_id} to use a template containing the css to loaded in
an iframe when editing
* cssReadonly: {xml_id} to use a template containing the css to load
into an iframe when viewing in readonly
* snippets: {xml_id} snippets template (can be used with or without
cssEdit)
* wrapper: {template} qweb static template (containing a tag:
id = "wrapper") that will include the content during editing (removed
on save)
MASS MAILING
A widget was created for mass mailing. There are now two fields:
body_html and body_arch.
body_arch contains the code with the class without conversion into
inline style, useful when editing and one with the inline style that is
visible in readonly mode and sent by email.
Advantage: no spreading errors, able to update css/theme, able to do
more changes when converting to inline style so that a maximum of mail
clients have an impeccable rendering.
Co-authored-by:
Antoine Guenet <age@odoo.com>
Showing
- addons/mail/static/src/js/discuss.js 1 addition, 1 deletionaddons/mail/static/src/js/discuss.js
- addons/mass_mailing/__manifest__.py 3 additions, 0 deletionsaddons/mass_mailing/__manifest__.py
- addons/mass_mailing/controllers/__init__.py 0 additions, 1 deletionaddons/mass_mailing/controllers/__init__.py
- addons/mass_mailing/controllers/web_editor.py 0 additions, 26 deletionsaddons/mass_mailing/controllers/web_editor.py
- addons/mass_mailing/data/mass_mailing_demo.xml 109 additions, 59 deletionsaddons/mass_mailing/data/mass_mailing_demo.xml
- addons/mass_mailing/models/mass_mailing.py 3 additions, 2 deletionsaddons/mass_mailing/models/mass_mailing.py
- addons/mass_mailing/static/src/js/mass_mailing.js 37 additions, 0 deletionsaddons/mass_mailing/static/src/js/mass_mailing.js
- addons/mass_mailing/static/src/js/mass_mailing_field_text_html.js 0 additions, 29 deletions...ass_mailing/static/src/js/mass_mailing_field_text_html.js
- addons/mass_mailing/static/src/js/mass_mailing_snippets.js 10 additions, 302 deletionsaddons/mass_mailing/static/src/js/mass_mailing_snippets.js
- addons/mass_mailing/static/src/js/mass_mailing_widget.js 505 additions, 0 deletionsaddons/mass_mailing/static/src/js/mass_mailing_widget.js
- addons/mass_mailing/static/src/scss/mass_mailing.ui.scss 43 additions, 24 deletionsaddons/mass_mailing/static/src/scss/mass_mailing.ui.scss
- addons/mass_mailing/static/src/scss/themes/theme_default.scss 6 additions, 4 deletions...ns/mass_mailing/static/src/scss/themes/theme_default.scss
- addons/mass_mailing/views/editor_field_html.xml 14 additions, 35 deletionsaddons/mass_mailing/views/editor_field_html.xml
- addons/mass_mailing/views/mass_mailing_template.xml 4 additions, 7 deletionsaddons/mass_mailing/views/mass_mailing_template.xml
- addons/mass_mailing/views/mass_mailing_views.xml 8 additions, 1 deletionaddons/mass_mailing/views/mass_mailing_views.xml
- addons/mass_mailing/views/snippets_themes.xml 1 addition, 0 deletionsaddons/mass_mailing/views/snippets_themes.xml
- addons/mass_mailing/views/snippets_themes_options.xml 5 additions, 5 deletionsaddons/mass_mailing/views/snippets_themes_options.xml
- addons/mass_mailing/views/unsubscribe_templates.xml 1 addition, 0 deletionsaddons/mass_mailing/views/unsubscribe_templates.xml
- addons/note/data/note_demo.xml 35 additions, 37 deletionsaddons/note/data/note_demo.xml
- addons/point_of_sale/controllers/__init__.py 0 additions, 1 deletionaddons/point_of_sale/controllers/__init__.py
Loading
Please register or sign in to comment