Commit Graph
2215 Commits
Author SHA1 Message Date
Nicolas Lempereur ec37d41703 [FIX] web_editor: ol in ol no number skip
In the case of an <ol> in an <ol> we would have something like:

```
1.
   1.
   2.
3.
```

because the sublist itself in version of summernote.org we are using
is a list item, so it takes one extraenous item.

With this changeset we have something that makes more sense:

```
1.
   1.
   2.
2.
```

Because there are tons of use case of different selection of list level
and indent or outdent, this commit also simplify outdenting (eg. now we
outdent all the element of the same level than the first indented).

opw-2185406
closes #48194

closes odoo/odoo#50352

X-original-commit: bbf4ad7d84d7fa4651744359658a8fa70cf94b17
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-04-28 18:46:14 +00:00
fja-odoo 11c60739e4 [IMP] website, *: warn user about outdated blocks
* = mass_mailing, web_editor, website_crm, website_event, website_form,
website_forum, website_hr_recruitment, website_mail_channel,
website_mass_mailing, website_sale, website_slides

When an outdated snippet's option are activated we display a warning
in the left panel that inform the user about the potential
malfunctions.

To do so the snippet's template key is added to the snippet as
data-snippet.
If a snippet is "t-call" inside another snippet, it will need to use
t-snippet-call instead of t-call to have the key on himself.

Those unique keys are used on snippet selection to retrieve the
snippet's version in the left panel and compare it with the currently
selected snippet's version. Versions are describe with data-vcss,
data-vjs and data-vxml. If a snippet's key is not in the left panel we
consider that snippet as outdated.

Added some tests to ensure that t-snippet and t-snippet-call really have
their template key as data-snippet

Adapted the views to the data-snippet changes adding
data-snippet="tmpl_key".

Part of: https://github.com/odoo/odoo/pull/44569
task-2189669

closes odoo/odoo#50254

X-original-commit: 28a6cd49b6e87b75c2e70771e241c41778bf9e87
Related: odoo/enterprise#10236
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-27 16:36:31 +00:00
Samuel Degueldre e2abbdcc59 [FIX] web_editor: fix original not being properly set when cropping
Previously, if you opened the cropper on an already cropped image, it
would load the crop data for that image. If you then changed the image
and cropped that new image, it would keep most of the metadata of the
previous image when saving, causing any subsequent crop to show the
previous original image instead of the current one.

This commit fixes that by removing all crop-related jQuery data from the
image, so it's considered a fresh crop and a new attachment is created.

closes odoo/odoo#50066

X-original-commit: 46c08050998d0c94d8955cd23ac783f38ecb5af1
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-23 11:49:49 +00:00
Benjamin Vray 22a1fa269b [FIX] web_editor: wrong position of top option icons
Restore the position of the icons in the top options so that they are
aligned horizontally and no longer vertically.

task-2162952

closes odoo/odoo#50021

X-original-commit: e4fcba353804d2be079b16aaad7dbe94b884e156
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-22 16:36:39 +00:00
Benjamin Vray 3920bb6fcf [FIX] web_editor: restore m2o widget in edit mode
Hide the button used to display the input and show the input
directly. Add a search icon into the input. Deactivate the browser
autocomplete. Improve and fix the layout. Keep the field selected
after choosing a result from the list.

This commit was only about making it work in the 13.0 left panel. It
will be improved further in master with our new left panel.

task-2187712

closes odoo/odoo#50024

X-original-commit: 6660ee960a3c643ae92448d7bdc37f6c780605b6
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-22 16:53:06 +00:00
Martin Trigaux 2d00263127 [I18N] *: export saas-13.3 translations
closes odoo/odoo#50031

X-original-commit: 15a7a9f9d71a0b9c46d7caf2f4fbf09a5a4c63fe
Related: odoo/enterprise#10140
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-04-23 07:13:48 +00:00
Samuel Degueldre 0b0690a393 [IMP] website, web: add fullscreen mode and frontend keyboard shortcuts
While the edit mode interface is full of useful things, it also adds a
lot of clutter, and alters the page's width and thus, its layout. This
commit adds keyboard shortcut for website editors to use, and allows
them to enter a "fullscreen" mode that hides the editor interface while
remaining in edit mode, allowing the user to have fewer distractions
while editing text content, and a closer rendition of the page's final
layout while editing.

