Commit Graph
1955 Commits
Author SHA1 Message Date
qsm-odoo ea108e3910 [FIX] web_editor: review snippet drag and drop technical flow
This commit completes [1] by further reviewing the drag and drop
technical flow order:

- The content_changed event should be triggered before starting snippets
  as well as it is only useful to signal the snippet modifications made
  by onBuilt.

- The undroppable snippets update which was done first could probably be
  done anywhere -> best to put it at the end when everything in the DOM
  is done, and it is also the last thing the user expects to be done.

Note: in the new editor the role of 'content_changed' became however
unclear and should be further reviewed. This commit fixes problems with
the old flow in master though (problems around removing items in a
snippet during its onBuilt call).

[1]: https://github.com/odoo/odoo/commit/60d7bf6d7daea83db9332b4fc47a4ac6892d21d7

closes odoo/odoo#75596

X-original-commit: efdfe261afd933972869305fd3358c764f7c18c3
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-08-26 10:21:32 +00:00
Benoit Socias 78e2546006 [FIX] web_editor: make the background image positioning usable again
Since [1], this commit the controls for the background image positioning
were not accepting events anymore and were below margin handles.

After this commit the controls for the background image positioning can
be used again.

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

task-2627710

closes odoo/odoo#75576

X-original-commit: e266669361cde6f799683fa6b082777d0f416c57
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-08-25 11:12:23 +00:00
Benoit Socias 843507a35b [FIX] web_editor: keep each style when editing link
Before this commit editing a link that was saved with fill styles
did reset it to a different value and even changed the 'type' to 'link'.

After this commit re-editing the link works for each style.

task-2629461

closes odoo/odoo#75512

X-original-commit: 4f6cc912260c5b5689b0e87644ad119ef5a1389c
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso-odoo@users.noreply.github.com>
2021-08-24 14:14:28 +00:00
qsm-odoo 2cbb691a84 [FIX] web_editor: properly update the editor panel UI
When an option notifies that it was used, its ancestor SnippetEditor
instances were in charge of asking for an UI update of all their options
(see [1] where this was already fixed). This was inconsistent with the
logic of our UI where the value of one option might affect the value and
visibility of another option which comes *after* it, e.g.:
- the user sets a badge type to 'info'
     -> the badge background option (below) is shown as blue
- the user adds a shadow
     -> more options are shown afterwards to control it (not above)

After this commit, we now update the whole editor panel (parent and
child options) wherever the updates come from. The only important thing
is to first update the options UI then their visibility as their
visibility may depend on their UI status.

This allows at the same time to fix the source of a race condition, as
enabling a snippet also triggers an UI update whose async parts were not
properly awaited (which thus may lead to inconsistencies if the user
clicked everywhere in the DOM too quickly).

[1]: https://github.com/odoo/odoo/commit/7623a0c771495cd41bf40af37c0d2b6e4beb7cdc

Part of https://github.com/odoo/odoo/pull/74959

closes odoo/odoo#74959

X-original-commit: 488b9ae45e728327e0d43b91b7c2d6edf2a33be1
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-08-24 09:27:35 +00:00
qsm-odoo ad644d9ae7 [FIX] web_editor: properly handle editor enabling and preview mode
The editor panel keeps tracks of the SnippetEditor instances which are
enabled at the current time. When previewing one (by hovering its UI),
that tracking was messed up making onFocus and onBlur calls inconsitent.

Part of https://github.com/odoo/odoo/pull/74959

X-original-commit: 0d7e660d8c0941b1af83b08a90d936933287d681
2021-08-24 09:27:35 +00:00
Benjamin Vray ba371a0d9b [FIX] web_editor: fix overlay missing after animation
Before this commit, with some animations (e.g. Bounce In-Left) the
overlay of the animated element or the overlay of selected element
inside it no longer reappeared after the animation.

task-2630112

closes odoo/odoo#75444

X-original-commit: fb98430b1cdbc63896d152b39bcf23c0f2241cb4
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-08-23 10:51:32 +00:00
qsm-odooandBenoit Socias a48a30f954 [IMP] website, web_editor, *: allow to use pre-configured gradients
*: web

