When reverting history removal steps, we check that the next node or the
previous node exists so we can add the removed node next to it. But we
failed to check that the node was still connected to the document.
closesodoo/odoo#141303
Related: odoo/enterprise#50304
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
The `closest` method is only available on the Element class.
`parentElement` guarantees the returned node will inherit from the
`Element` class, which `parentNode` does not. This replaces calls to
`closest` on nodes returned by `parentNode` so that they are called on
`Element` nodes instead.
Part-of: odoo/odoo#141303
To prevent history steps that include the link zws, we need to ensure
that the observer is always disabled when the link zws is inserted or
removed.
Due to these changes, we need to initialize `_currentStep` before
setting the original link zws, so that `observerApply` can access it in
the process of pausing the mutations observer.
Part-of: odoo/odoo#141303
The link isolation mechanism should not be applied in non-editable
links. It also should not be applied in Bootstrap navigation as we don't
want it to behave like a list of links and not to insert non-link
content between the navigation elements.
Part-of: odoo/odoo#141303
A Powerbox test was executed without first setting the selection in the
DOM, which caused the Powerbox to close immediately. It also omitted to
reopen the Powerbox after the first command selection, before using the
arrow keys to navigate through the commands.
Part-of: odoo/odoo#141303
We need to wait one tick after `triggerEvent` to be sure that the
event's listeners are resolved before checking the result. Some tests
did the waiting after calling `triggerEvent`, but some didn't. This
includes the waiting in `triggerEvent` itself.
Part-of: odoo/odoo#141303
When transforming an element into a checklist, we were first creating
the checklist and therefore adding the necessary class to the list
element, and then applying all the attributes of the original element to
the list. This was causing the class to be removed is the original
element contained a class attribute.
Part-of: odoo/odoo#141303
The selectionchange event is triggered one tick after the selection
changes so we need to wait for it to be triggered before moving forward
with testing.
Doing this implied correcting a test: as we were not waiting for the
selectionchange event, we were not taking advantage of some corrections
applied there.
Part-of: odoo/odoo#141303
When preserving the selection, we typically want our selection to remain
as close as possible to what it was before. But `preserveCursor` called
`setSelection` with its default `normalize` argument, which would change
the selection in sometimes unexpected ways.
Part-of: odoo/odoo#141303
`<span>` and `<font>` elements without attributes are useless and can be
removed. Removing them will make the editor output more readable and
will prevent endless nesting of attributeless `<span>` and `<font>`
elements when successively styling, unstyling and deleting text.
Part-of: odoo/odoo#141303
This adds a style on the link that currently hosts the selection, to
make it clear that the next character input will happen inside.
Part-of: odoo/odoo#141303
This replaces the link isolation mechanism with a more robust one that
doesn't require setting the `contenteditable` attribute on the editable
to `false` (which is rife with issues). In so doing, we also improve the
handling of selection at the edges of links, making a clear distinction
between the selection being inside the link or outside of it.
Note: we only do this for collapsed selections, as it's not clear what
should happen when the selection is not collapsed.
task-3103566
Part-of: odoo/odoo#141303
Some editor tests may be sensitive to the existence or not of a
selection in the DOM before initializing the editor. The first test to
be run won't have a selection before the editable is initialized, but
every subsequent test will (removing the test node add the end moves the
selection to its parent). One particularly problematic consequence
concerns tests that would fail with an initial selection but succeed
otherwise. Such a test would only fail when run after another test, but
not when run alone.
This commit prevents this confusing debugging situation (and potential
false negatives) by setting a selection at the beginning of the testNode
by default before running each test, ensuring that each test has the
same initial conditions.
Part-of: odoo/odoo#141303
The editor mobile tests are making wrong assumptions about the way the
editor behaves on mobile and are therefore wrong. This temporarily
disables them until the discrepancy is resolved.
Part-of: odoo/odoo#141303
Since commit [1] removed `legacyRejectPromiseHandler()`, trying to edit
a link leading to an HTTP error triggers an "Uncaught Promise" error.
This commit makes sure such links do not cause a traceback: the link
popover is just less detailed (no title, favicon).
[1]: https://github.com/odoo/odoo/commit/fcb16a3b1bd373726ffb54f0fbe41fb6d1784769
task-3584686
closesodoo/odoo#141225
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Since [1] when device visibility became a visibility option, when
dropping a snippet that contains device-invisible blocks, all those
blocks were made visible.
This commit makes that behavior limited to blocks that are not
device-invisible. (E.g. when dropping a popup)
Steps to reproduce:
- drop a Columns snippet
- hide a column on mobile
- hide a column on desktop
- save snippet
- drop saved snippet in either desktop or mobile preview
=> All columns were shown with the `o_snippet_override_invisible` effect
on the conditional ones.
[1]: https://github.com/odoo/odoo/commit/3103e0553011b5c1f4078972d7a88fa3fd4068b2
task-3538535
closesodoo/odoo#140505
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
The timeout for calls to the OLG API in the editor was set to 300
seconds, which is far too long for a chatbot. This reduces it to 30s.
closesodoo/odoo#141135
Signed-off-by: Nicolas Bayet (nby) <nby@odoo.com>
Steps to reproduce the bug:
- In website edit mode, drag and drop an 'Image-Text' snippet onto the
page.
- Click on the button in the second column of the snippet.
- Type "/" in the URL input of the link options in the customize panel.
- Open the 'Page Anchor' selector and select the '#top' anchor.
- Bug: The anchor is not added to the link in the URL input.
The bug was introduced by this commit [1]. Indeed, the events in the
'Start' of LinkTools were no longer attached to the main element but
directly to the event target. This means that in this particular case
where the 'we-button' elements are created after the 'Start', the click
event had no effect because no event was properly attached to it.
This commit also includes test steps to prevent this bug from
reoccurring in the future.
[1]: https://github.com/odoo/odoo/commit/d7245d2abf528d093226c80e40975e63d61e8997
task-3580414
closesodoo/odoo#141034
X-original-commit: 72eb761545c51c9dc7c6490c0ce0e38650dfa985
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This commit fixes 3 issues with the custom snippets thumbnail:
- The tooltip ("Drag and drop the building block") appears during
edition of the name of the custom snippet, it should not.
- There was no space between the "Confirm" and "Cancel" buttons when
editing the name of the custom snippet.
- Starting from version 16.2 (although already fixed in the 16.0
commit), the "Cancel" button was positioned below the "Confirm" button
instead of being on the same line. This was due to JQuery 3.6.3, which
no longer correctly supported self-closing elements like "<we-button>"
for this particular issue.
task-3572270
closesodoo/odoo#140998
X-original-commit: 9f682306a9d4c1fc9bcd55a41d411ccc190573ad
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This PR refactor the "inputs design system" by reverting the correlation
'$input-bg == $light == color-3', initially introduced by #120302.
Beside ensuring color-consistency, the former system aimed to simplify
palette edition by clarifying how color-3 was used (simply all the UI
elements...).
While the former system was responsive to user customization and
color-presets, it didn't necessarily delight everyone's discerning
taste, at least not with default settings/palette.
This commit enforces a classic "white with borders" design that's
independent from the color palette and doesn't adapt to color-presets.
The rationale behind this decision is that the need for non-white inputs
is "nonexistent" and exceptional cases should be addressed using the
SCSS editor.
As a workaround to ease edition for users that still wants to challenge
themselves with the creation of "not standard" palettes/designs, this
commit introduce a colorPicker option assigned to $input-bg.
The hope is that this new controller help users finding a "compromise
color" that could work with any color-presets.
task-3568806
closesodoo/odoo#139642
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This follows [commit 1], which introduced a way to separately reorder
columns on mobile and desktop.
This commit replaces the custom mobile order classes with the Bootstrap
`.order-x` classes.
It also ensures those orders are not used for mass mailing in case the
editor composes their email on a small window. The reorder would indeed
not have any effect for the end users in such a case.
[commit 1]: https://github.com/odoo/odoo/commit/710d000f1872fd99b41d52ec3d6923756bba7cba
task-3576046
closesodoo/odoo#140362
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
Before this commit:
When we try to click on element contenteditable=false then it is switch to
nearest editable area.
After this commit:
When we try to click on element contenteditable=false then it will not switch to
nearest editable area.
Task-2977246
closesodoo/odoo#139961
X-original-commit: 3b8e4bc123dd87857d6634b55ddaaa716a0729ce
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
Before this commit, there was an issue with the dropdowns in the editor
panel. When the selector was at the bottom of the panel, the dropdown
opened outside the viewport, requiring the user to scroll the editor
panel to see it.
After this commit, the dropdowns in the editor panel open above the
selector if there is not enough space below for it to be visible without
scrolling.
task-3500768
closesodoo/odoo#135788
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Steps to reproduce the bug:
- Open the Menu Editor.
- Add a menu item.
- Type a URL (which will trigger the autocomplete).
- Bug: You can't select the last URLs in the autocomplete dropdown
because it goes off screen and can't be scrolled.
This bug was introduced by the commit [1]. Since this commit, all modal
dialogs are vertically centered, which is why the bug fixed in this
commit occurred.
[1]: https://github.com/odoo/odoo/commit/dd141a22f44ea88af18448c4a6089252daeba8cc
task-3580373
closesodoo/odoo#140846
X-original-commit: 23272e38d822c734d1ea2fdb404ba2b1d6890cb3
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
*: mrp_subcontracting, project, test_website, web, web_editor,
website_slides
This commit removes jQueryUI autocomplete that was the last usage of
jQueryUI.
No longer usage of these features inside the codebase
task-3439226
Part-of: odoo/odoo#139209
This rearranges the non-floating toolbar buttons so that the AI, animate
and highlight buttons are grouped together at the bottom and take up the
full width of the toolbar, and so that the options appear below them.
task-3572337
closesodoo/odoo#139857
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
When selecting an alternative in the AI Copywriter dialog, what we store
in the state is the index of the message. But that targets a different
message every time we add each new message at the start of the list.
This pushes new messages at the end of the list and only displays them
in reverse order, but also adds an ID to each message so they can be
targeted more robustly.
Part-of: odoo/odoo#139857
When inserting generated content in the editor, a frame is added around
the content to highlight it for a moment. This frame was not properly
positioned in the website builder. This also restyles it to match the
style of the "DRAG BUILDING BLOCKS HERE" frame.
task-3572397
Part-of: odoo/odoo#139857
With this commit, opening the ChatGPT alternatives dialog still
generates three alternatives, but whenever the user clicks on one of the
buttons:
1. one new version is generated (rather than three)
2. this new version is added at the top of the list (rather than
replacing everything)
3. older versions are showed in grey so as to differenciate them from
the new one
4. a badge next to each version shows which instruction was used to
generate it (shorten, lengthen, etc.)
Since we add new versions from bottom to top, the spinner is now shown
above the existing versions.
Since a badge is added, it's not necessary to keep the last used button
green anymore so once the AI is done generating the new version, the
button returns to its blue state.
task-3572397
Part-of: odoo/odoo#139857
This implements a way to abort the generation of a batch of alternatives
by the AI Copywriter. This is needed because if a batch was being
generated when the user clicked one of the buttons to select a mode, it
continued to be generated and to update the state while the new batch
was in the making, resulting in a potential total of more alternatives
than requested.
task-3572397
Part-of: odoo/odoo#139857
Sometimes, ChatGPT includes a little intro text (eg, "Sure, here are
some alternatives:") to its answer. This avoids this as much as possible
by improving the system prompt and asking to wrap the answer in tags
that we then remove.
task-3572397
Part-of: odoo/odoo#139857
This commit resolves the issue that arises when a widget contains a
reload attribute but lacks a no-preview attribute. That config leads to
an "Uncaught Promise" error. With this update, when a reload attribute
is detected, the no-preview attribute is now automatically added,
preventing the error from occurring. The problem occurs since [1].
Steps to reproduce:
- Go to website
- Edit
- Click on the header
- In the navbar options, change the Mobile Alignment option.
=> Works but traceback anyway.
[1]: https://github.com/odoo/odoo/commit/fcb16a3b1bd373726ffb54f0fbe41fb6d1784769
task-3572334
closesodoo/odoo#139909
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
In order to improve the user Experience and not uselessly
block access to the document, we prevent collaboration error
to open the traceback dialog.
task-3568680
closesodoo/odoo#139964
X-original-commit: df39cbc4dbc1922e91c53278db7fdcb12f01306e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
In some cases the changes done in the editor were lost when using other element of the the UI.
For example : changing the tab containing the editor component to another one.
To avoid loosing the changes made by the user in those cases, we force an urgent commit change
in the `onWillUnmount` hook.
task-3530998
closesodoo/odoo#137716closesodoo/odoo#139959
X-original-commit: b2c3775ea01bfdb8e0dd40b3b8e57534c1785116
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
Before this commit:
On creating link in debug mode produces prop validation error, and link
dialog doesnot appear
After this commit:
Now the issue is resolved and link dailog appers.
task-3571940
closesodoo/odoo#140178
X-original-commit: 8519cbab2e22506b12a1d93066c2c4fd87e753fe
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Sanjay Sharma (shsa) <shsa@odoo.com>
There is an exact case where having a grid mode block inside a mega menu
item will fully bug: all elements will be on top of each other.
In order to reach this case, you need to:
- Create a mega menu
- Make the block inside this mega menu use grid mode
- Find a screen size where this mega menu will be part of the extra menu
items (hidden in the `+` entry)
- BUT the screen size should not toggle the mobile view
Point of attention when trying to replicate the issue:
When you enable grid mode, the result will depend on the available size.
So be sure to not enable the grid mode on a megamenu which is already
hidden in the extra items when you are in edit mode, in such a case,
there is no bug.
This commit simply disables the grid mode in such a case, it will thus
behave like the grid mode in mobile view and therefore be responsive
(disabled in mobile).
opw-3547405
closesodoo/odoo#139956
X-original-commit: fb209432049d9874308a2bdc3c9d2baa210ccced
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
*: test_website, web_editor, website_sale
The goal of this commit is to replace all Dialog in the Website Editor
flow with OWL Dialog. This uses the new `bindService` and `call` methods
available on legacy widgets. The replacements mainly use the
ConfirmationDialog component, but some had to have custom-made dialogs.
closesodoo/odoo#138947
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
This commit removes useless function from legacy/utils.js and removes it
from several backend bundles. The file is moved in wysiwyg and frontend
bundles as it is still used in these bundles.
task id: 3439226
closesodoo/odoo#140260
Related: odoo/enterprise#49812
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Follows commit: ffef01e327.
It caused an issue in Firefox:
On the sale order form view (with the field "notes" handled by the OdooEditor),
clicking on a Many2one made the browser crash because the method getSelection
did not exist on the target which was the input element.
It did not crash in chrome as the event's target was always the Document.
The added test actually tests the feature of the referenced commit, and checks, as much
as possible, that there is no crash.
closesodoo/odoo#140143
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit introduces some adjustments to the dark mode color scheme
and the use of bootstrap classes in Community.
- Mini calendar contrast -
The colors were not using variables, making them non dynamic
and breaking the contrast in dark mode.
- Avoid !important rules spreadsheet -
Prior to this commit, spreadsheet top bar was using a `bg-white` class,
making it pure black in dark mode.
Since spreadsheet is designed with light colors and we don't provide a
dark mode for it, we remove that class and set a `background-color`
property using CSS in Enterprise.
- Input color -
This commit fixes the focus behavior on the searchbar in the control
panel, the `command_palette_search`, and the `start a conversation` in
discuss.
- Copy clipboard field border color -
Make use of the `text-primary` color for the copy to clipboard field
We use the o-theme-color function to avoid an undefined since primary
doesn't exist in the o-theme-text-color map in white mode.
- Web_editor toolbar variables -
The toolbar was using the `o-brand-primary` variable
which was set to a darker shade. This caused issue when activating an
option due to how vibrant the color is.
- Improve the controls on border-color -
Introducing a custom property on the border-color to allow
further control on individual components (such as the popover).
- Improve setting tabs colors use -
Prior to this commit, the colors of the settings tabs menu were kinda
inverted. The menu was light in dark mode and dark in light mode.
We fix this by changing the values associated to the CSS variables in
use.
- Make model field selector dark mode proof -
Fixing the design of the model field selector popover in both
light and dark mode. Since the popover was using custom style with
arbitrary values, it was not designed for the dark mode and had a lack
of consistency.
To improve the design, we use variables rather than custom style, and
make sure the desired render is as close as before.
- Sign colors use -
This commit aims to improve the sign module in both light and dark mode.
There were some readability issue with some `btn-light` having poor
contrasts in both light and dark mode, and the use of some classes was a
bit unexpected (e.g `card-header` to set a grey background with some
padding).
- Improve buttons design inside listview -
Prior to this commit, this button was using custom CSS to make it look
like a primary button, while it was using classes related to secondary
buttons.
We remove the custom CSS used to style it correctly and keep our button
design consistent.
- Messaging menu layout in mail -
This commit aims to improve the design of the notifications displayed
in the messaging menu. Prior to this commit, the notifications dropdown
was using custom CSS variables overriding the regular behavior
of our dropdowns.
In fact, the layout was generating some friction:
1) Marking a notification as read would turn its background into a
darker color
2) Effects like `:hover` were all based on the custom CSS variables
resulting in an inconsistent layout.
- Multi company selector adaptations -
In darkmode the multi company selection was using the btn-light which
creates a weird effect and overrides the dropdown default hover behavior
This commit uses the btn-link to display an hover effect on the
company switch and on the checkbox while blending with the background
and the default dropdown hover effect.
- Adapts default badge design -
Improve the design of the default badges in dark mode.
If you open the light mode, these badges are dark grey with a white
text. If you switch to dark mode, they are dark grey but with a dark
text, which makes them look either muted or off.
We make use of SCSS variables to handle the color of the component,
providing a good styling in both modes.
- Fix kanban cards borders inside dropdown -
Fixes the issue with the divider inside the kanban dropdown menu not
showing in dark mode.
To ensure it is visible, we assign it the `$dropdown-divider-bg`, which
is the color it should use, as the horizontal divider above uses.
- Fix tour pointer design for dark mode -
This commit aims to insert the tour pointer and its content inside the
styling we applied to our tooltip.
To do so, we make sure it uses CSS variables, allowing more control and
consistency, plus we replicate the overall look of our tooltips.
- Fix `text-primary` on action background contrast -
This commit improves the readability of our `text-primary` classes when
it's used on a `$o-component-active-bg` background.
Prior to this commit, the `text-primary` was not meeting the contrast
standard, mainly when you were using the `CMD+K` shortcut on the
app switcher.
To prevent that, we changed the background to a `$o-component-active-bg`
background with an opacity ensuring our text provides a good contrast.
- Fix input states -
Prior to this commit, the `--o-input-border-color` CSS variable was
using the `$o-form-lightsecondary` variable to define the standard color
of the `border-bottom` property of our inputs.
This was conflicting since `$o-form-light-secondary` is also used to
define the `background-color` of our table on focus.
With this commit, we separate these two element with different variables
to make sure they don't affect each others.
- Fix kanban ghost background -
Before this commit, if you created a project without any stage or element
in it, the ghost cards that act like placeholders would be pure `#000` in
dark mode, due to the `bg-white` class.
This commit replaces that class with a `bg-light`, providing a better
visual result in both light and dark mode.
- Fix new message design -
Improve the design of the new message element while
inside Discuss, using our danger color, ensuring a good visual result in
both modes.
task-3201038
closesodoo/odoo#139966
Related: odoo/enterprise#49666
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Co-authored-by: chgo-odoo <chgo@odoo.com>
Co-authored-by: stefanorigano <sri@odoo.com>