For this, keyboard shortcuts were required, and a few other useful
shortcuts have been added, such as alt-1,2,3 for the navbar, just like
in the backed.

task-2126915

closes odoo/odoo#46953

Related: odoo/enterprise#9295
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-16 09:45:58 +00:00
jvm-odoo 65b798b461 [FIX] web_editor: fix video widget allow fullscreen
Issue

	- Install Website
	- Go on your website
	- Add Media & Text
	- Replace media by video
	- Add youtube URL
	- Save
	- Play the video

	The fullscreen button is disabled

Cause

	We do not allow fullscreen on the iframe

Solution

	Allow fullscreen, it is already done for the preview

OPW-2224696

closes odoo/odoo#49616

X-original-commit: e608a3feed35801c51c8ce7e251ccffa2ca9dc46
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-04-15 17:18:18 +00:00
qsm-odoo e4a7103517 [FIX] web, web_editor: allow editor instantiation from public user
If for some reason someone wanted to develop a textarea using the
editor which is supposed to work as a public user (like we are trying
to do on Odoo.com), it was not possible. The code was "designed" to
allow it but there was one problem: the lazy loading of the editor
assets required a `render_template` call to the server... which cannot
be done from a public user.

This commit solves the issues by allowing the lazy loading of assets
to use a custom route if required. That route is then used by the editor
"root". That route performs the render_template as a superuser provided
that the view's xmlid is whitelisted.

Note: there was another unauthorized call for public user: the
colorpicker. This was solved by disabling the colorpicker template rpc
for public user, they will still get the default summernote one.

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

closes odoo/odoo#48981

closes odoo/odoo#49398

X-original-commit: e84a0bfdc99c21406861b88c02b11c925d92f927
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-10 11:54:03 +00:00
Julien Mougenot 48ee7272b6 [IMP] *: adapt qunit suite bundle inheritance
Since the test assets bundle name has been changed and its structure is different,
the inheriting assets need to be updated.

Task 2002399
2020-04-07 14:40:53 +00:00
Julien Castiaux ab4000fb3c [REF] base: Remove deprecated exceptions and osv
TL;DR: remember `osv` and `except_orm` ? You can forget about them.

* Deprecated `except_orm` dropped.
* `UserError` elevated as super type of all user-related
  errors.
* Unused `DeferredException` dropped.
* Unused `QWebException` dropped (real one is in `qweb.py`).
* `MailDeliveryException` made a python exception.
* `name` legacy exception attribute made an alias of the python standard
  `args[0]` attribute and deprecated.
* `value` legacy exception attribute dropped.
* `exception_type` RPC error response key dropped.
* Deprecated `osv` module dropped.
* `--osv-memory-age-limit` cli option made an alias of
  `--transient-age-limit` and deprecated.

The `odoo.exceptions.Warning` have long been a deprecated alias to
`UserError`. It is going to be removed in a future version but first we
explicitly deprecate it with a warning.

The `odoo.exceptions.DeferredException` was a very old internal
exception, it has been removed without deprecation notice as it is never
raised.

The `odoo.exceptions.except_orm` has been a deprecated exception type
with deprecation warning for 5 years, it has been removed in favor of
UserError which becomes the super class of all user-related errors.

The `odoo.base.models.ir_mail_server.MailDeliveryException` was
inheriting `except_orm`. As it is not related to a user error but is
more of a problem an admin much take care of, the exception has been
made a Python error.

The `exception_type` JSON key in RPC error responses was holding an
hardcoded value derived from the exception type. Its usage has been
dropped in favor of the `name` JSON key that holds the precise exception
name. Again as it was hardly used in the source code (beside the crash
manager) it has been dropped without deprecation warning.

Since we are here trying to clean odoo custom exceptions, we are also
deprecating the `name` exception attribute in favor of the more standard
`args[0]` attribute.

The `name` (along with `value`) were two attributes used to raise
`except_orm` exceptions before the introduction of `UserError`,
`AccessError` and related exceptions. The `name` attribute, at the time,
was holding the exception type/title. Nowadays it contains the error
message. The `value` attribute, at the time, was holding the error
message. Nowadays it is no more used.

