Commit Graph
2437 Commits
Author SHA1 Message Date
stefanorigano (SRI) 9207b7aeea [FIX] web_editor: typography adaptations
Prior of this commit the paragraph margin-bottom was forced to '0'
braking the typography's vertical rhythm.

This commit will remove the customisation rules restoring bootstrap
default values for the backend.

task-2798759

closes odoo/odoo#86740

Signed-off-by: Antoine Guenet <age@odoo.com>
2022-03-29 20:20:39 +02:00
Thibault Libioulle 55a6f2e996 [FIX] web_editor: catch errors during save and allow to fix it
Prior to this commit, when an exception occured during the save of an
ir.ui.view, the traceback was shown to the user and an alert directly
asks the user to reload or cancel the page.

While reloading, the changes that produced the traceback were not saved
and the other modifications were saved.
If the user choose to cancel the reload, the web editor UI was freezed
and there couldn't be any edition anymore.

This commit adds correctly the popover to target the invalid element and
shows the error rather than reloading the page.
The element which caused the error can still be edited. The other are no
more editable.

task-2700198

closes odoo/odoo#87350

X-original-commit: 10b97f37ab5d78b3a2b0f63fa019ee95bb78ea7d
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Thibault Libioulle (tle) <tle@odoo.com>
2022-03-29 18:21:51 +02:00
Antoine Guenet 62f9e01d92 [REF] mass_mailing, web_editor: don't redefine target in generic methods
Commit [1] redefined the target in generic methods of snippet options so
that some buttons of the Design Tab snippet option could target a
different node than their parent option. This reverts that in favor of
the more generic `apply-to` data attribute.

[1]: c4bfedc37b

closes odoo/odoo#87325

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-03-28 17:55:28 +02:00
Antoine Guenet 2e23548b39 [IMP] web_editor, mass_mailing: convert svg to png to use shapes in mail
This allows users to use the shape feature on images in mass_mailing.
Since email clients do not support the svg file type, it converts these
svg images into png images on save.

task-2760157

Part-of: odoo/odoo#84926
2022-03-28 10:45:45 +02:00
Thibault Libioulle a423289419 [FIX] web_editor,website_sale: fix click on pricelist while editing
Prior to this commit, when a user edits the Shop page, clicks on the
pricelist dropdown and finally clicks elsewhere, a traceback occurs:
`Uncaught TypeError: Cannot read properties of undefined (reading
'getColorNames')`

This commit ensures the link tools is not toggles on dropdown links,
i.e. the customizable links selector does not contain the dropdown
anymore.

task-2695091

closes odoo/odoo#87300

X-original-commit: 73b98a53e8bd19b3b96502d6006b002819287e44
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Thibault Libioulle (tle) <tle@odoo.com>
2022-03-28 09:50:36 +02:00
Benjamin Vray 86e3bb5e24 [FIX] web_editor: fix data-no-check on specific snippet options
Before this commit, if an option targeting an element had a
data-no-check attribute this had the effect that all other options
targeting this element were also displayed even if they did not have a
no-check attribute (no-check => display the option even if it is
a non-editable element).

The issue came from the is() function of _computeSelectorFunctions which
did not take into account the no-check as it should.

Note: this is fixed in stable only as custom apps may rely on the broken
behavior. An issue with this in stable can be met by *hiding* the
related unwanted options with `_computeVisibility`. No case of this
problem currently exists in the Odoo codebase (but it will, that's how
the bug was found).

task-2710582

closes odoo/odoo#86011

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-03-25 16:51:45 +01:00
Nicolas Bayet 6b8bf0dd41 [FIX] web_editor: prevent opening linktool on uneditable links
Before this commit
When trying to open the linktool on link that are not
`isContentEditable`, the linktool was initialized and not
showed in the sidebar.

After this commit
As it does not make sense to edit a link that is not editable,
prevent the linktool from being initialized in the first place.

task-2802592

closes odoo/odoo#87203

X-original-commit: 4a634f2c5bfceb3f2dc200f9b391ef1cdbc0e697
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-24 18:10:55 +01:00
Antoine Guenet ad7c0d8ea4 [FIX] web_editor: prevent traceback on remove highlight color
This prevents a traceback when no closest block to the root node can be
found in the sanitizer.

task-2796371

closes odoo/odoo#87187

