Commit Graph
1146 Commits
Author SHA1 Message Date
Sébastien Theys 5275f16f24 [IMP] web_editor: remove the unused onUpload option
This was introduced in b26ad79a8c
and only used in `addons/web_editor/static/src/js/editor/rte.summernote.js`
at that time.

Then that file has been removed in f296992317

PR: #33509
2019-05-27 16:32:52 +00:00
Sébastien Theys 3924abb71b [IMP] web_editor: make media widget save always return a Promise
Before this commit, the return value would be mixed. For consistency, make it
always return a Promise.

PR: #33509
2019-05-27 16:32:52 +00:00
Sébastien Theys d4b09c1146 [IMP] web_editor, web_unsplash: remove options duplicate attributes
Since a reference to the options is already kept, there is no need to keep a
reference to each option individually.

PR: #33509
2019-05-27 16:32:52 +00:00
Sébastien Theys b0acd056e9 [IMP] web_editor: clean up media file widget selectors
Avoid selectors based on DOM structure, use classes whenever possible.
Register all the selectors in start to avoid searching the DOM multiple times.
No functional change.

PR: #33509
2019-05-27 16:32:52 +00:00
Sébastien Theys 277c30e7e6 [IMP] web_editor, website: clean up media dialog
Restructure the code in a more logical manner. No functional change.

PR: #33509
2019-05-27 16:32:52 +00:00
Sébastien Theys 8ab696dc82 [IMP] web_editor, web_unsplash: split media widget (image & document)
The common code is kept in a generic File widget, while the split allows for
easier customization.

PR: #33509
2019-05-27 16:32:52 +00:00
Sébastien Theys d25d3324e2 [IMP] web_editor: split search out of MediaWidget
The search is not used on VideoWidget for example, so it makes more sense to
split it out of the basic MediaWidget.

PR: #33509
2019-05-27 16:32:52 +00:00
Sébastien Theys e378aebc24 [IMP] web_editor, website_blog: clean up save/saved events
The web_editor had two different events `save` and `saved` doing more or less
the same thing but with a different signature.

In this commit we keep only the `save` event and adapt the code accordingly.

PR: #33509
2019-05-27 16:32:52 +00:00
Sébastien Theys 9dec7ba7e9 [IMP] web, *: add utils to get dataURL (base64) from file/blob
* = partner_autocomplete, point_of_sale, web_editor,
website_forum, website_slides

This can be used for example to preview an image from a file input field.

It can also be used to send the base64 content of the input by RPC instead of
having to rely on form submit as POST with multipart/form-data.

Technically wrap FileReader.readAsDataURL in a Promise.

This will also be used in task-1930726

PR: #33508

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-05-21 11:37:20 +00:00
Christophe Simonis 8dd5a85267 [MERGE] forward port branch saas-12.3 up to 60e71302a3 2019-05-13 15:26:12 +02:00
Christophe Simonis 60e71302a3 [MERGE] forward port branch saas-12.2 up to 243a4ae5cb 2019-05-13 11:02:27 +02:00
Christophe Simonis 243a4ae5cb [MERGE] forward port branch saas-12.1 up to 330b99f60c 2019-05-10 15:20:01 +02:00
Christophe Simonis cc3a2c1bf3 [MERGE] forward port branch 12.0 up to e11bacfe51 2019-05-09 21:07:44 +02:00
Gorash e244fa23ad [FIX] web_editor: drop an image in the 'mail.compose.message' modal
Issue: Can not drop an image into the modal's editor because the server
request a positional res_id arguments.

closes odoo/odoo#33232

Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-05-06 10:32:42 +00:00
Gorash eaeff40236 [FIX] web_editor: drop an image in the editable area
Issue: can't drop a image if the editor is not focused or if the editor is
empty
2019-05-06 10:29:23 +00:00
Christophe Simonis a97037c6d4 [MERGE] forward port branch saas-12.2 up to 78b3b650b0 2019-05-06 12:27:51 +02:00
Christophe Simonis 04acf0cc7c [MERGE] forward port branch saas-12.1 up to 2420492c26 2019-05-03 18:47:49 +02:00
Christophe Simonis 62017de41e [MERGE] forward port branch 12.0 up to d7c0c5c127 2019-05-03 09:16:50 +02:00
qsm-odoo eb5e8d660a [FIX] web_editor: allow d&d of blocks between flex elements
When dragging a snippet in the editor, drop zones are created at the
correct locations (e.g. between columns when dragging a column). Some
code is in charge of "cleaning" the created drop zones to, for example,
remove multiples ones which are at the same position. This code is also
currently removing the drop zones which are between two "non-block"
elements. This is preventing to swap form rows thanks to the form
builder as rows are "non-block" elements as they are flex elements.

This commit solves the problem by changing the "is non-block" condition
to "is inline" condition which is what was intended.

Note 1: rows became flex elements with BS4, that is why this is fixed
        in 12.0.