The `osv` module contains very old deprecated aliases. There is no
simple way to log a deprecation warning for osv, osv_memory and
osv_abstract but as they have not been in use for ages, they have been
removed too. To be consistent, the `--osv-memory-age-limit` cli option
has been made a deprecated alias to the `--transient-age-limit`.

closes odoo/odoo#45723

Task: 2187728
Related: odoo/enterprise#9162
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-04-08 08:41:17 +00:00
Samuel Degueldre 0c9eb9e5c7 [FIX] web_editor: fix dialogs (link, media, alt, crop) not opening
In 3f4092d837d50d25d6c9630d84f67545cf586c7a, the SummernoteManager that
was previously owned by RTE was removed, this was because the wysiwyg
already has one. One problem with this however is that when an editor is
created in an iframe, the wysiwyg is instanciated outside, while the
editor is instanciated inside. This means that they don't have the same
core.bus to listen for and trigger events, such as those used to open
the various editor dialogs. This commit fixes that by always using the
top-level core.bus when opening dialogs. This also has the advantage
that the dialogs are no longer confined to the iframe and can take up
the whole screen, making them more comfortable to use.

closes odoo/odoo#48932

X-original-commit: 68ac735aa7e17e66910f51706829035697dfcc1e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-03 07:21:20 +00:00
Benjamin Vray 98161fc61a [FIX] web_editor: fix updateui method
replace the "return" with "continue". What should have been done when
the loop that was originally a "foreach" became a "for" loop.

closes odoo/odoo#48919

X-original-commit: 8af8e6ddb2be9a0c57356d075e092b8da42662f0
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-02 23:54:12 +00:00
Samuel Degueldre bf9d864fb0 [FIX] website: fix logo not supporting new image url format
In a recent commit, we decided to change the image url format generated
by the media-dialog to leverage browser caching using unique.
Unfortunately, when saving an img tag to a binary field, the url parsing
did not support this new url format, causing a traceback when changing
the website logo and attempting to save.

closes odoo/odoo#48914

X-original-commit: 9c618c7f903f1a0b32e067cfd713cd39762250f9
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-02 18:49:03 +00:00
jvm-odoo 7e2504ec0c [FIX] web_editor: fix makeLayoutInfo
Issue

        - Install Website
        - Edit your website

        Do this 8 times:
        - Add the block "Image - Text" under each product
        - Make image on left smaller and text longer
        - Edit the size/color of the title and the description

        There is some case where it will crash

Cause

        We override the method who gets the editor:
        `x = $('[data-note-id="' + list.last($target.attr('id')) + '"]');`
        When there is more than 9 editors in the page
        (because we edited 10 different HTML fields), we reach the
        editor with ID 10 but the code erroneously will not find the
        editor with ID 0

Solution

        Use this instead:
        ```
        x = $('[data-note-id="' + list.last($target.attr('id').split('-')) + '"]');
        ```

OPW-2218467

closes odoo/odoo#48810

X-original-commit: c95fad77ea5b4663130e256f76031560171f09e6
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-04-02 06:12:04 +00:00
Benjamin Vray e912823cb1 [IMP] website, *: split the customize method into 3 different methods
* theme_bootswatch, web_editor

Split the customizeWebsite method into 3 different methods so we can
use customizeWebsite for variable, views or color on the same widget.

Part of https://github.com/odoo/odoo/pull/38950
task-2087641
2020-03-31 18:16:07 +00:00
Tiffany Chang (tic) 1ac243c21c [IMP] various: Replace incorrect use of "edition"
"Edition" is a French-English false friend word. "Edition" in English
means "version" whereas "edition" in French means "editing". This commit
updates user facing strings/documents that incorrectly use "edition" instead
of "edit" or "editing". Attempts were made to clean up English around
"edition" usage so please excuse any errors from lack of context
knowledge. Code comments and names incorrectly using "edition" were NOT
updated.
2020-03-31 10:31:35 +00:00
Samuel Degueldre 30ab8ac022 [FIX] web_editor: use media-container width to determine optimized width
In 644572819ab9a1525af6077dd20c63957eb9271c the mediaWidth which was
previously useless has been changed to default to the media's own width.
This causes problems when there is a small image in a large container,
because when replacing it, it would still suggest a very small size.
This commit makes the mediaWidth default to the container's width
instead to fix those issues.

closes odoo/odoo#48631