X-original-commit: 2104f33985472cd59f067d2f1403518a332fac6d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-24 18:10:51 +01:00
Antoine Guenet c4bfedc37b [ADD] mass_mailing, web_editor: add options to design a mailing globally
This adds options to the "Design" tab of mass_mailing so the user can
edit its stylesheet directly.

task-2789287

closes odoo/odoo#86881

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-24 17:12:12 +01:00
Antoine Guenet a9e79f8bda [ADD] web_editor, mass_mailing: add a "Design" tab to mass_mailing
This adds a tab to mass_mailing, that will be used to style the mailing
globally.

task-2789287

Part-of: odoo/odoo#86881
2022-03-24 17:12:12 +01:00
Benjamin Vray 29eda89bc7 [FIX] web_editor: fix scrolling the page while dragging a snippet
Since the commit [1], it's no longer possible to scroll the page while
dragging a snippet thanks to its thumbnail.

This is because for mass mailing the scroll element is not the same and
to check it we were looking for a class in the DOM. For that we did a
jQuery 'find' but without a 'length', the jQuery 'find' is always
truthy.

[1]: https://github.com/odoo/odoo/commit/29c6c80ac7009aa5068c763778342f7c6b115fad

task-2798872

closes odoo/odoo#87021

X-original-commit: d4b231222c5baf726332deddfe6d4c5e3e7865db
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-03-23 10:59:55 +01:00
Antoine Guenet 6b9ca81e76 [FIX] web_editor: replace oe-zws-empty-inline with new data attribute
This adapts new code which uses `oe-zws-empty-inline` to use the new
name `data-oe-zws-empty-inline` instead.

closes odoo/odoo#86930

X-original-commit: c8d892496e78beea804c80091f4b06dc2e858b59
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-22 22:12:56 +01:00
Antoine Guenet 6cd42319fa [FIX] web_editor: properly clean zero-width spaces inserted for formats
When inserting a format with a collapsed selection, we need to insert a
zero-width space. It should not be saved so we need to isolate it and
put the "oe-zws-empty-inline" attribute on its parent so it gets cleaned
up by the sanitizer.

X-original-commit: 4ce274ba39cd8046b9ef4e0b99df66913375f993
Part-of: odoo/odoo#86930
2022-03-22 22:12:55 +01:00
Antoine Guenet f41c3e4a42 [FIX] web_editor: unformat only if full selection is bold
Take `<p>a<b>bcde</b>f` and select the whole paragraph. If you click the
"bold" button, you would expect the whole paragraph to become bold. Only
if you only select "bcde" do you expect to unbold it. This is the
behavior of other editors. Odoo-editor so far was unbolding as long as a
part of the selection was bold.
The same applies to other formats.

Currently the format buttons are active when the closest start container
is that format but it should be active when pressing it would undo the
format, ie when the whole selection is that format. This harmonizes it
with the browser defaults.

task-2754127

X-original-commit: 69c5db26f81ace1a9a032b2ef7f488c997be00ad
Part-of: odoo/odoo#86930
2022-03-22 22:12:55 +01:00
Antoine Guenet 18ca8b44cd [FIX] web_editor: properly detect background color in toolbar
When a background color is applied on an ancestor, while it's visibly
there, `getComputedStyle` doesn't know. Because it did depend on it,
the toolbar showed the wrong color in these cases.
Eg: `<span style="background-color: red;"><b>a[]bc</b></span>` was
showing no background color.

task-2778416

X-original-commit: a125933b34500d51183bc5eb02a531fb3b293de5
Part-of: odoo/odoo#86930
2022-03-22 22:12:55 +01:00
Antoine Guenet 0f1071d309 [FIX] web_editor: properly toggle active link button
The link button was toggling its active state on every update of the
toolbar because we weren't passing the toggle function a boolean. and
if the element we were passing it was `undefined`, it triggered the
default behavior which is to just toggle. Instead we want it to be false
if the element is `undefined`.

