Card dimensions were not properly preserved on mailing conversion.
opw-2850967
X-original-commit: 1be80cc83bec6a08abf6a3e8493d22f44350d038
Part-of: odoo/odoo#98107
convert_inline relies on getComputedStyle to crystalize var and calc
values. This however was conflicting with the fact that it also combines
positional styles (eg., margin-top, padding-left) together. This seems
to make getComputedStyle give out the wrong value with var and calc.
closesodoo/odoo#98003
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
On Chrome, the textarea is automatically resized to use all the
available space. On Firefox, this is not the case. Since the css rules
only set the position of the textarea and not its size, the textarea in
Firefox was ridiculously small and unusable.
task-id 2950108
closesodoo/odoo#98060
X-original-commit: ca1d70cb36be99a171a46eb1455b9f5ef5ac388b
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
The colorpickers forcefully reset the current history step to revert the
color change while previewing colors. This works when the only change in
the current step is in fact the colorpicker. If other changes already
existed in the current step however, they will be reverted as well. This
commit fixes the issue by introducing the concept of stashing mutations to
avoid that these be reverted. They can be unstashed later on when the
system is done abusing the revert mechanism.
task-2921844
closesodoo/odoo#97973
X-original-commit: cc280522d590c3ed257e7c6c495008e8986b2bf3
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
When clicking the link tools button, the focus is set inside the URL
input, changing the selection temporarily to that input. This means that
if the user clicks any other button from the toolbar right after using
that input, a command would try (and refuse) to execute outside the
editable area.
The link tool is now destroyed when clicking other buttons of the
toolbar, thus either validating the link or reverting it, and the
selection is reset accordingly.
The toolbar buttons are now correctly bound on click rather than some
being bound on mousedown and some on clicks, like colorpickers, which
would result in weird behavior such as a mousedown handler modifying the
dom which changes the layout so the mouseup event is on another node and
the click is not fired anymore. This commit streamlines the behavior to
use click so that this issue does not occur anymore.
task-2921844
X-original-commit: 798e3d0eb0017e05261ca0a0c5e29706629f0350
Part-of: odoo/odoo#97973
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
When clicking the link tools button, the listener on `body` clicks is
triggered and we check if the toolbar should appear or be hidden. This
check should be skipped whenever we click in the toolbar but this was
checked via the selection on the global document rather that on the
editable's owner document, resulting in an oft-empty selection object.
As consequence, the checks were done and the toolbar was hidden, whereas
it should remain shown.
task-2921844
X-original-commit: f74184b4f98772949040eeea94e389b425fc3265
Part-of: odoo/odoo#97973
When opening the link tools with a collapsed selection, we have an empty
link, which is ugly with its dashed border around an element of width 0.
This inserts a placeholder space composed of two nbsps so that the
dashed border is correctly rendered.
task-2921844
X-original-commit: a1a3fc850fe50284441f74afb43ac06b0ae2d6c4
Part-of: odoo/odoo#97973
The link tools were made so that one needed to validate the URL they
input before it was applied to the DOM. But this was awkward, especially
when the selection was collapsed and we counted on the URL input to fill
the link's label.
We need to pause history steps however, otherwise each change will be
its own step in the history and the user will have to undo as many times
as the number of characters that were entered.
task-2921844
X-original-commit: 226c4c4032c26d3d8f622b29fb151fa8e78ba70a
Part-of: odoo/odoo#97973
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
The triple click correction algorithm in `getDeepRange` is supposed to
do be triggered only when a selection spans multiple nodes and ends at
position 0 of a node. But it only checked the end of the selection and
failed to check if the selection actually did span multiple nodes.
task-2921844
X-original-commit: 22fdcc0d09e232c481f05eefdb2e60ba1cea4f10
Part-of: odoo/odoo#97973
When converting Bootstrap grids to tables for e-mail compatibility, we
need to take into account Bootstrap offsets on columns. We were doing
this by adding that offset to the column but we actually need to create
an extra column instead.
task-2936705
closesodoo/odoo#97962
X-original-commit: 8beb7ac47c4cc86822bbc42b67ce5f6a44d41626
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
Masonry's top inner container needs to have a 100% height to properly
size its contents.
task-2925779
X-original-commit: 717672d56958915084d98d69246c9e7e986fabab
Part-of: odoo/odoo#97962
The option to switch background types depends on CSS which was in the
website builder but absent from mass_mailing.
task-2925779
X-original-commit: 63595109516ec3f40be74115ce6cf8894977a727
Part-of: odoo/odoo#97962
When we convert Bootstrap grids to tables for e-mail compatibility, we
need to complete rows whose column sizes don't add up to 12. The way it
was, the last column was stretched to fill up the row, which is wrong as
it can affect the width of its contents.
With this commit, a new, empty column is appended to the row to fill it
up without affecting the existing rows. This is a more accurate way to
emulate the behavior of Flexbox.
task-2936705
X-original-commit: 462b698732dbc0e71972ddbe86c687f4bb3f9492
Part-of: odoo/odoo#97962
Before this commit, in translate mode, the toolbar and the
table-container were shown when initializing the SnippetsMenu (and
removed for a click on an element that was not a translation).
To reproduce:
-> Install another language on website 1,
-> Click on translate
-> Click on a button of the informative dialog
-> The toolbar was there, then was removed on the click on the dialog,
and won't reappear.
(If the informative dialog is not shown, because it was permanently
dismissed, click on an image, the toolbar is still there and won't be
removed).
To fix that, the clicks on translations elements are not stopped from
the TranslatePageMenu and are taken into account in
_checkEditorToolbarVisibility to show/hide the toolbar.
Related to task-2687506
closesodoo/odoo#97855
X-original-commit: fbe35ed2f4c0727d097227fa6decf544f5db27fe
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
The Powerbox crashed whenever a command was wrongly defined. That's a
bit too brutal so this sets defaults instead.
closesodoo/odoo#97794
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
The `Styles` option contains styles which are unsupported in
emails. The few that are supported can be replaced by other options.
- Shadows: unsupported;
- Rounded rectangle: (unsupported in Outlook)
is replaced by the `Border` options which allows to customize the
border's radius more than the current option.
- Thumbnail: can be done with a combination of `Border` and `Padding`
- Circle: can be done with a shape
(which has been added along with other new shapes)
This option could be found on images and icons and has now been removed.
CSS styles in the `theme_default` file have also been removed since
they are no longer needed.
Three basic shapes (circle, triangle, "slanted" rectangle) have been
added to the `web_editor`'s `Basics` shapes page.
A condition was previously set on the page to avoid showing an empty
page. The condition is moved to each of its buttons instead, so that
new shapes added via xpath from `mass_mailing` to this page are now
visible.
task-2836942
Part-of: odoo/odoo#95974
Before this commit, the tour test_image_upload_progress was failing
inconsistently at the step "check that the file was correctly uploaded"
during the upload of a single image.
[1] adapted the upload progress toast to owl, but it used a state
variable isVisible, updated with a useEffect hook called on change of
the file props. This was not optimal: the visibility could be updated
directly through a reactive variable from the upload service. Instead of
automanaging its visibility, the component is completely driven by the
upload service.
This small optimization is useful in regards of the implementation of
the TourService.
As it is implemented now, the TourService works this way:
When it completed a step, it will check for the tooltip of the next
step, in the next javascript call stack.
If it does not find it in the DOM at that time, it will listen to the
mutations and wait for 750ms after the last one to check again.
Here, as the progress toast was rendered visible not directly when
uploading a file, but after another render, after the useEffect was
executed, the progress toast was sometimes not found directly after
playing the step sending the 'change' event. Then, the TourService was
waiting for all the mutations to execute (the progress toast appears,
the media dialog closes itself, the toast hides itself) and check again
after a delay. But by then the toast was already hidden.
With that, the tour steps are rewritten to follow the flow:
- Open the media dialog in single upload mode
- Upload an image
- The toast is shown
- The media dialog is closed
- The toast with "The file has been uploaded" is still there
- The toast autohides
Also, the file input value is reset after uploading files, otherwise it
was not possible to upload the same file twice (the 'change' event was
not triggered).
[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b
runbot-4117
closesodoo/odoo#95890
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
The constructor of OdooEditor called a function that initialized the
Powerbox. This moves that function inline into the constructor to avoid
a function called only once, and moves the main commands and categories
directly into the arguments to `new Powerbox()`.
closesodoo/odoo#97725
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
The widgets related to "custom" image filters in the case of background
images were never shown anymore since [1]. [1] is actually a
forward-ported version of [2] but the bug only appeared since [1] as
the forward-port adaptation created the error: the widgets of this
option were not shown or hidden before... but simply not rendered at
all, kinda by mistake. The adaptation in [1] used the conventional way
of doing things by using the `_computeWidgetVisibility` method to
indicate if widgets should be shown or not. The problem is that an
error was done when writing that visibility condition.
[1]: https://github.com/odoo/odoo/commit/89ce9f9ab5b8db148c273f70be0a06c768892566
[2]: https://github.com/odoo/odoo/commit/7c17d78fbdbb64b1aa5b55f78d3202a64a85ed2fclosesodoo/odoo#97514
X-original-commit: 10a48dc213117c4ac29b1ce56d3f1c02e58111d8
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This adds a series of tests for the editor's Powerbox and its
integration with the editor.
closesodoo/odoo#96287
Related: odoo/enterprise#29649
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
The upgrade from Bootstrap 4 to 5 broke the display of the Powerbox when
the editor is in a modal. This adapts the Powerbox's z-index to make
sure it always displays above a modal.
task-2901697
Part-of: odoo/odoo#96287
Odoo Editor's styles were defined in CSS when it was all still part of
a separate repository. They can now be converted to SCSS, which will
allow us to use Odoo's SCSS variables in the future, and allows us now
to refactor the styles in the more readable SCSS format.
Part-of: odoo/odoo#96287
This introduces a new API for the Powerbox, which allows to order its
commands and categories. The order is based on the priority assigned to
the category or command. If two items have the same priority, they are
ordered alphabetically.
To order categories, pass said categories in the Powerbox's params, each
with its own priority. If a command declares itself as part of a
category that was not itself declared, said category will be added
automatically, with the lowest priority.
task-2901697
Part-of: odoo/odoo#96287
Before this commit, when a snippet was moved, and dropped outside of a
dropzone, the nearest dropzone was not found and the snippet would
return to its initial position.
This commit fixes it by using the editable document instead of the
global one.
Related to https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b
task-2687506
closesodoo/odoo#96401
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
After [1] was merged, the delete/move buttons of the snippets overlay
reduced in size, because of the font-size difference between the backend
and the frontend.
This commit fixes it by setting a fixed font-size of 16px (this restores
the same size as before, as the button was using 1rem on the frontend,
and most browsers use 16px as a default font size).
[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b
task-2687506
Part-of: odoo/odoo#96401
The e-mail conversion process for Bootstrap cards stripped card-images
from their link when they had one. This corrects the process to preserve
the link.
task-2937123
closesodoo/odoo#97199
X-original-commit: 947ee6756b9e9d9ddf7380ecaf0beb27c271b231
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Before this commit:
After inserting the 'calendar' or 'appointment' link in an article through the
'/appointment ' or '/calendar' command, removing the link shows the error.
After this commit:
Removing the link through the link editor will remove the link and only keep the
text.
Task-2894489
closesodoo/odoo#97210
X-original-commit: 8eda489a26a3d138c2e4c601e42b531e6bc719b6
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
As a stable fix, to not touch XML templates and break existing
translations, the ⌙ character was automatically replaced by └ which
makes more sense for the usecase and should work properly in all
browsers. The ⌙ character is actually rendered mirrored on Windows 11
Chrome (and others) as the font used for those unicode characters is
left to the browser. We could force a font of our own but it's probably
not worth it.
A better solution with a SVG or CSS solution has to be done in master.
That would unify the look of the symbol across all browsers and
also prevent special characters to be placed in translations.
With this forward-port commit, we'll start first by using └ via a CSS
rule. Three new classes have been created: o_we_sublevel_1,
o_we_sublevel_2 and o_we_sublevel_3. Adding any of them on a widget
automatically adds the └ character. Then choosing 1, 2 or 3 controls
the indentation, which was previously controlled by placing the  
HTML entity directly inside strings.
This commit also takes the opportunity to fix some of those level
indentations (sometimes 2 was used instead of 1 or 1 was used instead of
2, etc) and also review some related labels.
closesodoo/odoo#97361
X-original-commit: e5d45643598671077ade7e41f0dbfe2b502665b8
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
After updating mass_mailing_snippets_menu_tabs to cancel the
template's edition at the end of the tour, the editor starts blowing
up during cleanup with:
```
Trying to set result to failed (UncaughtTypeError: Cannot read properties of null (reading 'anchorNode')
at Sanitize._parse (/web/assets/363-d1667a2/web_editor.assets_wysiwyg.min.js:1453:105)
at Sanitize.parse (/web/assets/363-d1667a2/web_editor.assets_wysiwyg.min.js:1450:6)
at new Sanitize (/web/assets/363-d1667a2/web_editor.assets_wysiwyg.min.js:1448:6)
at sanitize (/web/assets/363-d1667a2/web_editor.assets_wysiwyg.min.js:1460:53)
at OdooEditor.cleanForSave (/web/assets/363-d1667a2/web_editor.assets_wysiwyg.min.js:1372:37)
at Class.getValue (/web/assets/363-d1667a2/web_editor.assets_wysiwyg.min.js:2547:1121)
at Class.isDirty (/web/assets/363-d1667a2/web_editor.assets_wysiwyg.min.js:2547:407)
at
_onBeforeUnload (/web/assets/363-d1667a2/web_editor.assets_wysiwyg.min.js:2509:560)
```
After consultation with the relevant team, there are edition contexts
where it's perfectly valid to have no "live" selection for one reason
or an other, so this should be fixed.
Ideally the field should also properly be discarded such that the
event listener is removed and the callback is never called at all,
however the legacy client has no such hook at the field level (the
controller seems to be the lowest).
closesodoo/odoo#96517
Related: odoo/documentation#2550
Related: odoo/enterprise#29824
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
*: website, website_sale
Before this commit when a search bar was within a navigation bar, its
autocompletion popover was using the text color according to the
navbar's background color determined by the theme. For dark themes, this
made the autocompletion appear almost as white on white.
This commit uses the defaults before applying a specific preset color
so that the dropdown menu style within the navbar uses the original
color.
It also resets the `text-muted` style used in "No results" message.
Also removing the `website_sale.productsSearchBar.autocomplete` template
which was not referenced anymore.
Steps to reproduce:
- Select a dark palette (e.g. one that makes the navigation bars black).
- Drop a "Products Search" block.
- Reset its background color.
- Pick a color combination with a dark background.
=> The autocompletion's "No results" message is shown without contrast.
task-2855511
X-original-commit: f9bf40cb53cf487c8736c1f565c2f0d3834acd5e
Part-of: odoo/odoo#97148
Before this commit, when trying to paste into the Odoo editor, if file
and html was in the clipboard, the file got precedence and were added
instead of html.
task-2941679
closesodoo/odoo#97359
X-original-commit: 0af0927f48f213d835a7d4a8396fc6376476e220
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
* Broaden the valid URL pool by including some URL without subdomain
if they have a white listed TLD.
* Change a link 'href' when we change the link label,
if the new label is a valid URL.
* Ensure the domain extension cannot be only digit.
task-2858621
task-2901795
closesodoo/odoo#97297
X-original-commit: 500bc6dc9958fe8a9ca396f87544e8866efa744b
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Change the unit test to reflect new spec:
* Some TLD are white listed to not required a subdomain to be considered a valid URL.
=> .com, .net, .org + all ccTLD
* URL of a link need to be changed to equal the label, is the label is a new valid URL.
* Domain Extention cannot be only digit
task-2858621
X-original-commit: c13ba3ec771334c9cd7708305b40b9bf1a234bcc
Part-of: odoo/odoo#97297
*: website
Setting transformations on images is handled by the jQuery transfo
plugin. This plugin, however, also manipulates animations related css
properties allowing the plugin to work on animated images.
After closing the transformation tools these properties stay in the DOM,
preventing the animation options to work properly. Animations are not
played when previewing or selecting a choice from the dropdown list.
Instead they remain stuck in their initial keyframe.
To avoid complications from the interaction between both options, this
commit hides either option when the other is activated. Additionally,
css properties added by the transform option are cleaned, avoiding
potential interactions after the transform option is reset again.
opw-2765529
closesodoo/odoo#97137
X-original-commit: 3ac59a7f841b528a32c14a2111e7a1a7e11c830a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
auth_totp module added user_id in session_info, but it's not in the depends of project and web_editor module.
To avoid traceback after uninstalling auth_totp module:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '0'),
we should use uid instead of user_id in js code.
closesodoo/odoo#96880
X-original-commit: 81b92a61907028f71b1337b11d0d60ee98bb5775
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Before this commit:
Onclicking quote icon of BlockQuote generates traceback
After this commit:
Now on clicking quote icon doesnot generate traceback
Task-2920794
closesodoo/odoo#96944
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Steps to reproduce:
- switch to any language other than English
- go to a page where you can use the text editor,
for instance you can try to edit a project's description.
- type `/` in the editor
You should see that some commands are not translated.
Some files modified in this commit are located in the
web_editor/static/lib/web-editor directory.
However, only the JS code located into /static/src/ is considered for
export of translations. This is done to avoid polluting translations for
code not managed by Odoo.
We have to update the .pot file manually. A good workaround is to copy
the web-editor folder inside to static/src, export the
translations and then delete the copy folder.
However, this means that those updates to the .pot file will be lost in
the next translation export.
opw-2918128
closesodoo/odoo#96939
X-original-commit: 0cc5505b27f29d44c25af83653b09b1b49cfec79
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Nshimiyimana Serge Séna (sesn) <sesn@odoo.com>
Before this commit:
When we put the text direct in td and try to color it with design toolbar with
text color then text in normal should change the color.
After this commit:
When we enter the text direct and try to change the color with design toolbar
then it will change the text with defined color.
Task-2843065
closesodoo/odoo#96830
X-original-commit: 76fd633ab78d5cb47c990063040d6d1e9708df2d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
*: website, website_mass_mailing, website_payment
When an unsafe snippet is dropped into a sanitized HTML model field, its
unsafe content gets removed on save.
We need a way to mark snippets as being (in)compatible with
sanitization. It cannot be automatic, as, for example, the snippet
introduced at [1] contains an iframe but is compatible with
sanitization.
In 13.0, we will temporarily set up an automatic mechanism that marks
existing snippets containing forms as being incompatible with
sanitization.
In 14.0 a distinction between full sanitization and form-tolerant
sanitization introduced at [2] is added with this forward-ported commit.
This commit prevents unsafe snippets from being dropped into sanitized
HTML model fields.
The "Form Builder", "Product Search" and "Product Search Input" blocks
are now prevented from being dropped or moved into form-sanitized HTML
fields.
To do this, this commit introduces a new `t-forbid-sanitize` attribute
on the `t-snippet` tag. It can have the value `true` to prevent it from
being dropped into any sanitize fields, or `form` to specifically limit
to form-sanitized fields.
Steps to reproduce (in 13.0):
- Go to a product page
- Drop a "Product Search" snippet into the product-specific section of
the
product
- Save
=> The form was removed.
[1]: https://github.com/odoo/odoo/commit/c2e9bd0e60014b6a42931cf300e0f89f8cf7c225
[2]: https://github.com/odoo/odoo/commit/388c222c6c4bb7e2fe3e67009b248359ae0fd3db
task-2829961
closesodoo/odoo#96812
X-original-commit: 9eaba23781766730b06e936dbd9c5d0c28c909c6
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Only youtube and dailymotion were able to add this property to their
video. Maybe it was not supported by vimeo back then, but it seems to be
supported now.
It improves the vimeo youtube in two ways:
1. For background video, the controls are now hidden. There were visible
for a few seconds before this PR which is not ideal
2. For non background video, there were no way to hide the controls
which might be problematic to some users as in mobile there is the
controls display but also an ugly "Tap to unmute" in the middle of
the video.
Step to reproduce (background video):
- Drag & drop a "Text - Image" snippet and add it the biggest possible
padding, also add padding to the image (so you see the full video and
not just part of it)
- Double click on the image, then on the video tab insert a vimeo url
- Save, you will see the controls for a few seconds (progress bar, video
title, link to vimeo, etc)
Step to reproduce (non background video):
- Drag & drop a "Text - Image" snippet and double click on the image
- On the video tab, insert a vimeo url
- Select "Auto Play"
- Save and go to mobile, you will see the controls and an ugly "Tap to
mute" in the middle of the video.
The "Tap to mute" is a browser feature, not a vimeo feature. Browsers
are muting video by default when auto play.
Still, some people want to have a nice auto play video shown to users
without sounds and don't want that overlay/controls.
opw-2901256
closesodoo/odoo#96804
X-original-commit: 7128e4080511b5f224da3dce6d88ba8bcf9a0d47
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit:
On pasting image to editor, the default width was set to auto.
After this commit:
Now on pasting image to editor, the default width is set to 100%.
Task-2862892
closesodoo/odoo#96779
X-original-commit: 2e4811b751960548dc66f6e4ff00495e5226fdbc
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This nomenclature was taken straight from the old Summernote options
when the new editor was merged in 15.0.
While perfectly correct from a technical point of view, the use of the
word "Auto" in this context is confusing because the user might think
that the system is going to choose an optimal size for them while this
is not what this option does at all. What it does is simply removing any
width style property that might be set on the image, thus letting the
image be sized appropriately by the browser in accordance with active
CSS rules at that position in the page, hence its "Default" width.
closesodoo/odoo#96679
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>