Commit Graph
2618 Commits
Author SHA1 Message Date
Samuel Degueldre ff8070033b [FIX] web_editor: show mimetype warning for illustrations
Previously, when clicking on an illustration in the editor, the image
options would be unavailable with a message saying that it was due to
technical limitations, and that the user should reselect the image in
the media-dialog for quality options to become available. This was
caused by the fact that in order to support more than one customizable
color in illustrations, they are now saved inside the database with an
url containing which colors are customizable inside the url's query
parameters. Since the endpoint that finds which attachment corresponds
to which image src was looking for an exact URL match, but query params
are trimmed on the client side before talking to the endpoint, they were
no longer matching.

This commit fixes that by searching for attachments whose URL matches
the provided one with or without any extra query parameters.

closes odoo/odoo#67625

X-original-commit: b26319c3c9409e8724fadeec80e63ea94dc8d599
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-10 17:59:34 +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
Jeremy Kersten f09c84c022 [FIX] base, web_editor, website: add missing encoding on etree.tostring
Since lxml 4.5.0 that use now use libxml2 2.9.10, without it, it can crash.

Here sample of content that is broken:
https://drive.google.com/file/d/1gB2-jl4fabHscLjH9OZc4WZgtSEbCVj7/view?usp=sharing

note: this commit is to merge 3 changes of #64526

opw-2428617
opw-2428664

closes odoo/odoo#66883

X-original-commit: 38983d123d171ac3cc1efacd99d9776f0ed08734
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-26 07:55:25 +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
Martin Trigaux 9741ef5ee6 [I18N] *: export saas-14.2 source terms
For odoo-master Transifex project, no demo data

closes odoo/odoo#66500

X-original-commit: 813931ac850e5ba4181259a5957ec72226fb670c
Related: odoo/enterprise#16510
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-02-19 08:02:58 +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
Nicolas Lempereur 09e5b712ef [FIX] mass_mailing,web_editor: content no under sidebar
Depdending on situation several fixes (f885202, fc8e446) leads to issue
in small screen size:

- in iframe editor with without snippets => the width of the content is
  decreased of several times the sidebar that is not shown

- in editor with sidebar => the content gets behind the sidebar

With this changeset we remove part of the above commits which seem to
fix both issue.

note: this also fixes that the mass mailing content applied CSS should
not depend on screen size, or what is send would differ dependin on
which screen size clicked on SAVE (on last inlining of CSS).

opw-2426400

closes odoo/odoo#66104

X-original-commit: 3e41618240036f1f47bb25b993c46b4d268031d5
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-12 16:32:37 +00:00
Nicolas Lempereur 65a916b048 [FIX] web_editor: content under top bar in iframe
In ff81fa479 there was some refactoring for change of structure on
frontend, but for the iframe editor (eg. mass mailing), this caused that
the top edition bar was over the content.

opw-2426400

closes odoo/odoo#66099

X-original-commit: d4a2e6cda246b498f604ac5765a5ef5d0041a577
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-12 15:59:43 +00:00
Jeremy Kersten 1d5634ba8a [FIX] base, web_editor: don't crash on deleted records
task-2458109

closes odoo/odoo#66023

X-original-commit: 550043b6c36cf657e6cee229676a95ee6482e421
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-02-11 19:52:25 +00:00
Samuel Degueldre 5845bef12b [FIX] web_editor: insert record name as text
Previously, the many2one widget from the web_editor used jQuery's
'.html()' method when inserting a record name into the page. The record
name was not HTML-escaped before this, which may have unexpect result
and break the layout.

This commit fixes that by using the '.text()' method instead.

This bug only affects pages containing a many2one (contact excluded)
at the time of selection and not after the selection.
e.g. on the /event page, changing the category of an existing event
via the website editor

closes odoo/odoo#65686

X-original-commit: 53aff7f07317a8261b8b9c3e462d930141c7081b
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-02-08 09:04:12 +00:00
Benjamin Vray 81f907ce1c [FIX] web_editor: allow to center button with summernote
Before this commit, it was not possible to center a button using the
editor option 'align center'.

It is because, using document.execCommand(), the Chrome browser doesnt
want apply 'text-align: center' on nodes with centered children. And
the buttons have the boostrap class '.btn' which adds text-align:
center.