X-original-commit: 3d8b56b2c9c7486430f2e947fecfe07d7163a732
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-31 05:57:43 +00:00
Samuel Degueldre 807ac81144 [IMP] web_editor, *: set image alt automatically, remove useless alts
*: website, web_unplash

The html alt attribute is supposed to contain a description of an
image's content (an alternative to the visual representation), a lot of
snippets contained alt attributes that were not descriptive of their
content, and would as such be counter-productive in terms of
accessibility. This commit removes those.

Previously, the alt attribute on img tags had to be set manually by the
user through the editor. This commit makes use of the description field
on ir.attachment to store image description, and sets the alt attribute
on images to that description when choosing an image from the media
dialog.

task-2091417
closes odoo/odoo#45174

Related: odoo/enterprise#9520
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-30 11:07:10 +00:00
Samuel Degueldre 02e71a1a3c [IMP] web_editor: add unique to image URLs to leverage browser caching
Previously, image urls did not contain the unique parameter, this
resulted in all browser caching for images being dependent on etag
headers. This commit changes the url format used by images in the
web_editor to use the /id-checksum/ format instead of only the id, this
in turn makes it so that the 'Max-age' header is set to 1 year. This
also solves some browser caching issues when changing the optimization
level of an image in place in the media-dialog.

For binary attachments with an url (eg, unsplash images) the unique is
added as a search parameter (?unique=checksum) as a cachebuster
mechanism, but currently doesn't set the max-age header, which may or
may not be done at a later date.

task-2091417
2020-03-30 11:06:48 +00:00
Samuel Degueldre 49ea7b2b41 [IMP] web_editor: improve image optimization workflow in media dialog
Previously, when selecting an image, the user could optimize their
images by clicking a little cog icon in the media dialog. They would
also be prompted to optimize their images when uploading them. In most
cases, it makes a lot more sense to always save the original in the
database, and optimize the original whenever it's dropped in the page
automatically.

A second problem is that when using the optimization feature, optimized
images would be displayed along the originals by default, resulting in a
lot of duplicates while browsing the media dialog.

This commit changes both of these things:

- By default, when uploading an image, the original uploaded image is
  used. The user can still optimize their image manually through the
  media-dialog by using the cog icon. When choosing an image in the
  media-dialog, if it's not already an optimized image, an optimized copy
  is automatically created and used instead.

- Optimized images are now hidden by default, in the media dialog, and
  can be shown by clicking a checkbox at the top of the modal when in
  debug mode

task-2091417
closes odoo/odoo#45174
2020-03-30 11:06:48 +00:00
Samuel Degueldre 25630e4421 [IMP] web_editor: remove summernoteManager from rte
The wysiwyg which is the parent of the EditorMenuBar already has an
instance that can be used instead.
2020-03-30 11:06:48 +00:00
Samuel Degueldre 5576a5f84d [IMP] web_editor, web_unsplash: improve media-dialog UX
Previously, searching for images in the database and on unsplash was
mutually exclusive, and controlled by a dropdown menu next to the search
bar. Additionally, the display of db images and unsplash images was very
different, making using the search function inconsistent and awkward.

This commit merges the unsplash search into the db search. When
searching, the first few matches from the database are displayed, then
results from unsplash.

Additionally, the layout of images has been greatly improved,
eliminating almost all padding, using some flex-box magic to allow the
images to take up all the available space without being cropped or
deformed.

The input to add an attachment by URL is now collapsed by
default, and clicking on it will expand it to reduce visual clutter.

Finally, when not in multi-images mode, the clicked image is immediately
used, rather than the user having to click it and then click the add
button, or having to double click, which was not obvious.

task-2091417
closes odoo/odoo#45174
2020-03-30 11:06:45 +00:00
jvm-odoo f9bf408a82 [FIX] web_editor: fix snippets shown in codeview
Issue

	- Install Mass Mailing
	- Activate debug mode
	- Create a mass mailing
	- Select any template
	- Go in codeview

	The snippets hide a part of the code

Cause

	When toggling the codeview, we apply
	a position absolute (all to 0) which
	shift the #wrapwrap

Solution

	Add an intermediary parent and apply
	position relative to #wrapwrap like
	in 12.0

OPW-2220639

closes odoo/odoo#48496