X-original-commit: 7aecd36a169033a89defeb00ba0ae53cd64cdcd5
Part-of: odoo/odoo#86930
2022-03-22 22:12:55 +01:00
Antoine Guenet ab37804400 [FIX] web_editor: properly apply/unapply underline and strikeThrough
Underline and strikeThrough styles are special beasts in that they both
are applied to the `text-decoration-line` property. Unlike `font-weight`
or `color`, They behave like a border: setting
`text-decoration-line: none` to an element won't undo the value of the
parent and therefore the text will still show the decoration applied to
its parent. Similarly, nested decorations will apply over each other:
a text node whose parent has an underline decoration and whose
grandparent has a line-through decoration will be both underlined _and_
struck through.
Consequently, we can't treat these styles the same way we treat bold,
italic and colors:
1. To undo the style, we have to split the text from its styled ancestor
2. To apply eg underline to a struck through text, we have to insert a
   new span.

task-2778416

X-original-commit: 93102a7dcb3e2c1a5803ab99f2f924b0b24e44c2
Part-of: odoo/odoo#86930
2022-03-22 22:12:54 +01:00
Antoine Guenet fa417893a4 [FIX] web_editor: handle arrow keys next to zero-width spaces
Consider the following situation: `<p>a[]b<span><zws></span>c</p>`,
where `<zws>` is a zero-width space and `[]` is the collapsed selection.
On pressing the `ArrowRight` key, we want to enter the `<span>` so we
don't press once to be after the "b" then once again to be before the
`<zws>`. The cases with a non-collapsed selection, and with the left
arrow are analogous. This is what this commit allows us to handle.

X-original-commit: 8e1d5ff3f3bdef8ca2f0eb069c62140260aad3f6
Part-of: odoo/odoo#86930
2022-03-22 22:12:54 +01:00
Antoine Guenet 6844ff5a3f [FIX] web_editor: apply format, font-size and color collapsed
When the selection is collapsed it was impossible to set a format (bold,
italic, underline, strikethrough), a font-size or a color. This makes it
possible by inserting and selecting a zero-width space first, then
placing the caret to its left when we're done.

task-2778416

X-original-commit: b4eb0fe69bce5ca18d8450cd7118740f1d31f780
Part-of: odoo/odoo#86930
2022-03-22 22:12:54 +01:00
Antoine Guenet 3164697a7e [FIX] web_editor: ensure all formats use spans
The bold format is overridden to use inline style on a <span> rather
than a <b>. The other formats (italic, underline, strikethrough)
continued to use the default browser behavior. This harmonizes them.

X-original-commit: ce59bbd1c13d7fd4cc6971b89cc95386d95fcd75
Part-of: odoo/odoo#86930
2022-03-22 22:12:53 +01:00
Antoine Guenet 7411fc970b [FIX] web_editor: use styling commands on shortcut too
When pressing the italic or underline buttons, we pass through a command
in the editor. Their corresponding keyboard shortcuts however were not
intercepted by the editor and were therefore triggering the default
browser behavior. As a result we had different behaviors when using the
buttons and the shortcuts.

X-original-commit: 2e3c3b3a15fa6ff4fa209fc7dbac10864f8898a2
Part-of: odoo/odoo#86930
2022-03-22 22:12:53 +01:00
Nicolas Bayet 1428fe9542 [FIX] web_editor: set border and width of the table upon paste
task-2793106

closes odoo/odoo#86859

X-original-commit: e07a40f98999560aaa494bf2561811894e7775f7
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-22 12:00:45 +01:00
Nicolas Bayet c721d06995 [FIX] web_editor: load odooEditor base style
Before this commit
The style for `li.oe-nested` was loaded only when the editor loaded.
The problem is that the style needs to be visible even when the editor
has never been loaded.

After this commit
The style for `li.oe-nested` is always loaded in the backend and in
the frontend.

Task-2793528

closes odoo/odoo#86817

X-original-commit: 6c26e24c3d52410c0a3a06ee9a9d0aad6858a438
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-21 17:57:09 +01:00
Nicolas Bayet 691f574cb3 [FIX] web_editor: allow to paste images in the editor
task-2734733

closes odoo/odoo#86797

X-original-commit: 996b41b36ae5ea935760a5962887b2fcc02c86fa
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-21 17:00:56 +01:00
Benoit Socias 79a8e4fe8f [FIX] web_editor: use valid properties for hovered custom outline button
Since [1] the CSS property reset for hovered outline buttons is using
invalid property values.

After this commit the color and image are only reset on non-hover:
- the `background-color` is already set to `none` by `.btn`,
- the `background-image` is only set if defined on the button's style -
there is no need to reset it.

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

task-2633169