After this commit pre-configured gradients can be used as snippet
backgrounds, snippet filters or as text effects / highlight effects.

The background colors (and now gradients) are now possible to add
*alongside* a color combination class (editing one does not remove the
other). Background colors and gradients are mutually exclusive.

Part of https://github.com/odoo/odoo/pull/73611
task-2599770

closes odoo/odoo#73611

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Benoit Socias <bso@odoo.com>
2021-08-17 17:43:50 +00:00
qsm-odoo 38754b2485 [FIX] web_editor: properly define background classes before cc classes
All background-color classes (bg-XXX) were defined before the color
combination classes. Except for the Odoo colors ones (bg-o-color-X)
which were defined after. That inconsistency was not a real problem
before as those two type of classes could not be combined but this will
change in the future.

Part of https://github.com/odoo/odoo/pull/73611
task-2599770
2021-08-17 16:38:13 +00:00
qsm-odoo c61ae75874 [FIX] web_editor: properly mark duplicated color buttons as selected
Since [1], the colorpalette widget's layout was updated such that some
colors now appear multiple times in some circumstances (e.g. the grays
appears in custom tab and theme tab). Since then, asking to mark one of
those color as selected, only marked the first one as such, and that
first one may be in an hidden panel. This commit fixes the issues by
marking them all as selected, as it should. This changes what is
explained in [2] too.

[1]: https://github.com/odoo/odoo/commit/96ab729850983162a0039e40c77537ef65cd039e
[2]: https://github.com/odoo/odoo/commit/508a7f980652172a7ed00da43f6bc3bc586089fe

Part of https://github.com/odoo/odoo/pull/73611
task-2599770
2021-08-17 16:38:13 +00:00
qsm-odoo 716ec1bdf0 [FIX] web_editor: properly compare CSS variables and CSS values
The editor sometimes compare CSS values, in particular in the
selectStyle method where a given style is not applied if it would have
no effect (e.g. applying an inline pink background-color is useless if
the block is naturally pink because of CSS rules). That comparison
failed when it was comparing 'var(--XXX)' and 'YYY' as 'var(--XXX)' was
not processed as the CSS variable 'XXX' to be read.

Related to task-2599770

closes odoo/odoo#75201

X-original-commit: 22b5d90539895bb7c2b14de4abbb2d7d978a6f79
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-08-17 14:46:05 +00:00
Nicolas Bayet e41eebd7a8 [FIX] web_editor: prevent traceback on get Powerbox element
Whenever using the `getPowerboxElement`, it is possible to have a
null node.

closes odoo/odoo#75163

X-original-commit: 03d7021b251d31cfda055c6ffe9684fad191903c
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
2021-08-16 15:24:35 +00:00
Nicolas Bayet 072c038df5 [FIX] web_editor: prevent Odoo editor hints on technical elements
Some templates contain empty <li> elements for styling purposes
only and should be blacklisted in the context of Odoo editor hints
as these elements are not editable.

task-2550858

closes odoo/odoo#74944

Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
2021-08-16 07:13:23 +00:00
Nicolas Bayet a51df6c850 [FIX] web_editor: disable Powerbox in Odoo fields that are not html
If the active element is an Odoo field (ie. a field with the
`data-oe-model` attribute) it means the content should not be
considered html, unless its type is specifically `html`.

If the Odoo field is of the `html` type, the Powerbox should only
be triggered if the active element is _within_ that field rather
than _being_ the field itself.

task-2550858
2021-08-16 07:12:32 +00:00
Sébastien Geelen (sge) b67c57dc6c [FIX] web_editor: change link shortcut to ctrl+M
Old shortcut (ctrl+K) was conflicting with the new command palette feature, so we change it to CTRL+M.

task-2593213

closes odoo/odoo#75069

X-original-commit: 0371fe2b9e54ff557265a8f8fc919d351ed6a7d5
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
2021-08-13 08:56:38 +00:00
Antoine Guenet 7ed3f3151a [IMP] mass_mailing, web, web_editor: remove scrollbar on iframe contents
Mass mailing form view currently has a scrollbar for the contents of the
editor, one for the form view itself, and one for the sidebar. In
consequence we can sometimes end up with three scrollbars side by side,
which is ugly and confusing.
This ensures the height of the iframe is always that of its contents so
there is no need for a scrollbar.

