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#48194closesodoo/odoo#50352
X-original-commit: bbf4ad7d84d7fa4651744359658a8fa70cf94b17
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
* = 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
closesodoo/odoo#50254
X-original-commit: 28a6cd49b6e87b75c2e70771e241c41778bf9e87
Related: odoo/enterprise#10236
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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.
closesodoo/odoo#50066
X-original-commit: 46c08050998d0c94d8955cd23ac783f38ecb5af1
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Restore the position of the icons in the top options so that they are
aligned horizontally and no longer vertically.
task-2162952
closesodoo/odoo#50021
X-original-commit: e4fcba353804d2be079b16aaad7dbe94b884e156
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#50024
X-original-commit: 6660ee960a3c643ae92448d7bdc37f6c780605b6
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#46953
Related: odoo/enterprise#9295
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/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>
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/48981closesodoo/odoo#48981closesodoo/odoo#49398
X-original-commit: e84a0bfdc99c21406861b88c02b11c925d92f927
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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`.
closesodoo/odoo#45723
Task: 2187728
Related: odoo/enterprise#9162
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
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.
closesodoo/odoo#48932
X-original-commit: 68ac735aa7e17e66910f51706829035697dfcc1e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
replace the "return" with "continue". What should have been done when
the loop that was originally a "foreach" became a "for" loop.
closesodoo/odoo#48919
X-original-commit: 8af8e6ddb2be9a0c57356d075e092b8da42662f0
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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.
closesodoo/odoo#48914
X-original-commit: 9c618c7f903f1a0b32e067cfd713cd39762250f9
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/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>
* 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
"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.
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.
closesodoo/odoo#48631
X-original-commit: 3d8b56b2c9c7486430f2e947fecfe07d7163a732
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
*: 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
closesodoo/odoo#45174
Related: odoo/enterprise#9520
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
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
closesodoo/odoo#45174
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
closesodoo/odoo#45174
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
closesodoo/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>
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.
closesodoo/odoo#48428
X-original-commit: 912e849207709b31aa11b7a2bec9ed8dd8b43203
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Correction of the position of the buttons when editing bg-image
position with a parallax effect other than "fixed".
task-46147
closesodoo/odoo#48419
X-original-commit: 0919b11c9a78a97345b42bf0fe0f1f9939c2b214
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
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
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
closesodoo/odoo#48193
X-original-commit: 2a36c684bb33704e46a6f30b5c501043683da67d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#48135
X-original-commit: 083f7bb3e1b8aef9e2ebd86bc8c059d39473fe6b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
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#47797closesodoo/odoo#47872
X-original-commit: f04133d24b2271c0bc465f1628281b19d3656271
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
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.
closesodoo/odoo#47836
X-original-commit: 3b23f137a2b519b88087452fa4c33a9f97ccdf61
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#47767
X-original-commit: 644572819ab9a1525af6077dd20c63957eb9271c
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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.
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
closesodoo/odoo#47355
X-original-commit: 481fe703e9400fb64e96291914f76d4dca883e29
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
Avoid traceback when click on edit and nothing is editable on the
page.
task-2199214
closesodoo/odoo#47328
X-original-commit: fd92a78bd18a0fd765d9c3a857adc10e29c025dd
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#47303
X-original-commit: d85d912de513de5c81c85a8ff814e0af1e13cefd
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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.
closesodoo/odoo#46865
X-original-commit: 8bc3fd2c41c1d0fc1fa22e0849a7204b6712d7b2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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.
closesodoo/odoo#47097
Related: odoo/design-themes#216
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#47102
X-original-commit: 8d8f442f62919b1cee595ed1fae2c6e4f05eb8fa
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#44931
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>