Commit Graph
2059 Commits
Author SHA1 Message Date
qsm-odoo 41d9546061 [FIX] web_editor: add perf. optimization when toggling editor options
This allows to avoid tens of thousands of instructions being done at
each click in the editor.

At multiple places, the editor is asked to close all its widgets (for
example, when clicking on another snippet to edit). The original cost
of that action was to remove a class on each widget, which is a very
primitive action. But in the end we had to do more to close a widget: we
trigger_up an event and ask to close all sub widgets. When we ask the
editor to close all widgets... it makes sense not letting every sub
button of every select trigger_up an event.

closes odoo/odoo#79220

X-original-commit: 7aaf0e17f9c3d4e78b975dbd3747513d186ccc1e
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2021-11-02 09:58:51 +00:00
Anh Thao Pham (pta) 5e3f143f1c [FIX] web_editor: prevent editing document in iframe with cross-origin access issue
- Go to Email Marketing
- Create a new mailing with template having social media links
- Save
- Click on one of the social links
An error is triggered:
"Error: Blocked a frame with origin xxx from accessing a cross-origin frame."

The traceback occurs because we try to change the content of something we
don't have access to, as these sites prevent display in an iframe.

opw-2599540

closes odoo/odoo#79208

X-original-commit: 9702e541f27616a5249a140878d028335a0b3775
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-10-29 16:05:30 +00:00
Didier (did) 1afcc9c368 [IMP] bus, mail, *: improve longpolling bus notification format
* = auth_signup, calendar, im_livechat, snailmail_account, survey, test_mail,
    web_editor, website_crm_iap_reveal, website_livechat

The aim of this PR is to improve/fix various flaws and limitation of the current
API, to make it easier to use and more efficient.

Notification are now defined with 3 distinct parts:

- the channel determines which client(s) should receive it
- the type determines how it should be handled
- the payload determines any extra information helpful for handling it

Channel
=======

Business code
-------------

- Record channel is introduced for ease of subscribing to and sending
  notifications to specific partners, channels, documents, ...
- String channel is still supported (but it is converted internally to the tuple
  channel).
- Tuple channel is still supported without any change (but should be avoided
  whenever possible due to its complex syntax).

The channel is no longer sent to the client. When the channel was used for
business purpose, the information it contained has been moved into either the
new type, or the payload itself.

Technical note
--------------

All channels are now internally converted to the tuple (db, ...) channel, which
is necessary for the platform code (saas/sh).

Internally, the bus.bus table is not changed, type and payload are grouped
together into what was (and still is) called message.

Type
====

Type is introduced to uniformize the way notifications are sent and handled.
All existing notifications already had some kind of manually-built type in them.
This is now officially supported at the bus API.

In client code this will allow (to be done in future commits) to register one
handler per specific type, instead of having to iterate and to filter all
received notifications on every handler.

Payload
=======

Payload (ex message) did not change, it can still be anything depending on
business needs.

Few adaptations:
- When the type was included on the payload, the type has been moved to the new
  type parameter.
- When the channel was used in business code, its data has been copied into the
  payload.

task-1891151

closes odoo/odoo#79201

X-original-commit: 543af27c7d6836ffac9e80ff8490b6ddbd849221
Related: odoo/enterprise#21998
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-29 16:05:23 +00:00
Benjamin Vray f534d20674 [FIX] web_editor, *: fix active class disappearing on tabs snippet
* = website

Before this commit, the active class of the tabs snippet buttons
disappeared when leaving the edition of the buttons.

After this commit, it is no longer possible to enable link options for
the buttons of the tabs snippet and accordion snippet. Being able to
customize these buttons introduces too many bugs and is not really
necessary.

task-2656662

closes odoo/odoo#79190

X-original-commit: 7f33cdcd14ef753cc5bf823bfc1de0d2431e285a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-29 12:39:58 +00:00
Nicolas Bayet e2763e0f8b [FIX] web_editor: use wrapper around video
When pasting an youtube url in the website builder, the iframe
was inserted without the wrapper used by the website builder.
Now we use the same wrapper as by adding a video through the
video modal.