X-original-commit: e415cffa2ffb3fe4b5f0e32bd96b3433387a95e3
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-03-27 11:52:00 +00:00
qsm-odoo 4e9179dcfe [FIX] web_editor: fix bg position opt status for parallax snippets
This happened:
- The user clicks on a parallax snippet
- For each option, call onFocus then updateUI:
    - The BG position is first, so update its UI
    - The parallax option is last, onFocus changes the BG position target
... this is broken since the BG position option was updated before the
parallax one was able to change its target. So the BG position was
updated by checking the background type of the snippet instead of its
internal parallax <span/> element.

This was working in 13.0 as changing the target automatically re-updated
the related option UI, now this is left to the dev to update the UI
afterwards or not.

In this case the fix is simple: the onFocus of all options should be
called, before calling the updateUI of all options. This actually
allows to make the code cleaner.

closes odoo/odoo#48428

X-original-commit: 912e849207709b31aa11b7a2bec9ed8dd8b43203
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-26 11:50:09 +00:00
Benjamin Vray b42abefd1e [FIX] web_editor: fix buttons position for bg-position when parallax
Correction of the position of the buttons when editing bg-image
position with a parallax effect other than "fixed".

task-46147

closes odoo/odoo#48419

X-original-commit: 0919b11c9a78a97345b42bf0fe0f1f9939c2b214
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-26 10:49:55 +00:00
Benjamin Vray c87f61d26b [IMP] web_editor, website: copy absolute path for anchor links
Copy the absolute path in the clipboard instead of the relative for
anchor links. So the link still works if it is pasted on another page.

Part of https://github.com/odoo/odoo/pull/46503
task-2194309
2020-03-24 16:07:10 +00:00
Benjamin Vray 2e846f1e0a [REF] web_editor: add a wrap div around overlay options
Add a wrap div around overlay options so we are able too add more
specific options that are separate from the move options.

Part of https://github.com/odoo/odoo/pull/46503
task-2194309
2020-03-24 16:07:03 +00:00
Benjamin Vray 85a604635c [IMP] web_editor, website: preview container width on hover
Preview the boundaries of container elements when hovering over the 3
width options.

Part of https://github.com/odoo/odoo/pull/46503
task-2194309
2020-03-24 16:06:59 +00:00
Thanh Dodeur 900dad016d [IMP] website, web_editor: add options to fully control shadows
task-2182909

closes odoo/odoo#46816

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-24 10:47:05 +00:00
Benjamin Vray 1e35fffc89 [FIX] web_editor: get size of resizable elements on mouse down
Get the elements size also on mousedown. Because before that, the
size was only obtained on the start method when some elements did not
yet have its actual size. Example: elements in inactive slides in the
carousel snippet.

task-2162952

closes odoo/odoo#48193

X-original-commit: 2a36c684bb33704e46a6f30b5c501043683da67d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-23 12:42:02 +00:00
fja-odoo 36269c5660 [FIX] web_editor: revert datepicker font awesome 5
datetimepicker today button used a font awesome 5 icon.
Font Awesome 5 was reverted to 4.7 but not this line.

introduced by: 699890d3f0

task-2211899

closes odoo/odoo#48135

X-original-commit: 083f7bb3e1b8aef9e2ebd86bc8c059d39473fe6b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-20 16:55:30 +00:00
Jeremy Kersten 4c40393490 [FIX] website: perf - translation - avoid query to find what we know
Before this commit, each module override _get_translation_frontend_modules_domain
from ir.http to add its own translation in website if needed and that module
is not starting by website_. Updating the domain from the super() call.
Since we know in most of the case the name, it is useless to do a:
   select name from module where name = 'name1' or name = 'name2'...

Now we support a new override of _get_translation_frontend_modules_name that will
allow to add the known module name directly in the list instead to make a search.

In case nobody override _get_translation_frontend_modules_domain, we don't need to
make an extra rpc to find the module.

Related to #47257
task-2211013

X-original-commit: 0dc54814161ab55c34dd2242f65dea23d19fdfca
2020-03-19 15:37:47 +00:00
Ravi Singh 4511098d19 [FIX] web_editor: properly hide custom opt from colorpalette if required
Part of https://github.com/odoo/odoo/pull/45093
task-2151408

closes odoo/odoo#45093

closes odoo/odoo#47961

