Commit Graph
3663 Commits
Author SHA1 Message Date
Deependra Solanki 11242d8886 [FIX] web_editor: close powerbox when keyup outside its block node
Before this commit:

The Patience diff algorithm uses the text added in the `closestBlock` node to
the node where the powerbox is opened. If the user switched to a different block
using `ArrowLeft` or `ArrowRight` keys, it would result in the algorithm not
searching for the typed text in the other block.

After this commit:

The powerbox will be closed if the keyup event occurs in a different block than
the one in which the powerbox was initially opened.

task-3212128

closes odoo/odoo#141785

X-original-commit: 272614a7b668d361d6ea4177602b249608af34bb
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
2023-11-20 11:13:17 +00:00
Deependra Solanki 1f4bb22d8e [FIX] web_editor: power box disappears in collaborative fix
Before this commit:

Power box uses Patience diff algorithm to check the text added by the user for
search, it previously used the entire editable for differences, which caused
the issue in collaborative. When one user type something on a different node,
the change would affect the editable and be considered in diff, causing updates
in other users powerbox.

After this commit:

Instead of checking the entire editable for the diff, we now check the current
block node where the power box was opened. This prevents scenarios where other
users powerbox would update when one user would type on same block node.

task-3212128

X-original-commit: 976c10b749e59963c8a27ac4764f1746d46d5e09
Part-of: odoo/odoo#141785
2023-11-20 11:13:17 +00:00
Benjamin Vray 35ff9a3d1c [FIX] web_editor: fix saving base64 image
Some Odoo employees reported a traceback that appeared when saving a
task in the Project app. It turned out that this was caused by an image
having the class 'o_b64_image_to_save' even though the image was not in
Base64 format. Although we couldn't reproduce the bug, we are addressing
the result (the traceback) by preventing the saving of an image having
the 'o_b64_image_to_save' class if the image is not in Base64.

See https://github.com/odoo/odoo/commit/3bbce756c69a206d07abd31059f0392c26b36096

task-3576889

closes odoo/odoo#142571

X-original-commit: 7934aefb7d52ee20941b4583cbf0a50e28c345f6
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-11-20 03:46:49 +00:00
Guillaume (gdi) 8a0c5df159 [FIX] web_editor: remove the use of website color in backend
Since [this commit], the color of the links in the backend is set to the
value of the variable `o-cc3-link`. This causes problems... Firstly,
this variable is defined in the website module, but it is used in the
web_editor module, which does not depend of website. Secondly, this
variable declared in website is made to be modified by the website
administrator via the edit panel (the theme tab). This commit corrects
this by replacing the use of this variable with a hardcoded color.

Steps to reproduce the bug fixed by this commit:
- Have website and project installed
- In the description of a project task, create a link
- Edit a website page
- Go to the theme tab
- Click on Colors Preset
- Open the 3rd preset
- Change the color for "Links" (to red for example)

=> Go back to the project task where you put a link. The link is now red
(this may require a page refresh). But the website option should not
change the links in the backend.

This commit removes the website builder related color o-cc-3-link
usage for editor links.

[this commit]: https://github.com/odoo/odoo/commit/5d598e4269431222ae28ac2196ff6f1f45466734

task-3275134

closes odoo/odoo#142542

X-original-commit: 6f10705e043115369ec581a83f65482ea83d25c8
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
2023-11-20 03:46:46 +00:00
Soukéina Bojabza 36517d8b7b [FIX] web_editor: remove the spaces around full width grid mode snippets
Steps to reproduce:
- In edit mode, drop the "Masonry" snippet.
=> There are spaces on the left and the right of the snippet. It should
not be the case as it is supposed to take the whole space, since its
container width is full (`container-fluid` class).

This happens because since commit [1], the rule setting the `--gutter-x`
CSS variable (which manages the row margins) to 30px when the container
is full width is now overridden by the general `.o_grid_mode` rule that
sets it to 0px, making the negative margins disappear.

Indeed, in commit [1], in order to disable the grid mode when used in a
mega menu that is in an extra menu (because the layout was broken), the
CSS selector managing the `.o_grid_mode` class has been modified. This
change caused the specificity of the rule to increase (x3), which made
it override the container rule.

This commit reverts this change and disables the grid mode in the extra
menu in a better way, by adding a proper rule for this specific case.

[1]: https://github.com/odoo/odoo/commit/709bffcb6de8883b679c0fc942f45cb293621c30

task-3593697

closes odoo/odoo#142189

