Commit Graph
1880 Commits
Author SHA1 Message Date
Aaron Bohy c89cdcf11c [FIX] web: tests: patch form multiClickTime once for all
A lot of tests in different QUnit modules need this delay to be
patched to 0. Some of them (e.g. the 'ActionManager > Misc' module)
didn't patch it correctly. It worked before because a patch was
done in a previous test, and wasn't unpatch. The previous commit
ensures the patch is removed, so now we have at least 2 tests of
the above mentionned module that fail. This commit ensures that
the delay is patched in every tests, and allows to specify a
custom delay if necessary.
2021-03-31 09:30:07 +00:00
Nicolas Lempereur 26b29de7d2 [FIX] web_editor: no quick edit on html link click
When clicking on link in html fields, we do not wish to start quick
edition. With this change this is excluded.

closes #68023

closes odoo/odoo#68212

X-original-commit: ecbdddbf0cff0964b44e7f0571d372ccbd051a72
Related: odoo/enterprise#17235
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-03-22 16:59:38 +00:00
Nicolas Lempereur 8a5d22826c [FIX] website_forum: show normal image modal in forum
In #67893 the image icon was removed, but it contradicts the interface
and made a feature that was working for employee less available.

Since saas-12.3, we always use the full media dialog when showing the
editor on the forum so we could not add an image with the image icon if
were not an employee.

Before saas-12.3, the original summernote image dialog was shown for
everyone but website editor that saw the full media dialog (beecause we
are using the same editor to do both things).

With this change, we always have the original dialog in the forum
message editor thanks to a new option "disableFullMediaDialog".

opw-2470720

closes odoo/odoo#68166

X-original-commit: c026c360fb77ce43f47f7645f48e37bced988b85
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-03-19 18:30:00 +00:00
Sébastien Mottet (oms) 2323af4451 [REF] website, *: centralize color palettes in website
*: web_editor

All theme specific color palettes have been moved into website.
It allows to access them without having to install theme modules and
this is a preparation for our website configuration screen task.

Lists of palettes have been replaced by maps with palette names as keys.
Those names are composed of the palette's original theme name ('generic'
or 'base' for palettes not specific to a theme) and of an index
(ex: 'anelusia-2'), for compatibility.
To keep compatibility with previous version we also convert old color
palettes number to color palette name, specifically for each theme.

A side effect of this change is that we got rid of all gray palettes
which existed in some themes. Those were not fitting the new possibility
of gray customization in the third panel and were not always really a
good customization of the default grays (they still were there mainly
for historical purposes). Unfortunately, this may have some side effect
for old websites which used those grays but the new gray palettes (left
to the default one) should most of the time come as an improvement of
the old ones, and they are now customizable by the user. In the future,
we may associate a perfectly-chosen default gray palette, fitting the
customization system, for each color palette.

PR: https://github.com/odoo/odoo/pull/67488
task-2451965

closes odoo/odoo#67488

Related: odoo/design-themes#455
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-26 11:31:17 +00:00
Romain Derie bad0926ab1 [FIX] web_editor: don't run code when input is emptied
Before this commit:
  - Edit mode, open image dialog
  - Upload an image to the media dialog
  - Reclick on Upload but don't select an image, close the browser image
    selector
  - This will trigger the input change event, as the input was emptied

This is needed since in later commit, `_addData()` will do some code outside
of the `files` loop, which is useless if there is no files selected.
In thise case, the issue would be that it would open an empty toastr.

task-2345082
Coming from #65828
Closes #68326

closes odoo/odoo#68340

X-original-commit: 94c45412714c1263788b2567ce3c9581453b2cd4
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-25 12:35:11 +00:00
Samuel DegueldreandArthur Detroux fb05e0f554 [FIX] web_editor: fix race condition in option selection
Previously, when selecting certain options, especially ones which had
slow updateUI methods, the selected value was sometimes reset to its
previous value. This was caused by a race condition in which, when a
snippet option updated its value, it would wait for options on the
parent snippet editors to update all of their options' UI, but it
incorrectly only waited for *one* of the snippet editors to finish
instead of waiting for all of them.