X-original-commit: b5ee7905cd08c9a4d18dbe55f52b9f8ea84d23d3
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-18 19:52:33 +00:00
Nicolas Lempereur 375179ed54 [FIX] web_editor: relative URL in background snippet
When the backround is set with the media modal, directly get the URL of
the IMG element (equivalent to `.getAttribute('src')`) instead of doing
`.src` which returns absolute URI.

This fix uses jQuery wrapper so it still works if called with object:

  $({src: 'test.jpg'}).attr('src') === 'test.jpg'

note: before 17237ff31 we already used `.attr('src')`.

opw-2215103
closes #47797

closes odoo/odoo#47872

X-original-commit: f04133d24b2271c0bc465f1628281b19d3656271
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-18 08:55:07 +00:00
Samuel Degueldre 7ae7f47cd7 [FIX] web_editor: stop base 64 being saved in the DOM when recropping
When saving after cropping an attachment, a new cropped attachment is
created, and the temporary base64 URL is replaced by the url of the new
attachment. However, when cropping an image for a second time, the
original image is recropped, and the cropped image attachment that was
created previously is overriden with the new data.

Previously, the step that overrides the temporary base64 url with the
url of the croppped attachment was not present when overriding a
previously cropped attachment, meaning it would be saved as is in the
DOM, and the overriden attachment would no longer have any links
pointing to it. This commit fixes that by overriding the temporary
base64 url both when cropping for the first time, but also for
subsequent re-crops of the same image.

closes odoo/odoo#47836

X-original-commit: 3b23f137a2b519b88087452fa4c33a9f97ccdf61
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-17 15:17:30 +00:00
Samuel Degueldre d4a83593c6 [FIX] web_editor: use media client width as default mediaWidth
Previously, when trying to compute the optimized width for an image,
if the mediaWidth option was unspecified, _computeOptimizedWidth would
return NaN, and in all the places where it was specified, it was
specified as 1920 meaning it was essentially useless.

This commit makes the media's clientWidth the default value for
mediaWidth, meaning that if options.mediaWidth is unspecified, the size
of the element in the page (if one exists) is used. This allows the
suggested width to be actually useful, instead of always suggesting
1920. Specifying a mediaWidth in the options overrides this value.

task-2215913

closes odoo/odoo#47767

X-original-commit: 644572819ab9a1525af6077dd20c63957eb9271c
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-17 09:22:05 +00:00
Julien Mougenot 384e516218 [REF] web: Update generic files
General cleaning of some helpers and generic files. The idea is that they are
less likely to be entirely re-written in the near future so this is a way to
keep the code clean, readable and compliant to the current standards. Changes include:
- Use of async/await when possible
- Use of const/let instead of var
- Removal of underscore.js
- Use of native JS instead of jQuery when possible

The logic of the affected code remains the same.
2020-03-13 09:37:29 +00:00
Thanh Dodeur 14c0550b29 [FIX] web_editor: fixes the rgb/rgba color selection
Before this commit, `selectStyle` could incorrectly split the
widgetValue (as described below) which resulted in invalid CSS.

widgetValue: `"rgba(55, 12, 99, 0.7) 55px"`
result: `["rgba(55,", "12,", "99,", "0.7)", "55px"]`
expected: `["rgba(55, 12, 99, 0.7)", "55px"]`
fixed: `["rgba(55,12,99,0.7)", "55px"]`

This commit fixes the issue.

closes odoo/odoo#47515

X-original-commit: 37e6b87341e58769ec2c1d080986e84286d84978
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-12 14:24:38 +00:00
Krupa Patel 703a9c48e9 [FIX] web_editor: close widgets by clicking outside of them
task-2196789

closes odoo/odoo#46298

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-11 10:18:30 +00:00
fja-odoo 5d8367747c [REF] web_editor: remove useless code in palette
Previously the widget was not refreshed everytime it was opened.
Now that it is the case and since the color picker rerenders every time
we select a color:
It is no longer required to select/unselect the colors.
It is no longer required to add custom colors to existing colors.

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

task-2212288

closes odoo/odoo#47355

X-original-commit: 481fe703e9400fb64e96291914f76d4dca883e29
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-11 09:57:53 +00:00
fja-odoo 2c1ebbf89e [FIX] web_editor: fix select theme color if match
When a default color matches a theme color it will now select the theme
color class instead of a css attribute when clicked.

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