task-2668224

closes odoo/odoo#79095

X-original-commit: 0cffd7fcdc631b95795d9d819197e5f91ed8195c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-28 07:49:21 +00:00
Nicolas Bayet 403c06504d [FIX] web_editor: always show codeview button
When activating the editor code view, the button is hidden in
the floating toolbar. This commit always shows the button when
the codeview is activated for a particual html field.

Task-2672259

closes odoo/odoo#79072

X-original-commit: 66d706bbcc1cd49e69f58ac154eee2d6f2ec3628
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-27 14:01:47 +00:00
Antoine Guenet 7dd6698bd4 [FIX] web_editor: properly display the state of list in the toolbar
When selecting text in a list, the toolbar should show that a list is
selected, and which type. It however failed to do that, which is fixed
with this commit.

task-2638422

closes odoo/odoo#77738

X-original-commit: 2a7436d83abe178bd21c0694edc9825f5d70d65f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
Part-of: odoo/odoo#79057
2021-10-27 11:56:15 +00:00
xO-Tx ce3b09dff2 [FIX] web_editor: fix empty save on dialogs
I- mediaDialog/linkDialog:

1- Website editor > Add image/link using "/" commands.
2- The mediaDliaog/linkDialog will be shown to select item.
3- Click on "Add/Save" without selecting any image/setting
   any link.
4- traceback.

II- mediaDialog (Video):

The same flow for videos will add an empty <iframe> (with
no src specified) to the DOM.

The goal of this commit is to prevent this behaviour
by adding a test on values passed to the 'save' event
listeners.

task-2628964

closes odoo/odoo#78967

X-original-commit: 1e5c7d6f3525823101215cb18b44d2b936c9c521
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-26 07:48:10 +00:00
Kishan Gajjar 27e0307c07 [FIX] web_editor: link widget should respect native bootstrap class
Before this commit, When you try to edit the link then the link widget is
removing 'btn-block' class from the class list of the link node.

After this commit, the link widget will allow using 'btn-block' class.

closes #78511

closes odoo/odoo#78783

X-original-commit: 888687b487e95b4bf4fb080118b5eb945c8ab724
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
2021-10-21 19:09:52 +00:00
Benoit Socias 9b854f5d39 [FIX] web_editor: make class-based colors selectable for custom buttons
Before this commit selecting a class-based color (gray scale,
o-color-1~5) was ignored when configuring a custom button colors.

After this commit the color's class is applied.
Additionally, upon switching between Custom and other types, the custom
UI is now cleaned up.

task-2653874

closes odoo/odoo#78720

X-original-commit: 26d37812f0217ae913c8ddf761bcb26b5c44bff5
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-20 17:53:40 +00:00
Benoit Socias 6087585f3b [IMP] web_editor: reset button text styles when customizing button
Before this commit if button text had styles, they would override the
color set by customizing the button.

After this commit button text styles are removed when applying custom
button colors.

task-2653874

X-original-commit: 03c02639f1e92b58a38d8efb620b17761ae2d81d
Part-of: odoo/odoo#78720
2021-10-20 17:53:40 +00:00
Barad Mahendra 281b65a943 [FIX] web,*_*: fix the html content in notification
Currently markup-ification of the legacy notifications system
display the html content in notification layout for some of the
notification of document and planning from commit: https://github.com/odoo/enterprise/commit/ba44461fea337ed2e5adbdfa1e8eede00b036def

So here in this commit, we make the method `makeLegacyNotificationService`
always `_.escape(message)` and pass `messageIsHtml: true` to the owl
notifications system so notification with html content will be displayed
properly.

Task-2657391

closes odoo/odoo#78627

X-original-commit: 7ce6d8d70be79c9c626865598b898dce9a18b045
Related: odoo/enterprise#21782
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-10-19 14:43:42 +00:00
xlu-odoo 6dd4ddab2b [FIX] web_editor: fixing border-radius on dropdown menu entries
Prior to this commit, every dropdown menu entries in the web editor
had a border-radius on them. It didn't look consistent and clean.