closes odoo/odoo#86699

X-original-commit: 8530235bff30bfcad55cf39927f0733d30fe2eee
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-03-20 22:09:12 +01:00
xlu-odoo 1f7d6213d4 [FIX] web_editor: style upload notifications
When applied, this commit will add correct classes and structure to fix
the style of upload notifications in the web editor. When an user
uploads an image, he gets a progress and validation (or error)
notification. We changed how notifications look at [1], but this
particular notification did not get the correct style.

[1]: https://github.com/odoo/odoo/commit/2629348090d6eabe8f9d3ae70a41f7ff7d45bbb6

task-2791078

closes odoo/odoo#86172

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-03-18 15:11:34 +01:00
Benoit Socias 3cf9416175 [FIX] web_editor: remove custom gradient button from colors inventory
Since [1] when resetting the background color of the header, the footer
or the copyright, the 'menu-custom' property is saved as the 'false'
string.
There is no visual effect of this problem, but in case that property is
used in an SCSS `color-yiq` function call, it will trigger an error.

This commit solves this by removing the root cause of this 'false'
string: during the initialisation of color palettes a list of named
colors is built by browsing the color buttons and associating their
data-color attribute to their background-color, except for buttons
containing a gradient color.
Unfortunately this inventory also looked at the "Custom" gradient
button: this button has no background color (and was thus not detected
as being a gradient and therefore not excluded from the inventory) and
it has data-color="false". It therefore introduced a mapping between ""
and "false" - thus making the reset operation's empty string mapped to
the "false" string. This commit removes that button from the named
colors inventory.

Steps to reproduce:
- select the header
- open the "Colors" palette
- click on the None button (the trashcan icon)
=> the customization properties attachment contained a line
```
'menu-custom': 'false',
```

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

task-2633169

closes odoo/odoo#86548

X-original-commit: 2f28c37f2386ad7c1dcca79d9b516820f9607d8d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-03-16 23:22:46 +01:00
Antoine Guenet f50eaa4412 [FIX] web_editor: prevent infinite scroll in mass_mailing in dialogs
When opening mass_mailing in a dialog (eg, in marketing automation),
dragging a snippet to the bottom of the page (without dropping) caused
an infinitely growing scrollbar on the document element.

Note: this revealed that in that particular context the auto scroll to
snippet feature is broken and while dragging we have an extra scrollbar,
on the editable area. In order to fix that, we need to be able to
identify from within the iframe the case where mass_mailing
self-resizes. This involves changing the view to add an option which
will set a class on the document element. This is not acceptable in
stable and will therefore be fixed in master instead.

task-2742664

closes odoo/odoo#86506

X-original-commit: 29c6c80ac7009aa5068c763778342f7c6b115fad
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-16 16:07:22 +01:00
Antoine Guenet 8f7d64e2de [FIX] web_editor: make sure all external links open in new tab
This collects all external links on clean the editor so as to make them
open in a new tab.

task-2740021

closes odoo/odoo#86289

X-original-commit: 8d2c8b4bad7a7aaa313aad361b48d77823841dbe
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-14 09:42:35 +00:00
Nicolas Bayet 29cf849009 [FIX] web_editor: prevent reloading page when searching icon
Before this commit, when the user hit the key enter, in the media
dialog, in the icon tab, in the input, the page was reloaded instead
of searching for the icon.

Task-2733154

closes odoo/odoo#86218

X-original-commit: 7b3bead23f9bc38003afd4253f4ff4556b550598
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-11 08:44:40 +00:00
Benoit Socias f2fa5b0a37 [FIX] web_editor: restore transitions when finding a gradient background
Since [1] the class `o_we_force_no_transition` was not removed when
selecting a snippet when the background color was a gradient. (It was
however removed when selecting a background color.)

After this commit the class is removed in that situation just like for
any other `data-select-style` attribute.

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

task-2633169

closes odoo/odoo#86126

X-original-commit: ed530aef3c6d99712db055099b5f06a31e91d9cf
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2022-03-11 08:44:33 +00:00
Nicolas Bayet f126f0c95b [FIX] web_editor: reset content when resuming collobartion idleness
Before this commit, when:
- client A close it's laptop temporarily, client B
- client B save another content
- client A re-open it's laptop
then, client A still have the outdated record version.