Note 2: this could be back-ported in previous stable versions as this
        actually preventing to drop snippets between tables, list
        items, etc (all non-block elements) but this can be considered
        as a limitation unless a real breaking case presents itself.

See task-1874350 which discovered the bug.

closes odoo/odoo#33054

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-04-30 13:07:16 +00:00
Christophe Simonis 15b8d353c7 [MERGE] forward port branch 12.0 up to 2830b93a3a 2019-04-17 19:47:37 +02:00
Antoine Guenet 706bf85512 [FIX] web_editor: disable tooltips in keyboard tests and on option off
The link and media tooltips were not taking Summernote's `tooltip`
option into account. That option ensures that tooltips are disabled if
the option is off (which is for instance the case on mobile).
This fix ensures that these tooltips are disabled when the option is
set to `false`.
It also disables tooltips in the keyboard tests. They are not relevant
to the keyboard tests and occasionally caused the DOM to not be properly
cleaned after the tests were run (most likely due to their 2000ms
`setTimeout`).
2019-04-19 10:23:21 +00:00
Lucas Perais (lpe) 2830b93a3a [FIX] web_editor: insert br within a p
Have a fieldHTML as:
```
<p>
Some text
<br>
<br>
More text
</p>
```

In the Html field widget, place your cursor before the "M"
press Enter to insert a newline

Before this commit "Some text" and the subsequent `<br>` were deleted
This was because the code:
- split the original `<p>` into two
( i.e. it became
```
<p>
Some text
<br>
<br>
</p>
<p>
More text
</p>
```
)
- took the last child of the first p, which is a text then fell back to the first p
- replaced the whole p with <br>

After this commit, the original p is still split, but we append the br to it instead of replacing it

closes odoo/odoo#32777

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-04-17 12:45:52 +00:00
Martin Trigaux 60d6c5402b [FIX] web: change bootstrap fonts only for reports
Commit 42530b02fe was fixing a bug in reports that were using the standard
bootstrap fonts instead of the changes we made in $font-family-sans-serif

To solve this, 42530b02fe replicated the change in the file
web_editor/static/src/scss/bootstrap_overridden.scss
which is imported in report_assets_common **before** web._assets_bootstrap

This was solving the issue for the report but had also the side-effect of
changing body font-family in enterprise as the bootstrap_overridden.scss file
is also used in web_editor._assets_backend_helpers and
web_editor._assets_frontend_helpers
42530b02fe had effect only on enterprise where the desired font is Roboto/Noto

Create a new bootstrap_overridden (6th of the name) file only for report

closes odoo/odoo#32902

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-04-30 08:19:38 +00:00
Christophe Simonis 6d4940675f [MERGE] forward port branch 12.0 up to ea1fc124ef 2019-04-09 11:11:48 +02:00
Christophe Simonis fef49061ea [MERGE] forward port branch saas-11.3 up to 4c61621efb 2019-04-08 19:52:29 +02:00
Christophe Simonis 4c61621efb [MERGE] forward port branch 11.0 up to 9a7e3c8b49 2019-04-08 17:45:00 +02:00
Martin Trigaux 42530b02fe [FIX] web_editor: override fonts in reports
Fixes odoo/odoo#27487
Noto Color Emoji produces an error on wkhtmltopdf, cf
wkhtmltopdf/wkhtmltopdf#4149

In the backend assets, the $font-family-sans-serif is changed in
web/static/src/scss/bootstrap_overridden.scss

In the reports assets, the $font-family-sans-serif was NOT changed in
web_editor/static/src/scss/bootstrap_overridden.scss

The default boostrap fonts were still used in reports, ignoring the changes made
for backend.

closes odoo/odoo#32312

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-04-15 12:14:40 +00:00
Christophe Simonis e145f2b0c8 [MERGE] forward port branch saas-12.2 up to 2694174b41 2019-04-10 15:10:24 +02:00
Christophe Simonis 6c8e30cae6 [MERGE] forward port branch saas-12.1 up to 6d4940675f 2019-04-09 12:16:06 +02:00
Christophe Simonis 3f95b074e9 [MERGE] forward port branch saas-12.2 up to f2be461f09 2019-04-05 18:46:10 +02:00
Martin Geubelle f391b8c5a5 [FIX] web_editor: restore ace style
The recent refactoring odoo/odoo@f296992 wrongly moved the ace editor
style from `web_editor` to `website`, even though ace is in `«eb_editor`.

The editor is also used in Studio (which does not depend on website) so
the style was missing in this case.

Task 1951290

closes odoo/odoo#32384

Signed-off-by: Christophe Matthieu <Gorash@users.noreply.github.com>
2019-04-03 12:46:57 +00:00
Antoine Guenet 028a03b8f1 [FIX] web_editor: do nothing on select all with empty editable
Ctrl-A on an empty editable threw an error. This fixes it.