When inserting a new snippet we want to autoscroll to that snippet. That
is a complicated situation because the element we want to scroll is not
in the same document as the element we want to scroll _to_.
To address that situation, a new option is added to `scrollTo` so we can
pass it the element to scroll. It can then check if we are in the
aforementioned situation, in which case it can correct the scrolling and
apply it to the right element.
We use that option in mass_mailing to prevent the bug.

Task-2545445

closes #71511
2021-08-12 10:19:14 +00:00
Antoine Guenet 66b757b5ed [IMP] mass_mailing: restyle the mass mailing form view to full width
Currently, editing a mail feels a little claustrophobic because of the
boxes within boxes within boxes design. This commit removes the chatter
and the sheet from the form view so the mail editor can take up more
horizontal space. The chatter is then moved into one of the notebook's
tabs.

Task-2545445

closes #71511
2021-08-12 10:19:12 +00:00
Younn Olivier 198a075cf4 [IMP] web_editor: add height option on html field
It is possible to specify a height for the html field, instead of the
default 380px.

task-2458165
Part of https://github.com/odoo/odoo/pull/68221
2021-08-09 13:10:43 +00:00
Younn Olivier 5fe16aa346 [FIX] web_editor: fix image transforms linter issues
This fixes linter issues introduced in
https://github.com/odoo/odoo/pull/71847

task-2554608

closes odoo/odoo#74823

X-original-commit: 5a990248c647d7303ffc578e6fc9dbc1ee4670dc
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-08-06 14:24:32 +00:00
qsm-odoo 03918cd5f0 [FIX] web_editor: use proper text color for dropdown items in cc envs
When inside a specific color preset, active dropdown items' background
color is set to that preset's primary color. However, their text color
was not properly computed mainly because of [1] which forced other rules
as important.

[1]: https://github.com/odoo/odoo/commit/2172295cefa1d8780332709bf0c97cfa23def3a5

closes odoo/odoo#74776

X-original-commit: 67fb206e2ef4828712a53052282aa0791edb74e7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-08-05 17:05:42 +00:00
Romain Derie 6ccfdfec71 [FIX] web_editor: position correctly the popover in side dropdown menu
Before this commit, the popover would be displayed on top of the clicked
element if that element was a menu in a dropdown.
Indeed, there was not enough room for the popover to be shown correctly, as the
available space was the dropdown itself.

Note that if there was more than 2 menus in the dropdown, it would work
correctly as it would create enough space for the popover to be shown bellow or
above the menu.

Step to reproduce:
- Create a menu and a submenu
- Click on the menu, it opens a dropdown with the submenu inside it
- Click on the submenu, the popover position is wrong

task-2618494

closes odoo/odoo#74755

X-original-commit: b0b9fd2fd07fec96dd870467e8d9d8da7996c8ef
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2021-08-05 12:21:02 +00:00
xO-Tx c72595d5b5 [FIX] web_editor: apply shape when image changed
Issue:

- [1] Edit mode > Set a shape on image (mimetype = 'image/jpeg')
- [2] Replace it by an animated GIF.
- [3] Replace the .GIF image again by the old one.
- The shape is not applied on it.

After the step [2], the image  a dataset of:
{..., mimetype: "image/svg+xml", originalMimetype: "image/gif"}.

But when replaced by the JPG image in [3], we get (in '_applyOptions()')
an image with the following dataset:
{..., mimetype: "image/jpeg", originalMimetype: "image/gif"}

This incoherent state is caused by the fact that the mimetype from
attachment will be added on shape image in loadImageInfo(), which
affects the result of '_isImageMimetypeSupported()' method
(image is considered as a .GIF), and as a consequence, the shape
won't be applied.

We already have code (in '_onImageChanged()' method) to fix mimetype
in this case, but the goal of this commit is to move this code to
'_loadImageInfo()' to prevent this kind of incoherent mimetype values.

IMPORTANT: after this commit, the right mimetype value for GIF images
is passed and shapes cannot be applied on them (shape data will be
removed from non-supported images)

task-2578242

