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
closesodoo/odoo#86740
Signed-off-by: Antoine Guenet <age@odoo.com>
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
closesodoo/odoo#87350
X-original-commit: 10b97f37ab5d78b3a2b0f63fa019ee95bb78ea7d
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Thibault Libioulle (tle) <tle@odoo.com>
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]: c4bfedc37bclosesodoo/odoo#87325
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
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
closesodoo/odoo#87300
X-original-commit: 73b98a53e8bd19b3b96502d6006b002819287e44
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Thibault Libioulle (tle) <tle@odoo.com>
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
closesodoo/odoo#86011
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#87203
X-original-commit: 4a634f2c5bfceb3f2dc200f9b391ef1cdbc0e697
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This prevents a traceback when no closest block to the root node can be
found in the sanitizer.
task-2796371
closesodoo/odoo#87187
X-original-commit: 2104f33985472cd59f067d2f1403518a332fac6d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This adds options to the "Design" tab of mass_mailing so the user can
edit its stylesheet directly.
task-2789287
closesodoo/odoo#86881
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#87021
X-original-commit: d4b231222c5baf726332deddfe6d4c5e3e7865db
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This adapts new code which uses `oe-zws-empty-inline` to use the new
name `data-oe-zws-empty-inline` instead.
closesodoo/odoo#86930
X-original-commit: c8d892496e78beea804c80091f4b06dc2e858b59
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
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
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
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
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
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
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
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
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
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
closesodoo/odoo#86817
X-original-commit: 6c26e24c3d52410c0a3a06ee9a9d0aad6858a438
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#86699
X-original-commit: 8530235bff30bfcad55cf39927f0733d30fe2eee
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#86172
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#86548
X-original-commit: 2f28c37f2386ad7c1dcca79d9b516820f9607d8d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#86506
X-original-commit: 29c6c80ac7009aa5068c763778342f7c6b115fad
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This collects all external links on clean the editor so as to make them
open in a new tab.
task-2740021
closesodoo/odoo#86289
X-original-commit: 8d2c8b4bad7a7aaa313aad361b48d77823841dbe
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#86218
X-original-commit: 7b3bead23f9bc38003afd4253f4ff4556b550598
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#86126
X-original-commit: ed530aef3c6d99712db055099b5f06a31e91d9cf
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
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
closesodoo/odoo#86149
X-original-commit: 1070d37a6c02c8a873336f4533d1e319a8762405
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#79068
Related: odoo/design-themes#525
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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>
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>
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
closesodoo/odoo#85935
X-original-commit: 8525f6ea677e89a932c783545c1d9dcf9b4d175a
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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 '_'.
closesodoo/odoo#85569
Related: odoo/enterprise#24867
Related: odoo/design-themes#552
Signed-off-by: Géry Debongnie <ged@odoo.com>
- 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.
closesodoo/odoo#85392
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
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
closesodoo/odoo#85352
X-original-commit: d5b8c26c46b1daf795a6b286af80bb4dad8072ff
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
`.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
closesodoo/odoo#85315
X-original-commit: 6ef3c1cf59ac66f00462468079500c449f189fae
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#85314
X-original-commit: 4026bc2075b7109dd18471aabf11ff3f76d6c57d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#85240
X-original-commit: 9f3eac25b1806d13e270902848c6ead523c7e6bc
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
In mass mailing edition :
Replacing a font awesome icon with an image was not working properly.
task-2733908
closesodoo/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>
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
closesodoo/odoo#85132
X-original-commit: 5b664f0c04433091c3d6f85f245887d1808c308f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#85059
X-original-commit: ee6c71a3bcd6ec927acbe4eaf4c21acb28396e87
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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)
closesodoo/odoo#84998
X-original-commit: 9cb5a138244783580c2d1baa4dc01d1824ed20f4
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>