closes odoo/odoo#32301

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-04-01 12:59:41 +00:00
Christophe Simonis 5dbf7bf357 [MERGE] forward port branch saas-12.1 up to f00c490be8 2019-03-26 10:33:26 +01:00
Christophe Simonis f00c490be8 [MERGE] forward port branch 12.0 up to 11b1e12cde 2019-03-25 19:45:26 +01:00
Christophe Simonis 11b1e12cde [MERGE] forward port branch saas-11.3 up to e9068c290b 2019-03-25 18:28:16 +01:00
Christophe Simonis e9068c290b [MERGE] forward port branch 11.0 up to 0196a6feb5 2019-03-25 16:47:05 +01:00
Nicolas Lempereur e1b1d3cd1b [FIX] web_editor: no lose tooltip on selection
The editor has a tooltip editor wizard "Change media description and
tooltip", but when selecting an image there is also a tooltip:

  "Double-click to edit"

added by the editor.

The combination of the two break the functionality, eg:

- if a tooltip is set with editor, then selecting the tooltip: we see
  the set tooltip and not "Double-click to edit"

- if a tooltip is set with editor, then selecting the image back, then
  opening the tooltip editor => the set tooltip is lost

With this changeset, we just do not show "Double-click to edit" tooltip
if there is a tooltip set on the element.

opw-1946801
closes #32482

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-04-08 08:17:57 +00:00
Christophe Simonis e3f5f17561 [MERGE] forward port branch saas-15 up to 214e819c1b 2019-04-04 20:07:27 +02:00
Christophe Simonis 214e819c1b [MERGE] forward port branch saas-14 up to 6e0c89867e 2019-04-04 19:34:35 +02:00
Christophe Simonis 6e0c89867e [MERGE] forward port branch 10.0 up to 60592561d7 2019-04-04 18:33:42 +02:00
qsm-odoo 60592561d7 [FIX] web_editor: support youtube-nocookie.com
closes odoo/odoo#32332

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-04-04 09:21:09 +00:00
Julien Castiaux e9026bd522 [FIX] web_editor: editor hang on an infinite loop
In the `getMatchedCSSRule`, the transcoder try to find the real value of
a `text-align: inherit` css rule by ascending the html tree until it
finds a `text-align` with a meaningful value. By default is exits if it
reachs the `<html>` top node but doesn't exit if a call to `.parent()`
exits the dom (the behavior of jquery is to return a dummy element when
calling `.parent()` on an element that has no parent). This lead to an
infinite loop for badly formatted html content.

opw-1951095

closes odoo/odoo#32014

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-03-21 13:45:12 +00:00
qsm-odoo c8339ce10e [FIX] web_editor: remove we validation icons
Since the bootstrap update to 4.2.1 (which was made with
https://github.com/odoo/odoo/commit/63e52e6acfabb927aad6eaf7b020520dc206e50f)
bootstrap includes automatic validation icons when a form is validated.

This allows to remove the Odoo custom ones in the editor (which appeared
on top of the bootstrap ones).

closes odoo/odoo#32051

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-03-22 13:40:12 +00:00
Christophe Simonis 4eff0af02e [MERGE] forward port branch saas-12.1 up to 6878c9f342 2019-03-21 13:58:37 +01:00
Pierre Paridans 45e3e432a3 [FIX] web_editor: html field with long links
Following the refactoring of the web_editor (JS & CSS) when adding a
long link in a task's description the line starts to overflow from the
field and create an horizontal scroll.

This commit restores the CSS word-wrap properties to the form field html
allowing to nicely break the line on a word basis, preventing a possible
overflow.

Also it doesn't make sense to apply it on an iframe.

Task ID: 1942179

closes odoo/odoo#31988

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-03-21 08:53:51 +00:00
qsm-odoo 36289e77ba [FIX] web_editor: restore theme responsive spacing
The factor parameter of the mixin in charge of generating the spacing
classes was not correctly used.

closes odoo/odoo#31996

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-03-20 15:48:34 +00:00
qsm-odoo 92f8a3c9ef [FIX] web_editor: review drag and drop in the editor
Forward-port of https://github.com/odoo/odoo/commit/be689c53c13330832510c8cef332ac862d4ed5e8
was missed from 11.0.

closes odoo/odoo#31971

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-03-20 10:15:49 +00:00
Christophe Simonis c50d7d6bc5 [MERGE] forward port branch 12.0 up to 82c4393fd0 2019-03-19 15:14:23 +01:00
qsm-odoo 2a39ab0579 [FIX] web_editor: handle snippet option submenus of submenus
Commit https://github.com/odoo/odoo/commit/8ca92330b367d54fddf1c02089ee9d0bc3edbfdc
did not think about submenus inside submenus, which is the case in the
website animate option. This made snippets potentially have multiple
animations on them, with undesired behaviors.

This commit also accordingly reviews the _setActive method for the
select-class option and also adapts following the recent forward-port of
https://github.com/odoo/odoo/pull/31440

Related to task-1929133

closes odoo/odoo#31477

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-03-15 13:58:50 +00:00
Christophe Simonis bd63913326 [MERGE] forward port branch saas-11.3 up to 4e39328a76 2019-03-18 20:03:24 +01:00