This commit fixes those menu entries by either removing or applying a
correct border-radius.

closes odoo/odoo#78492

X-original-commit: 0239ab7efcaf3895ffb14a56a0686cf5a80bb529
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-18 10:21:53 +00:00
Benjamin Vray 2e57d784d3 [FIX] website, web_editor: fix overlay options of the timeline snippet
Before this commit, the CSS of the overlay option buttons of the
timeline snippet was broken.

task-2648348

closes odoo/odoo#78491

X-original-commit: 13770d650def3107378fe4010aac48dc85a5256a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-18 10:21:49 +00:00
Benjamin Vray 5201f0fa0b [FIX] web_editor: prevent inline snippet drop in non-inline area
Before this commit, it was possible to drop an inline snippet (e.g.
badge, cards, etc.) next to a section when this section was a snippet
which can be dropped as main snippets or as inline snippets (e.g.
countdown, embed code, etc.).

task-2648348

closes odoo/odoo#78483

X-original-commit: e2f218fbb3d9bab9dba380582aa93e80fa9becc1
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-18 10:21:44 +00:00
Sébastien Geelen (sge) 6b264fab91 [FIX] web_editor: use color css name fix reset color
`_updateEditorUI` was reseting color to old or non css color value.
due to a race condition in the editor selection.

task-2654666

closes odoo/odoo#78499

X-original-commit: fd3791d79377b270ab98d646710ecc1d2f364810
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Sébastien Geelen <sebgeelen@users.noreply.github.com>
2021-10-18 06:49:54 +00:00
Sébastien Geelen (sge) f41f5cf3df [FIX] web_editor: Properly remove link tools frame
In mass mailing the link tools borders were not removed properly
because the element couldn't be found inside the Iframe with a $() selector.
Changed to use the `this.$link` of the `link_tool` class.

task-2634073

closes odoo/odoo#78416

X-original-commit: 4acdd17eba2a4175d1bec33397aebeadb1d5bc04
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Sébastien Geelen <sebgeelen@users.noreply.github.com>
2021-10-15 06:16:46 +00:00
Brieuc-brd b20aeb3a4f [FIX] web_editor: fix visual issues in bg shapes
This commit fixes visual issues (pixel gap between shapes and bugs in
colors) in some background shapes.

task-2547435

closes odoo/odoo#78013

X-original-commit: 861dba13657f1ca41c40304abd212c521a6615de
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-08 07:19:58 +00:00
fb20b16d48 [FIX] web_editor, *: review icon buttons sizing and paddings
*: mass_mailing, website, website_sale

Before this commit, it was impossible to add `fa-fw` directly on a
`we-button` as it would make the icon half invisible, since the whole
`we-button` would have the font-awesome `.fa-fw` css rule applied on it;
width: ~1.28em.

Then, one would need to insert a `<i/>` tag inside the `we-button` for
it to work.

This commit improves that behavior by handling automatically such cases,
and will preserve the purpose of the `fa-fw` class which is to have a
fixed width for those icons.

Note that the util class introduced in [1] (o_we_button_icon renamed
here in o_we_icon_button) is still useful to handle the case of svg
images, they are not allowed to shrink, the same way the fa buttons are.

[1]: https://github.com/odoo/odoo/commit/e4233643b93b521454cc146c6a2ae876781fb9ba

Related to task-2172311

closes odoo/odoo#77980

X-original-commit: e8ab9d76b802e80bb386812e4c8566825cbc2c92
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Younn Olivier <yol@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-10-07 13:09:26 +00:00
qsm-odoo b5d357e45d [FIX] web_editor: restore overlay padding controls
Sometimes the padding controls disappeared for no apparent reason. This
was when going from a child element to a parent element -> following
BVR's investigation, it apparently appears that the UI is not updated
anymore since already visible and nothing should have to be updated
since [1].

While waiting for a deeper investigation about the onFocus / ui update
flows, this commit restores the padding controls another way: by simply
not hiding them and showing them again at each blur / focus. It does not
seem needed indeed... or at least I cannot find a reason why right now.
Indeed, it was not the case before [2] which changed the system without
any explanation. With [3], the onFocus part was later moved to updateUI
since each onFocus calls are now followed by an UI update. But in this
case, like before [2], it only seems needed to show or not the padding
controls at option initialization.