Now, if client A reconnect and the record has been modified, the
editor gets reset with the updated record.

Task-2745104

closes odoo/odoo#86149

X-original-commit: 1070d37a6c02c8a873336f4533d1e319a8762405
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-10 09:00:13 +00:00
Nicolas Bayet aaf70d3692 [FIX] mass_mailing: automatically open linktools when clicking a link
Task-2702179

closes odoo/odoo#86042

X-original-commit: d0003257cb194b8c06483c38ed742a5521602204
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-08 15:54:51 +00:00
Brieuc-brd 93d5ace34a [IMP] web_editor: add device shapes for images
This commit adds a new category of image shapes: Devices.
The purpose is to give the possibility to add images in device mockups
with the image shapes.
To use it correctly the image needs to be in a specific ratio depending
on the shape. To help the user to have the perfect render, an average
resolution is shown when hovering the thumbnail of the shape.

task-2666049

closes odoo/odoo#79068

Related: odoo/design-themes#525
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-03-08 15:54:44 +00:00
Benjamin VrayandTom De Caluwé dc1ca34448 [IMP] web_editor: add image shapes with perspective 3D
This commit adds the possibility of applying a "perspective"
transformation on image with some image shapes (e.g. devices). For
technical reasons, the only way to apply this 3D transformation is to
modify the image in a canva.

Since the 2D context of the canvas doesn't support projective
transformations, we approximate the result using multiple affine
transformations on smaller parts of the image.

task-2666049

Part-of: odoo/odoo#79068
Co-authored-by: Tom De Caluwé <tdc@odoo.com>
2022-03-08 15:54:44 +00:00
Arthur Detroux (ard)andBenjamin Vray 63cf8a693a [IMP] web_editor: add support for fixed size SVGs for image shapes
With this PR's next commits introducing device shapes, it was needed to
have SVGs with a fixed size. Originally the code was created with the
idea that svg will take the size of the image they're going to clip.
This commit introduces a data attribute that allows SVGs to bypass
being resized so that they always keep the same aspect ratio.

task-2666049

Part-of: odoo/odoo#79068
Co-authored-by: Benjamin Vray <bvr@odoo.com>
2022-03-08 15:54:44 +00:00
Nicolas Bayet 98073c3bb0 [FIX] web_editor: prevent editor powerbox hint duplication
Whenever the browser is lagging between multiple enter,
the command hints were not being updated until the browser
main thread process the event queue.

Task-2728794

closes odoo/odoo#85935

X-original-commit: 8525f6ea677e89a932c783545c1d9dcf9b4d175a
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-07 13:30:51 +00:00
Jorge Pinna Puissant cac3ba62e5 [IMP] test_lint, *: add caughtErrors option to no-unused-vars
All named arguments on the catch block must be used. If for some motive
the named argument on the catch block is not used, its name must begin
with '_'.

closes odoo/odoo#85569

Related: odoo/enterprise#24867
Related: odoo/design-themes#552
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-03-02 13:05:42 +00:00
Jorge Pinna Puissant bc20eb4790 [IMP] test_lint, *: enable no-unused-vars rule
Part-of: odoo/odoo#85569
2022-03-02 13:05:42 +00:00
Nicolas Bayet 923a92a0bb [FIX] web_editor: only include website commands in website
task-2696972

closes odoo/odoo#85628

X-original-commit: c1ff3260a8e09ba4af3ad44138d44d4457c7c689
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-02 08:36:10 +00:00
Nicolas Bayet 1b4a390b73 [FIX] web_editor: select checklist when language is rtl
task-2734731

closes odoo/odoo#85627

X-original-commit: 0a236b11e770b6a8db5192685a2c36ce1e303399
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-02 08:36:06 +00:00
qsm-odoo 1ab7210ae3 [REF] web_editor, website: review the web_editor.assets model
- Three controllers were actually useless as the relevant public methods
  of the web_editor.assets can be called directly via RPC in the related
  usecases.

- Review the web_editor.assets model methods organization in the model
  declaration.

closes odoo/odoo#85392

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-02-28 12:56:05 +00:00
Antoine Guenet e13b4fdb9f [FIX] web_editor: ensure powerbox gets selection from owner document
When checking if the powerbox should open, we check the selection but
that was done on the global document, which returns a wrong selection
for the editable if it's in an iframe. As a result, the powerbox never
opened in mass_mailing.