This commit fixes that by stopping the event propagation and triggering
a new event that will let the direct parent know when all parent editors
are done updating their options' UI before signalling that the UI update
is done.

task-2487578

closes odoo/odoo#68341

X-original-commit: 7623a0c771495cd41bf40af37c0d2b6e4beb7cdc
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Arthur Detroux <ard@odoo.com>
2021-03-25 12:37:35 +00:00
Samuel Degueldre 73f4fad9ee [REF] website_blog, *: adapt blog-post option to use new m2m for tags
*: web_editor

This commit refactors the website blog option to use the newly
introduced Many2manyUserValueWidget

Part of https://github.com/odoo/odoo/pull/67832
task-2274732

closes odoo/odoo#67832

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-25 09:27:18 +00:00
Samuel Degueldre be05ac7e2b [IMP] web_editor, website_form: introduce m2m UserValueWidget
This commit introduces a many2many as a standalone, reusable
UserValueWidget. This widget is built on top of the ListUserValueWidget
which was until now only used in website form that had to be updated to
allow more generic use of the widget.

Part of https://github.com/odoo/odoo/pull/67832
task-2274732
2021-03-25 09:26:53 +00:00
Oussama MESSAOUDIandqsm-odoo 35d27a6c1d [IMP] website, *: control hue and saturation of grays
*: web_editor

The purpose of this commit is to control the hue and the saturation of
the gray palette.

task-2362091

closes odoo/odoo#66428

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-03-24 17:36:14 +00:00
Oussama MESSAOUDI 0edb5e2985 [IMP] web_editor: trigger event oninput for input range type
Add an event listener triggered on current value change of input range.

task-2362091

closes odoo/odoo#66812

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-23 16:18:19 +00:00
Oussama MESSAOUDI 91703b9ff5 [IMP] website, *: improve the UI of the mobile visibility option
*: web_editor

Adding the option to show/hide on mobile at snippet level + review the
UI (now a top action button).

task-2431659

closes odoo/odoo#65013

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-23 10:15:24 +00:00
Samuel Degueldre 7e1ba0de41 [FIX] web, web_editor, website: fix incorrectly translated template literals
closes odoo/odoo#68105

X-original-commit: e1d280880c26d6139dc6a3679fb7df7e07defdd6
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-03-18 16:05:37 +00:00
Xavier Morel 73d25e253e [FIX] web_editor: selector exclusion rule
The current rules would allow through a selector of the form

    :not(sel1, sel2)

then because the matcher thing just splits on `,` it would store the
incorrect sections

    :not sel1(

and

    sel2)

as separate selectors in the rules cache, raising an exception when
matching against elements.

Move all the rules to a single regex, and add a rule to exclude any
situation where a comma or an open parenthesis is inside of an open
parenthesis pair: we can't just check if there's a closing parenthesis
with no intermediate `,`, because the selector could be

    :not(:nth-child(3), sel2)

in which case the selector would "pass" as the regex would match the
nth-child's closing paren to the not's opening. This means some
selectors *could* be unnecessarily blacklisted, but currently we don't
have any such nested pseudo-classes so...

If we want to resolve this, we need to actually parse the
selector (using something like Sizzle I guess) in order to properly
split the selector-list and take a real look at the selector's
structure. Maybe one day.

closes odoo/odoo#68093

X-original-commit: d50c3b07f1c0644ac8e412f099ddd7b139671060
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-03-18 14:55:13 +00:00
xO-Txandqsm-odoo f98d1c4b21 [FIX] web_editor: fix selection style for icons
The code added in [1] to update style for multi image selection
is not compatible with .fa icons and causes a strange behaviour when
trying to select one.
The goal of this commit is to fix style for selected icons on media
dialog.

Also fixes the fact the icons were not centered before.

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