X-original-commit: 8381af7d9898d7502c82a6b5622b0e91734267d8
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-11-17 00:54:06 +00:00
Soukéina Bojabza ed5794cc05 [FIX] web_editor, web_unsplash: simplify the new UX of the media dialog
In commit [1], the media dialog has been improved in order to have a
better UX when using it. However, its code is quite complex and could be
simplified.

This commit modifies again the UX of the media dialog to only consider
the addition of the "scroll button" and leaves the "Load more" button
after the attachments without making it fixed. The scroll button still
disappears once the load more button appears in the modal.

This commit also addresses the remaining review comments that were not
resolved, as it was merged in a rush.

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

task-3580707

closes odoo/odoo#141356

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-11-16 23:35:55 +00:00
Antoine Guenet 8c136b9882 [FIX] web_editor: mini clean up of serialize
An object was defined before a conditional return statement and as a
variable rather than a constant.

closes odoo/odoo#142049

X-original-commit: d6478d9af76422eccecffb79bfd6be90cc714342
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
Signed-off-by: Nicolas Bayet (nby) <nby@odoo.com>
2023-11-15 11:26:06 +00:00
Nicolas BayetandAntoine Guenet ac4adf0521 [FIX] web_editor: allow a node to not have oid in serialize
This commit addresses a traceback that occurs when trying to serialize a
node that has no `oid` property because it was added to the DOM while
the mutation observer was not active (eg, using `observerUnactive`).
This is the case with technical nodes added for managing the selection
around links ("link zws spans").

When serializing a node, we expect it and its descendants to have an
`oid` property so we throw an error if such is not the case. But we now
have a legitimate case where nodes have no `oid` property so this
removes the error. If the `oid` was in fact really supposed to be
defined (eg, the node we tried to serialize was the direct target of a
mutation), an error will be thrown soon enough after when trying to
access said property.

Note that other, more ad-hoc fixes specific to the link zws spans would
have been possible (and might still be useful in the future), such as:
- skipping said link zws spans when serializing
- adding a fake `oid` property to the link zws spans

task-3593081

X-original-commit: ba6a7fa4cf5ad422816e49b4d3b941297841ed3f
Part-of: odoo/odoo#142049
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
2023-11-15 11:26:06 +00:00
Nicolas Bayet 6f599655e4 [FIX] web_editor: prevent the avatar to be loaded
In some undeterministic circumstances the tests in
`test_wysiwyg_collaboration.js` tried to load an image with a wrong
url (`/web/image?model=res.users&field=avatar_128&id=undefined`). It
is `undefined` because in the testing context, `this.getSession().uid`
is `undefined`.
It is not necessary to load these images in these tests so this commit
prevents the loading of these images.

runbot-24600
task-3566600

closes odoo/odoo#139958

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Nicolas Bayet (nby) <nby@odoo.com>
2023-11-14 13:49:18 +00:00
Deependra Solanki 7b95f5c8a7 [FIX] web_editor: remove redundant code from setTagName
Commit [1] implemented an approach for changing style of a list item to normal.
It no longer wrapped the content in a <p> to remove extra spacing to next list
item. Later commit [2] was introduced which did the same thing but in sanatize.
Hence the code added in commit [1] is no longer needed.
This commit removes the redundant code from `setTagName`.

[1]: 03a134c
[2]: 324e138

closes odoo/odoo#141812

X-original-commit: bd1e432dc29be0dec6e52b142d9fb712335209b6
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
2023-11-13 14:38:38 +00:00
Rodolpho Lima 9728715bdb [FIX] web_editor: remove tooltip in HtmlField
Since [1] the behavior for double-clicking an image in an html field is
displaying it "full-screen", and no longer opening the Media Dialog to
edit it. But, when an image is (single) clicked, a tooltip is displayed
with the misleading "Double-click to edit" message.

This commit makes sure the tooltip is no longer displayed in HtmlField,
while keeping its original behavior for other forms of use of the
Wysiwyg component, like in website.

[1]: https://github.com/odoo/odoo/commit/8ca115b3b9dfe87b59b6b064a4d85ea152d9214c

task-3542766

closes odoo/odoo#141471

X-original-commit: 7cf2896ccb47c7832663cd42b9f22899f4eb5d3c
Signed-off-by: Nicolas Bayet (nby) <nby@odoo.com>
Signed-off-by: Rodolpho Cammarosano de Lima (rcdl) <rcdl@odoo.com>
2023-11-08 04:09:53 +00:00
Rodolpho Lima 8ccaf36d10 [FIX] web_editor: abort rpc on ChatGPT dialog close
Before this commit, when the ChatGPT prompt dialog was closed while
waiting for a response, the "loading" overlay would be present until
such response was complete.