Deeper investigation and refactoring will follow.

[1]: https://github.com/odoo/odoo/commit/806a8db35b5e0e6a461422f5bba7c97180c3ef29
[2]: https://github.com/odoo/odoo/commit/4f27e52cabb77b8b1a9637a11185ddf882adc9af
[3]: https://github.com/odoo/odoo/commit/3be9ae5672f76f85cd747f57539e7bc2919850f8

closes odoo/odoo#77929

X-original-commit: 4de5d51948a121bb6df716f1b99cd86511b9cba9
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-05 22:21:01 +00:00
Benoit Socias f2a44d192d [FIX] web_editor: handle gradient styles only when gradients allowed
Before this commit the progress bar options were broken because the
stripe effect is achieved by a gradient in the CSS, but
`SnippetOptionWidget` recognized it as a manually selected gradient, and
thus applied the gradient specific handling (such as neutralizing the
background-image when a color is selected).

After this commit the special handling for gradients is only applied
where gradients are expected to be selected manually (i.e. when the
`withGradients` parameter is set).

task-2662401

closes odoo/odoo#77881

X-original-commit: f873c1d1eb05fa25717817c85899629103dcada3
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-05 15:41:55 +00:00
Younn Olivier 8563d989f3 [FIX] web_editor: reduce M2M widget rpc
Every options UI is updated when one is updated.
The Many2manyUserValueWidget is built in a way that every UI update will
trigger 2 rpc to get the records to display to the user, even if it is
not the option containing the widget that has been updated.

These rpc are now cached at the widget level.

This commit also fixes a bad computation of the Many2manyUserValueWidget
search domain.

task-2629245

X-original-commit: 847aecb4f9f4647e55e454d8c6560aa267f17c64
Part-of: odoo/odoo#77873
2021-10-05 15:41:27 +00:00
xO-Txandqsm-odoo dd55d6376c [FIX] website, *: fix content/design of header templates
*: web_editor, website_sale_wishlist

The goal of this commit is to fix the issues with the header templates
and their related options. Such as:

- Alignment of inline language selector
- Alignment of CTA / Template content
- Add missing CTA in some templates
- Bugs with off-canvas hamburger menu

Unfortunately, it will require more work to make everything perfect.

task-2636546

closes odoo/odoo#77862

X-original-commit: 2a000e33c5a44ddf0a777b43d8266cc413d8e4e2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-10-05 14:18:01 +00:00
stefanorigano (SRI) 0ce66837ae [REF] web_editor: add a function to create odoo palettes
This commit adds a sass function that, given one or two colors, returns
an odoo palette in sass-map format.

The palette will be generated using the safest values possible, setting
'o-color-4' always  to '#FFF' and shifting predefined colors' HUE to
match the primary color passed to the function.

Overrides (eg. 'menu': 4) are supported trough the '$-overrides-map'
method.

The commit will also allows to customize the "has-enough-contrast"
function threshold. Indeed, prior to this commit, the threshold value
was locked to '500' in order to spot contrast issues against the tiniest
elements (eg. small text).

Using a more forgiving '300' value, for example, allows to verify
readability of a solid button against a bg.

task-2656337

X-original-commit: 61f014a955ed9b9d33e7289c2a8a273a4179b088
Part-of: odoo/odoo#77857
2021-10-05 14:17:48 +00:00
qsm-odoo a177593572 [FIX] web_editor: restore column count snippet option
When decreasing the number of columns through the column count snippet
option, the editor entered a deadlock situation.

This reverts [1] which is the cause, trying to await the UI update
during a snippet removal. This commit first prevents the deadlock while
waiting for a better solution to be implemented.

[1]: https://github.com/odoo/odoo/commit/ab7508393376075f95d6dd5925e7f4462936d24e

task-2652904

closes odoo/odoo#77848