closes odoo/odoo#67846

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-03-15 17:05:48 +00:00
Younn Olivier 9bbe5be3fb [IMP] web_editor, *: display handles overlay only when needed
*: website

When declaring a SnippetOption, it is now possible to specify if the
display of the handles overlay should be visible on the snippet element.

By default, it is set to false, and if the selected snippet element does
not have any option that require the handles to be displayed, we will
display them on the first parent element that needs the handles to be
displayed.

In the context of an image, the handles will be displayed on the parent
column, as the image does not have an option that require the handles.

Part of https://github.com/odoo/odoo/pull/66550
task-2431684

closes odoo/odoo#66550

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-12 10:16:14 +00:00
Younn Olivier f3ccc91d42 [IMP] website, web_editor: add an icon to replace images in edition
From the editor, when clicking on an image there is a new refresh icon
next to the delete icon that will open the media dialog to allow for its
replacement.

Part of https://github.com/odoo/odoo/pull/66550
task-2431684
2021-03-12 10:16:04 +00:00
xO-Tx 9d2398ac59 [IMP] web_editor: update style for background button
The goal of this commit is to update style for Media Picker button.

Part of https://github.com/odoo/odoo/pull/66544
task-2326573

closes odoo/odoo#66544

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-09 11:02:50 +00:00
xO-Tx 38dc9c82c5 [IMP] website, *: replace spacing selection by a slider
*: web_editor

The goal of this commit is to tweak the code of <we-range> widget
to be able to select a css using class values.
This way, the image spacing selection can be easily replaced by
a slider of 4 levels [0 -> none, 1 -> small, 2 -> medium, 3 -> big].

Part of https://github.com/odoo/odoo/pull/66544
task-2326573
2021-03-09 11:02:42 +00:00
xO-Tx b1e48c8dd2 [IMP] web_editor, *: update multi image selection layout
*: website

The goal of this commit is to improve multi image selection
(Image Wall, Gallery...) using the same layout as in selected themes
for selected images.

Part of https://github.com/odoo/odoo/pull/66544
task-2326573
2021-03-09 11:02:14 +00:00
Samuel Degueldre 126a09cc42 [FIX] web_editor: fix media-dialog not showing most images
This was caused by trying to not show dynamic-svgs that had already been
downloaded when the option to not allow the media-library was activated
(eg in the website logo, we do not want to allow dynamic SVGs)

Unfortunately the domain was doing a string comparison to make sure the
url wasn't like the one from dynamic SVGs but implicitly required that
the url field be not null. This commit fixes that by explicitly allowing
images with a null url field.

task-2466819
part of odoo/odoo#66732

closes odoo/odoo#67411

X-original-commit: 0784e14dd39817720e6fc70c2b41ea3bbad5843a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-05 18:39:01 +00:00
Samuel Degueldre 6c7476f5df [FIX] web_editor: adapt warning when quality options are unavailable
Previously, when quality options were not available, the option would
simply not be displayed. User feedback suggests that this is confusing,
as for example, in the case of modifying the image in a t-field, quality
options would not be available when starting the editor, but would
become available when picking the image again in the media-dialog.

Some leftover code allowed to display a warning about why the quality
options were not available in the case where the image is not local to
the database. This warning has been adapted to display a more
informative message about why quality options are not available, as well
as suggest a solution:
- External image => download the image and upload it in odoo
- t-field => "You need to choose this image again in the media-dialog or
reupload it to have access to quality options"
- Images that are in an unsupported format (anything other than PNG or
JPEG) => short explanation that quality options are only available on
PNG and JPEG images.

task-2466819
part of odoo/odoo#66732

X-original-commit: 84417a174bc2bb76730cc89783d3426a3a3b07d9
2021-03-05 18:39:01 +00:00
Younn Olivier 2ecb5e1777 [FIX] web, web_editor: customize colorpicker inputs from web_editor
Styles for the hex and rgba inputs from the color picker were modified
on directly from the web module, which means that for a specification
concerning only the frontend colorpicker, the backend colorpicker was
also changed.