task-2212288

X-original-commit: d7b3538a814f0e53cd3c5816f8296ad5e4c5f41a
2020-03-11 09:57:52 +00:00
Benjamin Vray ed1a39c618 [FIX] website: avoid error if click on edit when nothing is editable
Avoid traceback when click on edit and nothing is editable on the
page.

task-2199214

closes odoo/odoo#47328

X-original-commit: fd92a78bd18a0fd765d9c3a857adc10e29c025dd
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-10 18:08:20 +00:00
Benjamin Vray 4e48c3ce0f [FIX] web_editor: allow non-alphabetic unit in data-unit
Allow non-alphabetic unit (like percentage) as data-unit value.

task-2194309

closes odoo/odoo#47325

X-original-commit: 1f3dd221134b7b5e5b0eac0ab2ffe447771998b9
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-10 17:33:21 +00:00
fja-odoo 38781f1649 [FIX] web_editor: fix laggy option sections
Some option sections are feeling really laggy (especialy the theme ones
we now have in master/13.2). This was due to the "preview" activation of
the snippet being triggered on mouseover and not on mouseenter.

Introduced by: https://github.com/odoo/odoo/pull/36068

task-2198177

closes odoo/odoo#47303

X-original-commit: d85d912de513de5c81c85a8ff814e0af1e13cefd
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-10 16:02:07 +00:00
David Monjoie 24d69567e5 [FIX] web_editor: fix pictograms in rte
The content of the "wysiwyg.fonts" module is duplicated in
"web_editor.base". This is a mistake that was introduced with the
revert of the saas-12.2 editor.

This duplication is the cause of github issue https://github.com/odoo/odoo/issues/44689.

This commit fixes the issue by requiring the correct module in rte.

closes odoo/odoo#46865

X-original-commit: 8bc3fd2c41c1d0fc1fa22e0849a7204b6712d7b2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-04 11:57:25 +00:00
qsm-odoo 05d17089c4 [FIX] web_editor, website: review default palette system
Before this commit, this was done:

1) Primary variables (app order):

(a) web_editor: define palettes (color + theme + gray), only 1 empty
                one. Mark the first ones as the selected ones.

(b) website: fill all defined palettes with the website-related
             color key and values (body, menu, logo-height, etc).
             + define "website values" palette.

2) Secondary variables (reverse app order):

(c) website: merge the user palettes on top of the selected palettes
             (so user values overriding values added in (a) and (b)),
             the resulting palettes are added in palettes lists and the
             selected palette numbers are set to select those ones.
             + final selection of "website values" palette.

(d) web_editor: final selection of the selected color palette amongst
                the color palettes.

--

The problem with all of this is that the definition of palettes
in themes (occuring between step (b) and (c)) never received the
website-related color key and values of step (b) and were thus forced
to redefine all of those by themself even if they wanted to use the
default website one.

This commit changes the system so that step (a) and (b) now define
"base" palettes (color, theme, gray, website values) and step (c) and
(d) now merge the final selected palettes with those "base" palettes.
This is in fact theoratically more efficient and allows to not force
themes to define every possible palette value we might introduce.

closes odoo/odoo#47097

Related: odoo/design-themes#216
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-07 11:09:36 +00:00
fja-odoo b943dd83f6 [IMP] web_editor: add default opt selectAttribute
Add default option selectAttribute
Most of the logic is shared with selectDataAttribute

part of: https://github.com/odoo/odoo/pull/45397

task-2197008
2020-03-06 16:25:34 +00:00
jpr-odoo 223038682f [FIX] web_editor: correct parsing of dailymotion URL
The parsing of dailymotion URL was not done correctly. This made the
media dialog duplicate the URL params if such an URL was re-edited.

task-2159152

closes odoo/odoo#47102

X-original-commit: 8d8f442f62919b1cee595ed1fae2c6e4f05eb8fa
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-06 14:55:03 +00:00
Krupa Patel 5f85a7605a [FIX] web_editor: add focus in url input of link dialog
Before this commit, when clicking on the link button after focusing a
link, the first input of the link dialog was hidden (label), and the
second input (URL) was not focused.

In this commit, we focus the first *visible* input so users are able to
directly copy-paste URL.

task-2083209

closes odoo/odoo#44931

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-06 13:47:16 +00:00