X-original-commit: ae219ec06baf0280c76ae09b1453cc1481eece30
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-05 14:17:18 +00:00
Antoine Guenet 71c4b35ea1 [FIX] web_editor: properly size text on transpiling for emails
The body's font size and line height were lost on transpiling it for
emails. This restores them by applying them to the mailing's top
element.

Part-of: odoo/odoo#77724
2021-10-04 15:31:12 +00:00
Antoine Guenet ecad4b282e [FIX] web_editor: properly convert inherited and inline color styles
The mass mailing transpiler wrongly applied inherited colors to children
and failed to take inline styles into account, while those are supposed
to have the highest specificity.

Part-of: odoo/odoo#77724
2021-10-04 15:31:12 +00:00
Antoine Guenet 6e5827e472 [FIX] web_editor: prevent glitches on field html iframe loading
When loading a field html iframe, there are sometimes display glitches
due to the iframe's contents and assets loading lazily. This prevents
those glitches by hiding the iframe until it is fully loaded, creating
a better user experience.

Part-of: odoo/odoo#77724
2021-10-04 15:31:12 +00:00
Antoine Guenet 47584e6716 [IMP] mass_mailing: show body_arch in readonly, body_html in a debug tab
The body of a mailing is saved in two fields: body_arch without
modifications, and body_html with conversion for email client
compatibility. Prior to this commit, we were showing body_html when
opening the form view of a saved mailing in readonly. This was pretty
strange and confusing as it's a sort of intermediary version that
doesn't mean much: an in-browser rendering of html that is compiled for
email clients.
With this commit, we change the view to always show body_arch instead.
A new tab is introduced in order to show body_html for debugging, which
is therefore only visible in debug mode.

Part-of: odoo/odoo#77724
2021-10-04 15:31:11 +00:00
Antoine Guenet ff9a77c4be [FIX] mass_mailing, web(site,_editor): restore original website options
Commit [1] copied a lot of website snippet options into mass mailing.
Some were moved to web_editor and xpathed to be used in both without
duplicating code. Sadly that is not without side effects and it was
therefore decided to duplicate them instead so they can live separate
lives in the future.

[1] https://github.com/odoo/odoo/commit/4f7cd33d0fd69ee5984d0968233ffc73d7751030

Part-of: odoo/odoo#77724
2021-10-04 15:31:11 +00:00
Antoine Guenet 1ab19096fe [FIX] web_editor: properly display icons in iframe sidebar
`we-button`s, `we-toggler`s and `we-select-items` with no text content
don't properly take up their full height in iframes. This solves that
issue by ensuring a text content at all time, albeit an invisible one.
This is a bit of hacky solution perhaps but one that consistently works
across browsers.

task-2554899

X-original-commit: e59ad49cb9f32240d8ca3c89fc20ab200e291adc
Part-of: odoo/odoo#77724
2021-10-04 15:31:08 +00:00
Antoine Guenet d240d3a2ee [IMP] web_editor, mass_mailing: disable transparency in mass mailing
Transparency is not supported in several leading mail clients. This adds
the option to completely remove transparent colors from the palette, and
uses that option in `mass_mailing`.

task-2554899

X-original-commit: 4e2c859b6d4fb8d9c12e24d1c8ebc84aa0f3c72e
Part-of: odoo/odoo#77724
2021-10-04 15:31:08 +00:00
Antoine Guenet 82711f772a [FIX] web_editor: properly drop to nearest in iframe
The feature to drop snippets to the nearest allowed position was broken
in iframes because of a reference to a JQuery contained in a different
document than the editable area. This restores the feature in all cases.

task-2554899

X-original-commit: 4be474283f7fb6abbea8707d346f0d71939efce2
Part-of: odoo/odoo#77724
2021-10-04 15:31:08 +00:00
Antoine Guenet 38c8533575 [FIX] mass_mailing, web_editor: prevent dropping snippets out of mailing
Prior to this commit, it was possible to drop snippets out of the
confines of the mailing's body and into its editable parent instead.
This makes that impossible.

task-2554899