This commit reverts the changes that were made and only applies the new
style for the website editor.

Related to https://github.com/odoo/odoo/pull/65249

closes odoo/odoo#67396

X-original-commit: 9529e29615699942aac89099cd37144e052b9004
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-05 16:17:55 +00:00
jpr-odoo 1b82374262 [FIX] web_editor: prevent traceback when custom color area is excluded
Bug since the combination of [1] and [2].

[1]: https://github.com/odoo/odoo/commit/1c1894d6d976806be6951db54a3b741dfd093ece
[2]: https://github.com/odoo/odoo/commit/8b5640b46a33fec5fdac4b19ea354e67211e8e46

task-2464340

closes odoo/odoo#67364

X-original-commit: d7a540c545cfe2500b08f5d6dfb6fe99747cc7de
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-05 13:12:10 +00:00
xO-Tx 1d8077c375 [FIX] web_editor: fix parent element selection
When a block is removed, the parent will be activated.
If the parent element is empty and removable:

1) It will be removed too.
2) In '_activateSnippet' method, we look for the right element to
   be selected using the block's parent (removed from the DOM...).

The goal of this commit is to fix this behaviour by computing the
selected element before parent removal.

task-2431506

closes odoo/odoo#67354

X-original-commit: 1d483ab5e2f9bba0fd86c6fe4595a9959b2f125d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-05 12:40:43 +00:00
xO-Tx 048612f21b [FIX] web_editor: fix anchor range selection
When we double click a form submit anchor, and depending on the selected
element before click, the selection range ("document.getSelection()") can
start from a parent of the targeted node. This will send a wrong range
to be used in LinkDialog widget.

The goal of this commit is to prevent this behaviour by adjusting the range
if it starts from anchor parent.

Note: the bug only occurred in Firefox.

Part of https://github.com/odoo/odoo/pull/62206
task-2381305

closes odoo/odoo#62206

closes odoo/odoo#67171

closes odoo/odoo#67176

X-original-commit: 9a16c313f131ed2e1017566a5f1bed134e22cc10
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-04 16:48:50 +00:00
xO-Tx 6c8fea3c1e [FIX] website_form, *: allow to update buttons using link dialog
*: web_editor, website_mass_mailing

When we double click a link/button, a link dialog appears
to update the target properties, and since the current link dialog
can only handle anchor targets, using it on buttons leads to some
inconsistencies :

- visible href options for button & url required to save changes.
- missing preview when button style changed.
...

The goal of this commit is to add a fix (with minimum of code) on
summernote linkdialog to handle button elements using the same logic as
anchor nodes.

Also, update website form test tour to test those new changes.

Part of https://github.com/odoo/odoo/pull/62206
task-2381305

X-original-commit: 19fbbdc0327482b5d70bdbcf17c2a5a950327d63
2021-03-04 16:22:08 +00:00
xO-Tx 2cdd95f140 [IMP] web_editor: select siblings when block is removed
CONTEXT: Within a container, delete a block which has a sibling.

The actual behaviour is to select the container after deletion.

The goal of this commit is to select the previous sibling (if exists),
or next one. Otherwise the parent element will be selected (default behaviour).

task-2431506

closes odoo/odoo#64875

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-26 18:17:17 +00:00
Damien Abeloos 62ae7896f5 [IMP] mass_mailing: add various usability improvements
* When clicking on a button that is a preview for a "mass mailing",
  always open it in a new window for the user that is editing the form, so
  that changes are not discarded (when leaving the page).
    - The option "Open in a new window" remains effective for the recipients of the mail.

* Rename Mailing Campaign to Campaign : this is just a mailing campaign,
  they are used everywhere in the marketing scope now. And it can be part of
  a multi-channel campaign.

* Show/hide mailings count depending on settings :
    - Mailing Campaign must be activated in the email marketing settings in
    order to display the Mailings count in the utm.campaign kanban view