Moreover, in certain occasions, the rpc callback, called after the
component was destroyed, could lead to a traceback due to reading a
property of a no longer existing reference to the prompt input element
(namely, in the `_unfreezeInput` method).

This commit improves the user experience by unfreezing the UI on dialog
close, even if a response is pending, and prevents the rpc callbacks
from running after the component is destroyed.

task-3586380

closes odoo/odoo#141442

Signed-off-by: Nicolas Bayet (nby) <nby@odoo.com>
2023-11-08 04:09:47 +00:00
Benjamin Vray 180c0c043d [FIX] web_editor: fix toolbar buttons alignment
This commit fixes the layout of icons and labels in the "AI",
"Animate", "Highlight" buttons of the text toolbar in Website edit mode.

Before this commit, there was too much space between the icon and the
label of the "AI" button and not enough space between the icon and the
label of the "Animate" and "Highlight" buttons.

task-3586280

closes odoo/odoo#141440

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-11-08 04:09:46 +00:00
Nicolas Bayet d041044dbb [IMP] web_editor: prevent behaviors when an element is protected
In order to be able to create dynamic widgets to the editor, this
commit reinforce the concept of data-oe-protected by preventing the
default behavior for _applyRawCommand, on paste, on input and on
keydown.

closes odoo/odoo#141385

Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
2023-11-08 01:22:01 +00:00
Nicolas Bayet 06bfcfff9a [IMP] web_editor: add oe_movable to move elements in the editor
In order to let third party code set a node to be movable, this commit
adds a class to set a node to be movable in the OdooEditor.

closes odoo/odoo#141384

Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
2023-11-08 01:22:01 +00:00
Mahamadasif Ansari ef5ca752de [REM] *: remove owl="1" from the templates
As all the templates are now imported in the owl app, there is not need
anymore to specify the owl="1" attribute in the templates.

Ref-https://github.com/odoo/odoo/pull/130467

task-3508331

closes odoo/odoo#141383

Related: odoo/enterprise#50344
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-11-08 01:21:59 +00:00
Guillaume-gdi 2f3219c08f [FIX] web_editor, website: hide some text style outside the website app
This commit removes some text style options when the editor is used in
the backend. In the website it makes sense to have all the options but
in the other apps, it is not necessary to have all the options.

task-1958098

closes odoo/odoo#141412

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-11-07 23:57:46 +00:00
qsm-odoo 8b7b4f7fb4 [FIX] web_editor: properly update grid/col buttons on mobile view toggle
Commit [1] introduced the grid mode for multi-column snippets, with
discriminating behavior between mobile and desktop previews.
When toggling multiple times the mobile view, the buttons above the
block sometimes remain in their previous state. The `updateUIVisibility`
trigger doesn't seem to go through.

Step to reproduce:
- Drop an Image - Text snippet
- Activate the grid mode
- Click on a column
- Toggle the mobile view until either of the following happens:
  - When going from desktop to mobile: the buttons are still the ones
    that should appear on desktop (send to front, send to back, move
    handle and delete).
  - When going from mobile to desktop: the buttons are still the ones
    that should appear on mobile (left/right arrows and delete).

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

task-3551537

closes odoo/odoo#141359

X-original-commit: 174e9fe0d8665d1a81c90a6f7bf5cc9e3361f161
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-11-07 21:02:31 +00:00
Antoine Guenet 9266a8e800 [FIX] web_editor: check node is connected before reverting next to it
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.

closes odoo/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>
2023-11-07 21:02:24 +00:00
Antoine Guenet 16d6c250a5 [FIX] web_editor: do not preserve out-of-editable cursor in sanitize
When sanitizing the content of the editor, we should not move the
cursor if it is out of the editable area.

Part-of: odoo/odoo#141303
2023-11-07 21:02:24 +00:00
Antoine Guenet 708cc85261 [FIX] web_editor: do not call closest on non-Element node
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
2023-11-07 21:02:24 +00:00
Antoine Guenet 2f1786c5d2 [FIX] web_editor: ensure observer is always disabled for link zws
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
2023-11-07 21:02:24 +00:00
Antoine Guenet ef11e75b70 [FIX] web_editor: prevent link isolation in non-editable links
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
2023-11-07 21:02:24 +00:00
Antoine Guenet 3bc23ce5a5 [FIX] web_editor: properly implement Powerbox navigation test
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
2023-11-07 21:02:24 +00:00
Antoine Guenet 69b92cad60 [FIX] web_editor: wait one tick after triggerEvent in tests
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
2023-11-07 21:02:24 +00:00
Antoine Guenet b031af6c6a [FIX] web_editor: toggle checklist on element with class
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
2023-11-07 21:02:24 +00:00
Antoine Guenet 05524a5b7a [ADD] web_editor: add tests for moving in/out of links with arrow keys
This adds a few tests to check that the link isolation is working.