So the hack here is disabling the text-align property from the '.btn'
class during the execution of document.execCommand().

task-2423935

closes odoo/odoo#65566

X-original-commit: d4f38c344360713287eed22872614f46dec7e0f6
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-04 16:14:02 +00:00
Samuel Degueldre 480327381a [FIX] website, web_editor: fix empty parallax snippet not being removed
Previously, when removing all the content of a snippet, that snippet
would get automatically deleted. This was not the case for parallax
snippets because we previously intended the user to drop the parallax
snippet, empty it, and drop other content inside of it.

Recently, we added the parallax option on all snippets, rendering the
previous workflow obsolete. There is now no longer any reason to keep
empty parallax snippets. This commit fixes that.

task-2446008

closes odoo/odoo#65551

X-original-commit: 61f410b57f1c28bd6464b86d1582c22b7fd846d5
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-04 15:18:36 +00:00
Benoit Socias 1044a76a19 [IMP] web_editor, test_website: allow renaming custom snippet blocks
When you save your custom snippet you probably won't give it a
specific name.

Before this commit several custom snippets name was specified on save
and there was no way to modify their name afterwards

After this commit custom snippets are assigned a generated name but they
can be renamed afterwards

task-2374802

closes odoo/odoo#61483

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-03 15:13:19 +00:00
xO-Tx 6186d0e824 [FIX] web_editor: fix background layers buttons
Example to reproduce:

Drop the "Cover" snippet and try to remove the background
image. Clicking on image button has to be done 3 times to land on the
correct result:

- First click removes image, but not filter and leaves both buttons
  checked
- Second click removes the filter and unchecks its button.
- Third click unchecks the image button.

It should be one click to remove image, filter and uncheck both buttons.

The goal of this commit is to prevent _applyOptions() from setting
background-image values if image is not optimizable. This filter will
solve the issues since empty values (badly parsed by getBgImageURL())
won't be added as background urls.

task-2312878

closes odoo/odoo#65438

X-original-commit: aba9056e7baa58decf147313678ad9d1f4522dee
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-03 08:26:36 +00:00
Michael Mattiello (mcm) b89e6245ec [IMP] web_editor: make field html quick editable
This commit makes the field html quick editable.
We can click on a field html to switch the form view to edit mode but
if we click on a link in the field, the link will have the priority.

task 2330101
2021-02-02 13:43:59 +00:00
Benjamin Vray f9bd3033b2 [FIX] web_editor: fix dropzones with invisible element
Before this commit, dropzones were created around invisible elements
(e.g. the snippet popup). So we had 2 dropzones instead of one at some
locations.

After this commit, we avoid creating dropzones around elements that
must not have dropzones.

task-2312878

closes odoo/odoo#65230

X-original-commit: ad56d50e3da000cacdc70d9230cad308d03680bf
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-28 17:08:05 +00:00
Nicolas Lempereur 60839ef570 [FIX] mass_mailing, web_editor: send mail to outlook and keep image size
Office Outlook doesn't take into account the [style] attribute, and it
doesn't manage width/height in percent value.

This commit set width/heigth attribute in pixels and also always set the
width/height in style attribute (keeping them in the original unit and
setting them to auto if not present).

This is a reintroduction of 2015 commit bdf58adb46

opw-2447756

closes odoo/odoo#65218

X-original-commit: c51762a790d6fefd97e6c818bfaa9307180dd5b5
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-01-28 13:30:09 +00:00
Benjamin Vray 6dc5c785e6 [FIX] web_editor: prevent a modal from closing when dropping a snippet
Before this commit, when you dropped a snippet using the move button
in a modal. The modal closed after the drop.

This commit allows to define an element in which to destroy the
editors.

Part of https://github.com/odoo/odoo/pull/61998
task-2312878

closes odoo/odoo#65166

X-original-commit: b7d522e9e7e31ac6bf926aae65e58d9f6cfa8903
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-27 17:48:29 +00:00
Benjamin Vray 40795c0036 [FIX] web_editor: fix scroll during dragging a snippet in a modal
Before this commit, it was not possible to scroll a popup with a
dragged snippet.

Part of https://github.com/odoo/odoo/pull/61998
task-2312878

X-original-commit: edf28efe19bedfe5eb62baf6fa5832a50d18e775
2021-01-27 17:48:27 +00:00