* When there is no matching recipient for a mailing campaign,
  properly display 0 / 0 instead of 0 / 1 to better indicate that it is
  not expected that anyone will receive an email.

Task ID : 2410217
PR : https://github.com/odoo/odoo/pull/63370
2021-03-03 12:12:52 +00:00
Thibault Libioulle 4196af9c03 [IMP] web_editor: open external links in new tab
This commit aims to force to open in a new tab out-of-domain hyper-links
in backend html fields.

Previously:
When a user adds a link in an html backend field, the user is free to
choose if the link will open in a new tab or not with a check box.

After this commit:
When a user adds a link in an html backend field, this link opens a new
window if those two conditions are met:
    - The url doesn't begin with the current location origin;
    - The url doesn't begin with a "/", i.e. an internal link
      that has been stripped.

The user doesn't have the check box option.

Remark:
This doesn't affect previously added links BUT if a previously added
link is opened in a LinkDialog, it will be re-rendered following the
conditions hereabove.

Part of https://github.com/odoo/odoo/pull/64622
task-2377544

closes odoo/odoo#64622

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-03 13:46:06 +00:00
fja-odoo 9ea276ae2f [IMP] website_form, *: allow form default input value
* = web_editor

Add support for default values on website form

Compatible fields are: textarea, text, number, date, datetime, unique
checkox, multiple checkboxes, radio buttons, select.

Part of: https://github.com/odoo/odoo/pull/47949
task-2011583
2021-02-26 14:40:49 +00:00
fja-odoo a51a8af931 [IMP] web_editor, *: enhance date/time picker
* = website

Add we-datepicker
Allow empty date/datetime inputs
The countdown was the only snippet using this so if no date it will
default to timestamp 0 and display a resolved countdown.
Before it was the moment().now() datetime which is the same result:
0 time remaining.

Part of: https://github.com/odoo/odoo/pull/47949
task-2011583
2021-02-26 13:51:13 +00:00
fja-odooandqsm-odoo 9304f8fa7b [REF] web_editor, *: make form list a UserValueWidget
* = website_form

The form we-list is now a generic UserValueWidget.

Part of: https://github.com/odoo/odoo/pull/47949
task-2011583

Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-02-26 13:51:13 +00:00
fja-odoo eb80d33471 [IMP] web_editor: remove empty attributes
Empty attributes were not removed from the element.
This is an issue for attributes like checked/selected on input/select.

Part of: https://github.com/odoo/odoo/pull/47949
task-2011583
2021-02-26 13:51:13 +00:00
fja-odoo a34043d404 [IMP] web_editor: add selectProperty option method
This method will enable property selection as an option default method.

Part of: https://github.com/odoo/odoo/pull/47949
task-2011583
2021-02-26 13:51:13 +00:00
Nicolas Lempereur 3eb61dca64 [FIX] web_editor: have video button even if sanitized
If a field is sanitized, a6e2b48 would hide the video button because
the video does not show in backend. It is better for the consistency but
if the field appear in frontend, the video would still show so we
prevent something that worked (but is very not user friendly when
editing in backend).

This changeset go back to the previous behavior (keeping the code
simplification), at one point there should be a fix so at least when
editing we see the video (currently we see an empty div in given
conditions).

opw-2463746

closes odoo/odoo#66920

X-original-commit: 73f5781
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-26 12:32:37 +00:00
Nicolas Lempereur 907c66cb31 [FIX] web_editor: bgOptimize+parallax=bg no kaput
Scenario:

- set new background image
- set parallax
- save

=> on next edition, the editor doesn't work on background anymore

Why:

- backgroundOptimize copy attributes of the original image to the real
  target element on save
- parallax change the real target element to a new child

=> so if the original element was an editor (with data-oe-model, ...)
   attributes, with the combination of the two options we will save
   these editing attribute on the child element which is wrong (the
   editing attributes are added dynamically and should not be saved).

With this changeset, we don't copy the editing attributes in
backgroundOptimize when we copy the original target image.

opw-2427560
opw-2429340