closes odoo/odoo#72639

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-08-03 15:17:58 +00:00
Younn Olivier fe2c914067 [FIX] web_editor: clean the ImageTools transform and crop option
Added documentation to the methods of the ImageTools SnippetOption.

Also, removed unnecessary config from the transform method, which was
specific to the wysiwyg transform method to allow for reset on double
click.

The ImageTools transform and crop options now correctly set their button
to active or not.

Two reset buttons are added next to the transform and crop buttons,
visible when a transformation was made on the image.

Part of https://github.com/odoo/odoo/pull/74592
task-2554608

closes odoo/odoo#74592

X-original-commit: fc3706a0736c2c76dfd1a261a1455146b1699ce7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-08-05 08:10:24 +00:00
Younn Olivier f68b78e531 [FIX] web_editor: add events to enable or disable loading effects
This commit adds two events to either enable or disable and cancel
loading effects at the SnippetsMenu level.

This is useful if we want for a snippet to be edited without showing the
loading effect. In the context of this PR it is used for image
transforms.

Part of https://github.com/odoo/odoo/pull/74592
task-2554608

X-original-commit: c45896fdd5a89e7954d8afeeb89ff51bb16ab438
2021-08-05 08:10:24 +00:00
Younn Olivier 5f41733eb7 [FIX] web_editor: keep options and hide overlay when transforming an img
Part of https://github.com/odoo/odoo/pull/74592
task-2554608

X-original-commit: 1e8ab0c9de57c7c0dcf92fa5199ff1d1f226ca47
2021-08-05 08:10:24 +00:00
Younn Olivier a37f27d08f [FIX] web_editor: correctly display overlay over transformed elements
Before this commit, the editor overlay was not correctly applied to
rotated elements.

After this commit, we apply the transformation of the element to the
overlay. For that, we needed the original top and left offsets of the
element. These values are obtained by cancelling the transform before
computation, and reapplying it after application to the overlay.
With these original top and left values and the transform property also
applied to the overlay, we are able to display it with the correct
rotation over transformed elements.

Part of https://github.com/odoo/odoo/pull/74592
task-2554608

X-original-commit: 8c7815bc02b06914966aca524cf95675706944b8
2021-08-05 08:10:24 +00:00
Romain Derie d6d83a0142 [IMP] test_website: add tests for image upload progress bar
Progress bar on image upload was introduced with #65828 in saas-14.3.

Since, it has been broken in saas-14.3 with 3765ac1 which broke the flow for
image unrecognized by PIL, see the other commit of this PR.

It was also completely broken in master (saas-14.5) with the wowl refactoring,
where no progress bar were shown at all. It would show empty toastr.
This was fixed with #74027

This commit introduces a complete testing suite for that progress bar:
  - Single image upload
  - Multi image upload
  - Success upload
  - Unsupported error
  - Unrecognized error

task-2607393
Closes #74122

closes odoo/odoo#74454

X-original-commit: 381d432faf8d19e71ff1d63c29a14064a6d7f57f
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-08-02 13:57:41 +00:00
Benjamin Vray 00025dd406 [FIX] web, web_editor: disable horizontal scroll when dragging snippet
This commit adds an option to disable horizontal scrolling in the
smoothScrollOnDrag feature options and use it when dragging and
dropping a snippet into the editor to prevent the wrapwrap from
scrolling horizontally when an element overflow the page (e.g. an
animated element).

task-2215118

closes odoo/odoo#74518

X-original-commit: fdbc109780f336c4b7dcac31585beaad682e029a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-07-30 18:18:35 +00:00
xO-Tx eb1262960f [IMP] web_editor: allow adding a shape-on-image via custom URL (themes)
The goal of this commit is to add a "Python version" of the
shape-on-image feature using a controller.

Since the whole logic to apply shapes on image is JS-based, we need
to use this URL (just like for background shapes) when we want to add
a shape by default on images in themes. When the configurator replaces a
snippet image (which the theme defines to have a shape), the shape
option should still be applied on the new image.

On the JS side, loadImageInfo() is overridden in order to mark
images (with theme default shapes) with corresponding attachment
data (original-id, original-src, mimetype).

Here is an example of the minimum xpath required to add a shape on a
snippet image in a theme:

```
<template id="s_image_text" inherit_id="website.s_image_text">
    <xpath expr="//img" position="attributes">
        <attribute name="src">/web_editor/image_shape/website.s_image_text_default_image/web_editor/solid/blob_1_solid_rd.svg?c2=o-color-1</attribute>
        <attribute name="data-shape">web_editor/solid/blob_1_solid_rd</attribute>
        <attribute name="data-original-mimetype">image/jpeg</attribute>
        <attribute name="data-file-name">s_image_text.svg</attribute>
        <attribute name="data-shape-colors">;o-color-1;;;</attribute>
    </xpath>
</template>
```

task-2593454

closes odoo/odoo#73938

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-07-30 17:35:19 +00:00
Arthur Detroux (ard)andqsm-odoo 1c442782f8 [IMP] website, *: add visibility options on sections
*: web_editor

Provide the user with an option to hide or display a section tag
depending on the visitor's location (if geoip enabled), language,
utm_medium, utm_source and utm_campaign.

Users can use a M2M widget to select different records. These will be
used to create a CSS selector on save that will hide the section tag
depending on the various options they selected.
This CSS selectors will be applied, as well as various data attributes
when the page loads to hide the targeted tag. All of these operations
are handled client side.

The geoip country had to be added to the session for the feature to work
with countries.

Part of https://github.com/odoo/odoo/pull/67140
task-2381049

closes odoo/odoo#67140

Related: odoo/enterprise#19907
Related: odoo/upgrade#2658
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-07-30 14:03:42 +00:00
Younn Olivier 7ec2077e22 [FIX] web_editor: start snippet widgets after creating its options
ISSUE
Since 14.4, dropping the image gallery to a website was causing a
traceback.

CAUSE
The bug appeared when new options were added to i.fa elements (such as
Alignment, Shape, Padding). It was an issue for the image gallery as in
the start method of the snippet widget, o_indicators_left and
o_indicators_right elements are removed if not necessary. They are
removed and not only hidden in order to keep the snippet responsive.

In that situation, there was a concurrency issue, as an editor of a
child snippet removed from the DOM (here in the chevrons, removed in the
start method of the parent snippet) was created and initializing options
for an element that was not there anymore.

SOLUTION
When a snippet is dropped on a page, we wait for its options to be
created before starting its widgets.

task-2604383

closes odoo/odoo#74422

X-original-commit: 60d7bf6d7daea83db9332b4fc47a4ac6892d21d7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-07-29 11:18:06 +00:00
stefanorigano (SRI) 4edfe4b45c [MOV] web, web_editor: move 'print-variable' mixin in utils.scss
Allows to use 'print-variable' mixin in any bundle.

task-2579123
2021-07-23 06:54:18 +00:00
Samuel Degueldre cfe079221c [FIX] web, web_editor: restore media upload progress toast
In odoo/odoo#72675 the new services were made available in the frontend,
and calls to the legacy notification services were redirected to the new
notification service. However, some of the behaviour of the legacy
notification service was not replicated in the new one, like the ability
to pass an HTML element to use inside the notification.

While html content can be passed, it is cloned, meaning that the DOM of
the element cannot be manipulated by the caller, which is what was being
done to show progress during media upload.

Although the upload progress toast looks like a notification, it's
hardly a standard notification and adds a lot of behaviour, because
manipulating DOM directly when it is managed by owl cannot be done
safely, it has been decided to simply make it its own widget separate
from the notification service, which can manipulate its own DOM freely.

task-2607393

closes odoo/odoo#74027

Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2021-07-20 13:13:03 +00:00
Xavier Morel 9f9d913fb7 [FIX] web_editor: de-traw-ify wysiwyg template
`0` should be implicitly markup-safe.

Also migrate the two escs to t-out, there's no reason not to.
2021-07-20 05:41:35 +00:00
Xavier Morel 80061de80c [FIX] web, web_editor: de-traw-ify
Convert assets cssContents and jsContents to Markup objects.
2021-07-20 05:41:35 +00:00
Younn Olivier e90e7c3e00 [FIX] web_editor: fix colorpicker display on html fields
ISSUE
When selecting colors options from the editor toolbar on a html field,
the colorpicker was not displayed under the toolbar.