X-original-commit: e3942e4aa1391ca82a946d4b6b3823d2690733ee
Part-of: odoo/odoo#77724
2021-10-04 15:31:07 +00:00
Antoine GuenetandElisabeth Dickinson d0c2d8e9a1 [ADD] mass_mailing, web[site|_editor]: website snippets to mass_mailing
The following snippets (and their relevant options) were added to
`mass_mailing`, mostly duplicated from the website builder:

- s_cover
- s_title
- s_text_block
- s_comparisons
- s_color_blocks_2
- s_three_columns
- s_image_text
- s_text_image
- s_picture
- s_features
- s_numbers
- s_masonry_block
- s_media_list
- s_showcase
- s_company_team
- s_call_to_action
- s_references
- s_product_list
- s_features_grid
- s_alert
- s_rating
- s_blockquote
- s_hr
- s_text_highlight
- s_coupon_code

The following snippets were removed to make way for the new:

- s_mail_block_banner
- s_mail_block_title_sub
- s_mail_block_paragraph
- s_mail_block_comparison_table
- s_mail_block_two_cols
- s_mail_block_three_cols
- s_mail_block_image_text
- s_mail_block_text_image
- s_mail_block_image
- s_mail_block_footer_separator
- s_mail_block_steps
- s_mail_block_discount2

The following standalone snippet options were added, mostly duplicated from the
website builder:

- Box
- layout_column
- SnippetMove
- snippet_options_text_align (via web_editor)
- snippet_options_width (via web_editor)
- snippet_options_block_align (via web_editor)
- BodyWidth (based on ContainerWidth but only for the mailing's body)
- minHeight
- so_snippet_addition
- so_content_addition
- sizing_x
- vAlignment

Styles and selectors were adapted to the specifics of `mass_mailing`.

task-2554899

X-original-commit: e5e1d4255ab416581b2ef7159c0c28540528771c
Part-of: odoo/odoo#77724
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Elisabeth Dickinson <edi@odoo.com>
2021-10-04 15:31:07 +00:00
Antoine Guenet 066e1c7c84 [IMP] mass_mailing: multiple transpiler improvements
This brings a series of improvements to the mechanism in place to
convert the output html of mass mailing into html that is more compliant
with the main mail clients' requirements.

The biggest change is the automatic conversion of Bootstrap grids into
table structures. Currently all templates in `mass_mailing` are designed
with tables so they work in mailings as is. That has limitations though
as it makes it less easy to edit with snippets such as those used in the
website builder. This new automatic conversion from Bootstrap grid will
allow us to adapt the mailing and snippet templates and be more free
within `mass_mailing`.

Note: Because of the limited support of media queries in emails, this
doesn't support the mixing and matching of column options
(e.g., `"col-4 col-sm-6"` and `"col col-4"` aren't supported).

Other changes include:
- The conversion of Bootstrap cards to table structures
- The conversion of Bootstrap list-groups to table structures
- The conversion of snippets (.o_mail_snippet_general) and mailings
    (.o_layout) into table structures
- The conversion of all rgb colors to hexadecimal
- The conversion of all "rem" sizes to "px"
- Various small corrections to the output styles

task-2554899

X-original-commit: e2e00939e09220051f6f4ecfb7bb3276105387bf
Part-of: odoo/odoo#77724
2021-10-04 15:31:06 +00:00
David Monjoie f312e1359a [FIX] web_editor: do not encode link text
These encode/decode shenanigans seem to be unnecessary since we are not
using summernote anymore. Moreover, the encode process was destroying
the html structure of nodes contained in the link, only making a special
case to maintain images. This is not sufficient anymore because the
Cards option of website mega menu does make use of custom html content
inside a link. This content was therefore destroyed on edition and
replaced by its textContent because of the encode function.

task-2652361

closes odoo/odoo#77654

X-original-commit: 80004b1819fa1e1e7cfdd03a285de9d4ee845356
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-04 12:51:56 +00:00
b63ee52552 [FIX] *: remove scss 'extend' from dropdown components
This commit removes all the 'extend' initially introduced to avoid code
repetition and ensure visual consistency across Bootstrap and Owl dropdowns.

Despite achieving the desired results, using 'extend' in this context
was seriously impacting the bundle generation time, probably due to an
underestimated amount of Apps' legacy-code applied on these elements.

In order to achieve the same results, the chosen strategy is to add
Bootstrap default classes directly into Owl dropdowns.
Also, it moves code related to bootstrap dropdown in 'webclient.scss',
leaving 'core/dropdown/dropdown.scss' for Owl code only.

Due to the discrepancies between Bootstrap and Owl html
structure, the '.dropdown-item' class could not have been added
directly to Owl's '.o_dropdown_item' itself, without refactoring
the Dropdown component structure.

// ==== Bootstrap 4.6 default Structure ================================
<div class="dropdown-menu">
  <button class="dropdown-item" type="button">Action</button>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== OWL default Structure before this commit =======================
<ul class="o_dropdown_menu">
  <li class="o_dropdown_item">
     <span>Action</span>
  </li>
  <li class="o_dropdown_item">
     <a href="#">Another action</a>
  </li>
</ul>

// ==== OWL Structure after this commit ================================
<div class="o-dropdown--menu dropdown-menu">
  <span class="dropdown-item">Action</span>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== web.assets_backend.css Bundle Generation Comparison ============
With all modules installed (enterprise edition over runbot):
Before this commit, bundle took ~2.5s and ~4s to generate and weighted ~322kB (~2.5MB uncompressed)
After this commit, it takes between ~1.2s and ~1.6s and weights ~257kB (~1.6MB uncompressed)

closes odoo/odoo#77649

X-original-commit: 84715436d87bb05b421bc9ccaacda67d07571690
Related: odoo/enterprise#21370
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Stefano Rigano <sri@odoo.com>
Co-authored-by: François Georis <fge@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
2021-10-04 07:57:00 +00:00
qsm-odoo a54f11edb1 [REF] web_editor, website: remove some start15 compatibility code
With the forward-port at [1], it was forgotten to adapt the PR to
simplify the code that was added to support current start15 databases.

[1]: https://github.com/odoo/odoo/pull/77255

closes odoo/odoo#77630

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-01 20:42:07 +00:00
xO-Tx 98a0376a14 [FIX] web_editor: fix Theme tab infinite loading
ISSUE:

The click on "THEME" tab in editor panel triggers the
'_onThemeTabClick' method which:

1- Starts the loader ('_execWithLoadingEffect' method).
2- Runs '_activateSnippet' which uses the same mutex as the
loader.

Execution order:

A1- '_execWithLoadingEffect' with promise: adds the loader in
the DOM immediately.
A2- '_activateSnippet' sets a second loader to be added after
a delay = 500.
A3- 'releaseLoader' removes the first loader.
A4- '_activateSnippet' ends : (before adding the second
loader: t(4) - t(2) < 500) and timeout is cleared.

In some cases we get t(4) - t(2) > 500 which adds a second
loader to the DOM, and the new flow will be:

B1- Same as A1.
B2- Same as A2.
B3- Second loader added to the DOM / replaces the first one
in 'loadingElements'.
B4- 'releaseLoader' removes the second loader (from the DOM
& 'this.loadingElements').
B5- Same as A4 but the first loader still in the DOM.

The goal of this commit is to fix this behaviour by preventing
more than one loader on the target element.

task-2656308

closes odoo/odoo#77500

X-original-commit: 9f21b2eefab2115c1b8581ad9f43fe1e65f934ed
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-30 13:32:06 +00:00
Nicolas Bayet e52bde906f [IMP] web_editor: allow qweb edition
Add a plugin for the Odoo editor that includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching
- style t-tags to make them stand out

Task-27033

X-original-commit: odoo/odoo@300da82eb4
Part-of: odoo/odoo#77377
2021-09-28 23:42:55 +00:00
Nicolas Bayet 4813f42997 [IMP] mail,*: replace jinja with qweb
Jinja as a templating engine was problematic in differents respect:
- introduce external dependency to Odoo (less controll)
- add another templating mechanism in the stack
- specific feature in qweb cannot be reused
- difficulty in rendering easily editable templates
- more knowledge required with no betterment

By replacing jinja with qweb we can now build tools to edit a qweb
that will work with the previously jinja encoded document
(essentially `mail.template` records).

There is a catch however. Some email fields (eg. email_to) used jinja
syntax for rendering dynamic variables (ie. ${object.something} and
${object.something_that_should_not_be_escaped | safe}).

We still want user to use dynamic variables for some char fields (eg.
subject, from, to, ...). We made a new rendering engine called
"inline_template" that will render an expression enclosed by `{{` and
`}}`.

To be able to edit the templates from the backend interface, a
plugin to the Odoo editor has been made for seamlessly edit the
document.

This qweb plugin includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif, and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching

Task-27033

X-original-commit: odoo/odoo@68182baff4
Part-of: odoo/odoo#77377
2021-09-28 23:42:54 +00:00
Nicolas Bayet 21e9088839 [FIX] web_editor: save codeview changes
Before this commit, if there were a change in the codeview of the
field html and the record was saved while the codeview was still open,
the changes made in the codeview were not saved.

closes odoo/odoo#77367

X-original-commit: d8a9d23a66d3662fc1c5e4e07e35a1de6800ffa5
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-09-28 21:02:18 +00:00
Sébastien Mottet (oms) 433f6c2758 [FIX] website, web_editor: prevent mega menu removal
The user was able to remove the mega menu snippet without removing
the corresponding link in the menu. To avoid this flow to happen
we removed the delete button for the mega menu snippet. We also
handle the case where the user remove the mega menu snippet element
by element. On last element removal we put back the original template.

task-2636545

closes odoo/odoo#77256

X-original-commit: 97810a9c40396bb27cb5779937734849d185cf1f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-28 09:29:09 +00:00
qsm-odoo 9d8803f6ba [IMP] web_editor: allow onRemove to be async
Now, a snippet option can do async operations in its onRemove
implementation.

task-2636545

X-original-commit: ef2e55d7f407dedfbf724f2cae32a0fcaede6890
Part-of: odoo/odoo#77256
2021-09-28 09:29:09 +00:00
qsm-odoo 48092fcf85 [IMP] web_editor, *: add a generic class for large editor widgets
*: website, website_payment, website_sale

Instead of having a "o_we_large_input" class, now to have large widget, we can
use the generic "o_we_large" class (a future update is needing that for a non-
input widget).

task-2431285

X-original-commit: a8446e5d0f0b10f99f8174c012a6a53e2134b77a
Part-of: odoo/odoo#77255
2021-09-28 09:29:02 +00:00
Nicolas Bayet a2cf13eec2 [FIX] web_editor: save zone with proper res_model
Without this commit, the method `saveModifiedImages` did not use
editables zone but rather the whole `$editable`.
Because of that, oeModel and oeId were undefined and saving images
was done without the proper metadata.

That made impossible the retrieval of the images from the method
`ir.qweb.field.image` `from_html` defined by the module `web_unsplash`.

task-2581567

closes odoo/odoo#77259

X-original-commit: c32ef686e9744fc66f372921fce5cfaff739a76c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-09-27 18:07:51 +00:00
Sébastien Geelen (sge) 0589b36506 [FIX] web_editor: collaboration should be opt-in
The new collaboration feature of the web editor was active by default.
We fix it to by making it an opt-in option on the field html.

X-original-commit: 86678b98dad069d864cb78baec5eb8af8bf30ce3
Part-of: odoo/odoo#77160
2021-09-24 14:00:45 +00:00
David Monjoie df1267f4d6 [FIX] web_editor: fix traceback when no image selected
closes odoo/odoo#77114

X-original-commit: aca97276446f8d9bd9977aeb665ae9a93d28a7bf
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-09-24 11:09:09 +00:00
Cocographique af666dff20 [IMP] web_editor: add new "Zigs" background shape
Related to task-2545200

closes odoo/odoo#77119

X-original-commit: 1624b1659d15df731a954912b88908a24aeddb5d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-24 01:50:16 +00:00