task-2778414

closes odoo/odoo#85352

X-original-commit: d5b8c26c46b1daf795a6b286af80bb4dad8072ff
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2022-02-25 08:26:03 +00:00
Antoine Guenet c797a41d19 [FIX] web_editor: hide inactive modal behind fullscreen editor
`.modal.o_inactive_modal` (in modal.scss) had a z-index that was
superior to that of a fullscreen editor. As a result we could end up
with the editor being partially hidden by a modal.

task-2741872

closes odoo/odoo#85315

X-original-commit: 6ef3c1cf59ac66f00462468079500c449f189fae
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-24 14:37:35 +00:00
Nicolas Bayet 69ea40215b [FIX] mass_mailing: show media modal when fullcreen
Whenever the user clicked on the fullscreen in mass_maliing, then
trying to show the media modal was not possible as the div that
contains it was hidden.

Task-2731907

closes odoo/odoo#85314

X-original-commit: 4026bc2075b7109dd18471aabf11ff3f76d6c57d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-24 14:37:31 +00:00
Benjamin Vray 169dd13df3 [FIX] web_editor: fix cover when there is modal inside a snippet
Since this commit [1], we considered that if a snippet contained a
modal, it is that the overlay had to cover the modal itself.

But that is not correct, because in some cases a snippet can contain
closed modals (e.g. the course page in the website slides module
contains modals).

After this commit, we avoid applying an overlay on a modal that is not
open.

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

task-2710582

closes odoo/odoo#85240

X-original-commit: 9f3eac25b1806d13e270902848c6ead523c7e6bc
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-02-24 12:33:04 +00:00
Sébastien Geelen (sge) 8a5c8a3cb9 [FIX] web_editor: fix icon replacement is mass_mailing
In mass mailing edition :
Replacing a font awesome icon with an image was not working properly.

task-2733908

closes odoo/odoo#85167

X-original-commit: d4d25c8b497e465753cef030292faa4824145cb1
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
2022-02-22 21:05:40 +00:00
Antoine Guenet b8176448c3 [FIX] web_editor: ensure uploaded images in backend are not public
When uploading an image in the editor, we go through
`_attachment_create`, which sets the image to public if `res_model` is
`ir.ui.view` (the default if none was passed). Because of a wrong
reference to the editable DOM element (which contains the `res_model` as
data), when instantiating the media dialog, we were passing no
`res_model`. As a result, when saving an attachment, no `res_model` was
passed to `_attachment_create` and the attachment was made public.
Attachments in the backend should not be public and should be linked to
the proper model.

task-2759034

closes odoo/odoo#85132

X-original-commit: 5b664f0c04433091c3d6f85f245887d1808c308f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-22 16:16:35 +00:00
Antoine Guenet 51c9629aa1 [FIX] web_editor: prevent traceback on apply style to empty lines
When the selection only contains empty lines, no text nodes are
selected. `applyInlineStyle` however counted on text nodes being
selected, resulting in a traceback.

task-2740204

closes odoo/odoo#85059

X-original-commit: ee6c71a3bcd6ec927acbe4eaf4c21acb28396e87
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-22 15:19:38 +00:00
Benoit Socias c5e96ac750 [FIX] web_editor: revert text color previews
Before this commit when a text color was applied on a text within
which an already colored text already existed, the inner coloring was
lost during preview. All text was therefore set to the initial coloring
of the external selected text.

After this commit the "reset" of the text color preview is done by
undoing the draft "in progress" history step that contains the preview
changes, but that is not stored within the history itself.

Steps to reproduce:
- drop the Text snippet
- select a word in the middle of a sentence (e.g. "personality")
- set text color to red
- select several words containing the colored one (e.g. "story with
personality for potential")
- open text color palette
- hover over colors but do not click
- leave color palette
=> colored word is not colored anymore

Steps to reproduce a secondary problem also fixed by this commit:
- drop the Text snippet
- select text surrounding some bold (e.g. "have a personality. Consider")
- open text color palette
- quickly hover through several colors (i.e. move pointer downwards)
=> text selection range changed between some of the color previews

task-2742112 (was task-2666200)

closes odoo/odoo#84998

X-original-commit: 9cb5a138244783580c2d1baa4dc01d1824ed20f4
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-21 14:14:09 +00:00