CAUSE
Before this commit, the colorpicker dropdown position was computed with
top, bottom and height css properties.

After a new colorpicker was introduced with multiple sections of
different sizes, the size of the dropdown-menu could not be fixed
anymore and [1] broke the existing computation to display the dropdown
above or below the toolbar.

SOLUTION
Using bootstrap dropdown 'dropup' class instead of top, bottom and
height css properties.

[1]: https://github.com/odoo/odoo/commit/96ab729850983162a0039e40c77537ef65cd039e

closes odoo/odoo#73947

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-07-19 09:19:14 +00:00
Kamen Zhekov 22a76c230b [IMP] website: clarify drag&drop zones for website edit mode
When using drag&drop for adding elements to a product's page through
the website edit mode, users sometimes find the feature confusing to
use. Two examples of said confusion can be seen here:
- https://dashboard.userbrain.net/shared/qwl65bqlk6jg?t=404
- https://dashboard.userbrain.net/shared/k796mnj95pow?t=258

The suggestion for improvement was to reduce height and opacity for
the top and bottom droppable zones (available on all products), and
make any element not explicitly dropped in those zones go to the
zone below the product, available only on the product's own page.

This behaviour is extended to be more generic and is applied when
a dropzone has the class oe_structure_not_nearest, which excludes
it from the nearest search, unless the element is dropped explicitly
in a zone that has the class oe_structure_not_nearest.

task-2581641

closes odoo/odoo#73580

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-07-15 12:16:14 +00:00
qsm-odoo 017c335ab2 [FIX] web_editor: properly handle media "text tools" options
Since their convertion to "snippet" options with [1], the media options
were not handling previews correctly anymore, but also were recoding
their entire logic for each of the options instead of using generic
methods like selectClass or selectStyle.

One example of a bug was that previewing the 25% width option on an
image, not enabling it and saving the editor forced the image to a fixed
px width (its original one). Changing that image to another would keep
that wrong fixed width.

Note: this reveals that selectClass and selectStyle need more parameters
to handle all of this correctly. Most was added as a specific override
for these features but it could be handled even more generically.

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

Related to task-2578242
task-2577848

closes odoo/odoo#73734

X-original-commit: f59affcdfe9529645a02680214f3d7d96ebacf6e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-07-14 16:55:32 +00:00
qsm-odoo f34e944c2a [FIX] web_editor: use linter on snippets.editor.js file
Sorry but not sorry, I have to fix this file's "codestyle" (unread
variable, missing or extra ";" characters, etc) post-editor merge...
hard to work inside of it in the current state.

closes odoo/odoo#73629

X-original-commit: dbf245891099b506f21a66ea8e7a9146f6c9e28b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-07-13 12:13:33 +00:00
qsm-odoo 508a7f9806 [IMP] web_editor: consider common colors as custom when used in the page
Before this commit, if the user chose the "red" color suggestion, "red"
did not appear as a custom color (but the color suggestion was marked
as selected). This made sense in the previous colorpalette widgets but
not anymore as the suggestions do not always appear in all colorpickers
anymore.

Now those colors are always considered custom when used in the page and
at worst appear as "common" and "custom" at the same time (the "common"
one being the one which can appear as selected in that case).

Part of https://github.com/odoo/odoo/pull/67545
task-2476601

closes odoo/odoo#67545

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-07-13 08:20:02 +00:00
Younn Olivierandqsm-odoo f383905616 [IMP] website, web_editor: improve the colorpicker tabs selection
It is now possible to initialize the colorpicker with a selected tab.

Part of https://github.com/odoo/odoo/pull/67545
task-2476601

Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-07-13 08:20:02 +00:00
Younn Olivier 96ab729850 [IMP] web_editor: update color picker layout
In order to save space and gain clarity, the colorpicker elements are
now displayed in two separate tabs: "theme" and "custom".
It is still possible to display the combinations tab instead of the
theme one (for the background color option for example).

Part of https://github.com/odoo/odoo/pull/67545
task-2476601
2021-07-13 08:20:02 +00:00
xO-Txandqsm-odoo 92b184f6e2 [FIX] web_editor: set style for selected color combination
Part of https://github.com/odoo/odoo/pull/69857
task-2431484