closes odoo/odoo#66691

X-original-commit: 6e47db5efcd78157f054144315a4812bbb6fbbd9
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-23 13:05:58 +00:00
xO-Tx 42b630bd1c [IMP] web_editor: enable click on style tab
The goal of this commit is to enable the click on Style tab
in "Edit mode".
The click on this tab with no block selected will display a
message to inform the user that he has to select a block
before editing.

task-2443297

closes odoo/odoo#65573

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-23 13:05:35 +00:00
Nicolas Lempereur 33fc445ae2 [FIX] web_editor: can set bg position on root editor
Scenario:

- go to /slides and start editing the page
- change the position of background banner
- save

=> traceback

Why:

The code for pan tool duplicates the target element in an overlay. In
the given use case, it means a node with .o_editable class is created
that will cause an error when saving because the code expect the cloned
element to be an editor (in `RTEWidget.save()`) but it is not (and is
eg. missing `.data('options')`).

opw-2427560

closes odoo/odoo#66643

X-original-commit: 96c22e816981d72c185520750167c514c6bded5b
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-22 20:07:07 +00:00
xO-Tx 2d58bbece6 [FIX] web_editor: fix anchor click on submit button
Context:
1) Edit mode
2) Click on anchor edition button of website form submit button
3) Traceback occurs

The "focus" triggered on $editable element in editor's 'getLinkInfo()'
discards user's text selection on submit button, as a result,
'range.create()' method returns null since no selection is found.

Note: the bug only occurred in Chrome.

Note 2: [1] apparently tried to solve the same issue but the fix was not
        solving it correctly, at least not in all cases.

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

opw-2443441

closes odoo/odoo#66574

X-original-commit: adf3d039acbac60b7ea7e6ab0ea8fdd9f940c3b2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-19 18:45:16 +00:00
Nicolas Lempereur 2aa2ab1fb2 [FIX] web_editor: no error background position + ctrl Z
Scenario:

- start editing background position
- press TAB key
- press CTRL + Z

=> traceback

Why:

Restoring a snapshot with CTRL Z can send a click event with target not
wrapped in a jQuery object which was not expected by the code.

reported in https://github.com/odoo/odoo/pull/66462#issuecomment-782025417

opw-2423445

closes odoo/odoo#66564

X-original-commit: 2c0aa825ee54ed674ff9f43722031df8e2f35ca6
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-19 17:10:14 +00:00
Nicolas Lempereur d10d0b2da4 [FIX] web_editor: don't save cropping tool on CTRL+Z
Scenario:

- start cropping of an image
- press TAB key
- do CTRL + Z

=> now the image cropping tool are inside the page and there is no way
to remove them.

Why:

The image crop tool was added inside the editable elemnt, so if we did
an action that changed history the cropping tools are saved in the
snapshot and going back to it will add them without any code handling
their removal.

opw-2394877
opw-2423445

closes odoo/odoo#66499

X-original-commit: ce93cbd78e282e6957aaeba6f06945f94bfffb26
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-18 16:52:29 +00:00
Nicolas Lempereur 03f8dffebd [FIX] web_editor: shift+enter in editor add direct newline
Enter keypress browser event were removed in 3c372d1da8.

It was reintroduced in text fields with d2f024d254 and in source mode
of html field with b10ca1f6094b.

When doing ENTER in the editor, we do our special case of ENTER (eg. it
will split the container in two and have other custom behavior) but when
doing SHIFT+ENTER we let the browser handle it and add a normal newline.

With the "Enter" prevention, SHIFT+ENTER did not work.

opw-2463746

closes odoo/odoo#66455

X-original-commit: 27b84138b422f0dbb3e01c83bb817d0880e3eab3
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-18 12:34:23 +00:00
Nicolas Lempereur 6cdcd9a3c0 [FIX] web_editor: stop loading button once ace saved
When we edit a view with ace in eg. studio, if it works the saved button
would never be enabled again because of missing callback.