Part-of: odoo/odoo#141303
2023-11-07 21:02:24 +00:00
Antoine Guenet 8f1d33ac42 [FIX] web_editor: wait for selectionchange on set test selection
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
2023-11-07 21:02:24 +00:00
Antoine Guenet 34ff41f797 [FIX] web_editor: do not normalize on preserveCursor
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
2023-11-07 21:02:24 +00:00
Antoine Guenet 0f4914a157 [IMP] web_editor, project: remove attributeless spans/fonts on sanitize
`<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
2023-11-07 21:02:24 +00:00
Antoine Guenet 37cfea537c [FIX] web_editor: remove empty classes and styles
This commit removes empty classes and styles from the editor on clean
for save.

Part-of: odoo/odoo#141303
2023-11-07 21:02:24 +00:00
Antoine Guenet 79f5f0619e [ADD] web_editor: add style on link with selection
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
2023-11-07 21:02:24 +00:00
Antoine Guenet b18a8ab05d [FIX] web_editor: handle selection at edges of links
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
2023-11-07 21:02:24 +00:00
Antoine Guenet e5d7affed5 [FIX] web_editor: ensure standard selection before running tests
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
2023-11-07 21:02:24 +00:00
Antoine Guenet fff405a6c2 [FIX] web_editor: temporarily skip mobile tests
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
2023-11-07 21:02:24 +00:00
Antoine Guenet ca034c0d8b [IMP] web_editor: notify when mobile version test fails
This adds a note in the error message when a mobile test fails, to
inform that it was a mobile test.

Part-of: odoo/odoo#141303
2023-11-07 21:02:24 +00:00
Robin Lejeune (role) 7eda184589 [FIX] web_editor, website: allow links to unreachable pages
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

closes odoo/odoo#141225

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-11-06 18:11:35 +00:00
Benoit Socias acfca25e48 [FIX] web_editor: ignore device visibility upon snippet drop
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

closes odoo/odoo#140505

Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
2023-11-06 13:58:39 +00:00
Benjamin Vray 988a215339 [FIX] web_editor: fix anchor link selector broken
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

closes odoo/odoo#141034

X-original-commit: 72eb761545c51c9dc7c6490c0ce0e38650dfa985
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-11-06 12:32:01 +00:00
Benjamin Vray f504bb7bc3 [FIX] web_editor: fix custom snippets thumbnail
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

closes odoo/odoo#140998

X-original-commit: 9f682306a9d4c1fc9bcd55a41d411ccc190573ad
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-11-06 11:16:45 +00:00
xO-Tx 9cd1b671f4 [IMP] website, web_editor: integrate new text highlights designs
task-3285817

closes odoo/odoo#140372

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-11-04 00:38:25 +00:00
stefanorigano (SRI) 9a17a7aa07 [IMP] website, web_editor: restore default inputs to white + add config
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

closes odoo/odoo#139642

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-11-04 00:38:19 +00:00
Robin Lejeune (role) 143bdfa13d [FIX] web_editor, website: fix columns mobile orders
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

closes odoo/odoo#140362

Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
2023-11-03 16:43:29 +00:00
vishal padhiyar 898bbeff96 [FIX] web_editor: contenteditablefalse should not switch to nearest
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

closes odoo/odoo#139961

X-original-commit: 3b8e4bc123dd87857d6634b55ddaaa716a0729ce
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
2023-11-03 07:34:53 +00:00
Benjamin Vray bc3973c424 [IMP] web_editor: adjust the dropdowns position in the editor panel
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

closes odoo/odoo#135788

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-11-03 07:34:52 +00:00
Benjamin Vray fa66d1d458 [FIX] web_editor: fix url input dropdown off screen
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

closes odoo/odoo#140846

X-original-commit: 23272e38d822c734d1ea2fdb404ba2b1d6890cb3
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
2023-11-03 06:29:26 +00:00
Antoine Guenet 9b06f097b8 [IMP] web_editor, website: reorganize non-floating toolbar buttons
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

closes odoo/odoo#139857

Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
2023-11-02 16:57:48 +00:00
Antoine Guenet ca824e547e [FIX] web_editor: do not base selected alternative on index
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
2023-11-02 16:57:48 +00:00
Antoine Guenet 849763b8f7 [FIX] web_editor: restyle and properly position generated content frame
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
2023-11-02 16:57:48 +00:00
Antoine Guenet 5be690a553 [IMP] web_editor: general improvements to ChatGPT alternatives dialog
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
2023-11-02 16:57:48 +00:00