closes odoo/odoo#73562

X-original-commit: 6e6adad730956c6ddceb1f2461a0eb341edf7433
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-07-12 11:21:02 +00:00
xO-Txandqsm-odoo 54fbee30c7 [FIX] web_editor: fix shapes snippet option
- Exclude '.o_we_pager_header' from click behaviour so clicking on the
  shape dropdown does not close it if an user misclicks next to a pager
  button.

- Add borders on navigation buttons in shapes option to improve
  visibility.

- Cut the last visible option in the shapes list, this way the user
  will understand that he can scroll.

Part of https://github.com/odoo/odoo/pull/69857
task-2431484

X-original-commit: 0d8e4368775bf7fd1aca1376e57c5847b283bded
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-07-12 11:21:00 +00:00
xO-Tx 1bea3d5dd8 [IMP] website, *: expand click handler on theme color palettes
*: web_editor

The goal of this commit is make the whole we-collapse elements
clickable for theme color palettes.

Part of https://github.com/odoo/odoo/pull/68061
task-2431484
2021-07-12 08:30:57 +00:00
xO-Tx ebfa28638b [IMP] website, *: allow to handle snippets with a list of items
*: web_editor

The goal of this commit is to add the "MultipleItems" option
to be able to add new elements in snippets with a list of items.

In this commit, the option is used for "Media List" & "Tabs".

Part of https://github.com/odoo/odoo/pull/68061
task-2431484
2021-07-12 08:30:57 +00:00
xO-Tx 7ea2350255 [IMP] web_editor: set tooltips on sidebar elements
The goal of this commit is to add BS tooltips for editor
sidebar elements using "data-tooltip" attribute to select targets.

The code used to show tooltips on sidebar tab buttons is removed
in this commit since it has no effect after [1].

[1]: c71cf6c618b48da36fbc5063140703312248bc09

Part of https://github.com/odoo/odoo/pull/68061
task-2431484
2021-07-12 08:30:56 +00:00
Nicolas Bayet 4600086e7a [IMP] web_editor: move odoo-editor into odoo
The code of the Odoo editor was on another repository
and that created unnecessary overhead. This commit move
the code inside Odoo and slightly change the folder
structure.

Related PR:
saas-14.3: #73345
saas-14.4: #73348

closes odoo/odoo#73272

Master: #73272
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
2021-07-08 15:31:45 +00:00
qsm-odoo f70ad06775 [FIX] web_editor: remove loading effect during snippet drag and drop
When starting a drag and drop of a snippet, a loading effect on the
editor panel was performed for the whole duration of the drag. Worse:
even if the drop was done immediately, the loading effect still occurred
for 400ms as it was only marked as finished after the scroll to the
dropped snippet.

The loading effect addition was in fact a side-effect of first disabling
all editor overlays at the start of the drag... but that action was in
fact entirely unnecessary because this is not possible to have any
overlay enabled when the snippet panel is opened (because opening it
already disables all editor overlays and enabling an overlay forces the
editor to switch out of the blocks panel).

closes odoo/odoo#73437

X-original-commit: adad8a33071fbbff16d78741904ec33b3595e00b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-07-08 14:01:23 +00:00
Younn Olivier 45835afe24 [FIX] web_editor: reintroduce request_editable event (2)
Forward-port of a commit that was wrongly forward-ported with [1], half
of the diff was lost because it landed in master before the merge of
another commit which removes what was being reintroduced here...

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

closes odoo/odoo#73287

X-original-commit: 68d7d42cce012269342e18373a30970e2c582ba3
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-07-06 09:56:31 +00:00
Younn Olivier d2189dc3bf [FIX] web_editor: correctly display selected basic color
When selecting a "basic" color from the color picker, it was displayed
as a custom color.

It was due to the fact that the basic colors were not correctly computed
to build the existing colors: the array of the rows was used instead of
the array of the colors.

Part of https://github.com/odoo/odoo/pull/72978
task-2476601

closes odoo/odoo#73139

X-original-commit: 23b182ab1bce9a00cb75d12b0d0c504d1fe19e2f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-07-02 11:26:12 +00:00