Match the behavior of dom.addButtonLoadingEffect other usage (80592abd).

opw-2457046

closes odoo/odoo#66301

X-original-commit: 5324f7a6aa757ff6a728258ea1877ded4a6f86cd
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-16 17:39:04 +00:00
Benjamin Vray fed5854e32 [FIX] web_editor: fix drag and drop when drop zones are too close
Before this commit, the preview of the dragged snippet didn't work
when moving a dragged snippet from a drop zone to an other drop zone
when there was no space between those drop zones.

It is because, in this case, the over event of the second drop zone is
triggered before the out event of the first drop zone.

task-2312878

closes odoo/odoo#66267

X-original-commit: 66b468626e046a13a463cff3a2285801016f3ed7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-16 13:30:12 +00:00
Benoit Socias 875aca63f7 [IMP] web_editor: reuse palette from previous shapes when enabling one
Before this commit when toggling shapes on a snippet background, the
shape color palette was always set to the default one.

After this commit when toggling shapes on a snippet background, the
shape color palette is computed by combining the default palette with
the palette of the previous shapes in the page.

task-2431445
https://github.com/odoo/odoo/pull/64515

closes odoo/odoo#64515

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-03 12:08:51 +00:00
Benoit Socias fe44184b48 [IMP] web_editor: open shape selection when enabling shapes
Before this commit when toggling shapes on a snippet background, the
shape selection dropdown was shown as closed.

After this commit when toggling shapes on a snippet background, the
shape selection dropdown is automatically opened.
We have to use a click() on the toggler instead of an open() on the
dropdown to make the page containing the selected shape appear when
opening.

task-2431445
https://github.com/odoo/odoo/pull/64515
2021-02-03 12:08:51 +00:00
Benoit Sociasandqsm-odoo b67084e729 [IMP] web_editor: instantiate color palette only when necessary
Color palette are only visible once they are opened. However, we
instantiate them a lot to build the "options" editor panel which caused
the editor to appear buggy for some users... even if they would never
open a colorpalette. This fixes that issue. The fix is not entirely
stable but was made as stable as possible... better implementation will
be done in master.

task-2439295
https://github.com/odoo/odoo/pull/65223

closes odoo/odoo#66217

X-original-commit: 9aeba7dec95b397ef894f5a181920dff269d6ad4
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-02-15 18:30:10 +00:00
Benoit SociasandSamuel Degueldre caaaaa0785 [FIX] web, web_editor: avoid rendering color palettes more than once
Before this commit the palette was rendered each time it was opened.

After this commit if the palette has already been rendered only the
selected color is being updated in the palette (and its colorpicker).

task-2439295
https://github.com/odoo/odoo/pull/65223

X-original-commit: 7f19f63b18bc7d17a393b3535492c7f90595ca39
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2021-02-15 18:30:09 +00:00
Benoit SociasandSamuel Degueldre 62b4e968c9 [FIX] website, web_editor: ensure the loader appears on click options
Before this commit the loader did not always get displayed when
switching to the options tab.

After this commit the loader always gets displayed ASAP when switching
to the options tab until the tab is ready and displayed.

task-2439295
https://github.com/odoo/odoo/pull/65223

X-original-commit: f2fa17540e130b5cf3f70570a3a97495cfbb7499
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2021-02-15 18:30:08 +00:00
Samuel Degueldre aa9c71f689 [IMP] web_editor: introduce many2one UserValueWidget for reuse
Previously, edition of many2ones in the front-end was done through a
snippet option. While this works fine for raw many2ones in the page, it
is desirable that other snippet options can leverage a many2one as a
part of a more complete or comprehensive option. This commit introduces
a many2one userValueWidget that will be able to be reused by snippet
options, and adapts the existing many2one snippet option to use it
instead.

The interface has also been reworked so as to lean on the existing
we-select UserValueWidget for the sake of interface consistency.

Thanks to fja-odoo for first iteration.

task-2190603

closes odoo/odoo#63835

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-09 09:36:42 +00:00