Commit [1] introduced an option to enable link and button commands.
The goal was to be able to disable it in website_forum when the user
doesn't have the proper privileges. Instead, it disabled it everywhere
except in website_forum (and then indeed only enabled it when the user
had said privileges). The same is true of images and videos.
This enables these commands by default instead, and disables them only
specifically for website_forum under the appropriate circumstances.
[1] e104937118
task-2917285
closesodoo/odoo#98111
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Before this commit:
Replace button was adding another image without replacing the existing one.
After this commit:
Now replace button replaces the existing image with another one.
Task-2895601
closesodoo/odoo#98513
X-original-commit: 3e8db4fa7a2d8eb9eba4b184e33bb3a6f69ce687
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Before this commit:
When we want to change the background color of a button, clicking on that button
will occur traceback(dropdown is not a function).
After this commit:
Traceback will not occur by initializing the dropdown component as it has
converted into the OWL component.
Task-2916277
closesodoo/odoo#96508
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Before this commit, if the mutation records would contain records that
would cancel each others, those change would be listened and considered.
For instance:
- Mutation 1: Adding ID on element A
- Mutation 2: Removing ID on element A
When processing the mutation records, it is useless to consider those
2 as the Id of the element A is the same before and after the mutation.
This led to multiple issues, especially in case where some elements have
the same branding (and are thus the same field/xpath).
In such cases, the editor is replicating the changes made on one of them
to the others to keep the "same" fields sync'd.
For instance, if you go on an event page and try to modify a date, the
change will be replicated at multiple place in the page which are
actually the same t-field.
When replicating those changes, somehow the jQuery Sizzle ID changes
were listened, leading to infinite loop of mutation observer.
Step to reproduce:
- Install website
- Go to any page and enter edit mode
- Click on the navbar and in the right panel select Vertical header
- Activate the CTA option in that navbar right panel (should already be)
- Click on the CTA button
- Try to edit the URL in the right panel or any link option (style etc)
The changes will be ignored as the button's section is being re-rendered
every 50ms infinitely.
On chrome you can easily see it by watching the DOM in the dev tool. The
section will blink again and again, hinting about DOM change.
opw-2893480
closesodoo/odoo#98331
X-original-commit: 97c712e81692661fc9bc65e0810abc4dc017ed87
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit aims to make it easier to remove a shape over a background
image.
Before this commit, we could only remove a shape by clicking on the
"shape" button in the background options (it was not easy to find
quickly), but with this commit we can now also remove it thanks to a
"remove" button that has been added next to the shape selector.
task-2827802
closesodoo/odoo#96788
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This adds commands to convert the current text into 2, 3 or 4 columns,
and to remove said columns.
task-2901585
closesodoo/odoo#95359
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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>