Commit Graph
4278 Commits
Author SHA1 Message Date
Rodolpho Lima 954b2d1673 [FIX] web_editor: notification when image can't be cropped
After convertion of the ImageCrop widget to an Owl component [1], the call
to `this.displayNotification` no longer applies. In fact, it produces a
traceback when trying to crop an image that cannot be cropped
(base64-encoded image not yet converted to an attachment, for example).

This commit replaces such call for the more suitable notification
service's `add` method.

task-3471481

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

closes odoo/odoo#132726

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-23 14:43:21 +02:00
Sébastien Geelen (sge) 4a7de52b0f [FIX] web_editor: ensure link insertion
When inserting a link into mass_mailing document
we need to delay the blur event to prevent the to_inline.

If the to_inline is called when the link dialog is open
the context is lost in the document and the link failed
to be inserted.

task-3234749

closes odoo/odoo#132667

X-original-commit: db38abf259c1a6fed51e8e99785ffea770e9e909
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
2023-08-22 20:00:44 +02:00
Benjamin Vray 568198374b [FIX] web_editor: fix image shape selector
Steps to reproduce the bug:

- On Chrome, go to the Email Marketing application.
- Enter edit mode to modify a mail template.
- Add a text-image snippet to the template.
- Click on the image.
- Open the shape image selector in the options of the image.
- Scroll through the list of available shapes.
- Bug: A traceback error occurs.

The bug occurs because sometimes, in the 'scroll' function of the
selector, the 'ev.currentTarget' becomes 'Null'. This issue is specific
to Chrome and only happens in the email template editor (not in the web
page editor). It appears that this issue is related to using the
'throttleForAnimation' function for the event, where the value of
'currentTarget' gets lost during various calls.

We fix this bug by avoiding the use of 'currentTarget' in this specific
case. However, further investigation would be required to fully
understand the problem.

task-3431820

closes odoo/odoo#132574

X-original-commit: c799345f6ae81f10a8133688431fe63ed23617ad
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
2023-08-22 09:49:54 +02:00
Antoine GuenetandPedro Manuel Calheiros Lima de Sousa 2ab529ed29 [FIX] web_editor: prevent error on undefined closest Node
Summary:
	page with 2 popups (newsletter popup and regular popup), cookie
	bar all justaposed. Chatbot window also open. For some reason
	closestBlock(testedNode) is undefined (testedNode) is a #text
	Node. Change already in place for 16.3

Cause:
	no preventive measure for null value before creating
	a node iterator on the value.Node in dom does not have
	an ancestor of type block.

Solution:
	backport solution from 16.3, return false when currentNodeParentBlock
	is null, since preceding and following would also be undefined,
	return false.

opw-3395673

closes odoo/odoo#132590

X-original-commit: 8a72f669813bc7d8aa9038d75e08ecef00b70e01
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: Pedro Manuel Calheiros Lima de Sousa <peso@odoo.com>
2023-08-22 07:36:05 +02:00
dhba-odoo 6a35f242a7 [FIX] web_editor: color pallete flicker
Before this commit:

After applying formatting styles to text that already has some color applied to
it, we encountered an issue where the color pallete would flicker when
attempting to change the color.

After this commit:

Now, the color palette will no longer flicker when trying to change the color of
text that has formatting styles applied to it.

task-3417998

closes odoo/odoo#132561

X-original-commit: 7a9977882b0e9222beba7de23f026de937a60a4d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-21 19:57:50 +02:00
Soukéina Bojabza eded9a301c [FIX] web_editor, *: correctly set the ProgressBar component props
*: web_unsplash

Before this commit, if we were in debug mode, when we tried to replace
or add an image, a traceback appeared when selecting an Unsplash image
for the first time or when uploading an image of size 0 (also for the
first time). Note that once the traceback was closed, it did not
reappear until the page was refreshed, but the progress bar was not
displayed anymore.

It happened because in debug mode, there is a validation of the
different owl components props and some props of the `ProgressBar`
component were not correctly set when adding Unsplash images or empty
image files, causing the props validation to fail. Those props
definition were incorrectly added with [1].
The traceback was not reappearing because the `UploadProgressToast`
component (= the parent of `ProgressBar`) has been destroyed and so the
props validation was not done anymore since the components were not
there.

This commit fixes these issues by correctly setting the `ProgressBar`
props and by adding default props, in order for them to always have a
value when omitted.

Steps to reproduce:
- Activate the debug mode.
- In edit mode, drop the Text-Image snippet.
- Double-click on the image to replace it.
- Type something in the search bar and select an Unsplash image or
upload an empty image file.
=> A traceback appears.

[1]: https://github.com/odoo/odoo/commit/886f3de768b647f4b402c97098abf274d6258f75

opw-3413299

closes odoo/odoo#132377

X-original-commit: 425dfb07f21288caf56bceea3a86e0b7ecac4a91
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-08-21 19:57:16 +02:00
divy-odoo ce49ff9742 [FIX] web_editor: preserve content around on unlink images
Before this, we were considering only the case where only a single
element is wrapped by the anchor tag, like `<a><img></a>`. So it simply
replaces parent node `<a>` with childNode `<img>`. However, cases like
`<a>text<img><a>` (where there are multiple element within the <a> tag)
were failing.

To handle such cases, this commit replaced the code that considering
multiple childNodes and replacing parentNode with all the childNode.

task-3231606

closes odoo/odoo#132531

X-original-commit: 08432308819e83fd0122a8e87170ec8ff27ca2a1
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Divyesh Vyas (divy) <divy@odoo.com>
2023-08-21 17:01:07 +02:00
Jorge Pinna Puissant a4b9050ec5 [REF] web, website_sale: remove legacy mutex
In our continued effort to remove legacy code, this commit replaces
usage of the legacy mutex util with the new one, which is fully
compatible as a drop-in replacement. The legacy mutex has been removed.

Part of task-3439226

closes odoo/odoo#131748

Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-21 14:15:09 +02:00
Pierre Paridans 8164f107be [IMP] web,web_editor,point_of_sale: remove jquery.nearest library
This library provided the `nearest()` and `touching()` methods.

This commit replaces them by our own utility methods from
`@web/core/utils/ui`: `closest()` and `touching()`.

closes odoo/odoo#130818

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-08-21 12:38:57 +02:00
Pierre Pulinckx (pipu) c07181b20b [REF] *: Replace env._t() by _t()
In this commit, all usages of env._t() are replaced by _t().
In templates files, env._t() didn't work because terms used
in attributes where not extracted into the translation files.
Only string are exported from .xml files to translation files.
So, to make it works, we set a variable that is then used
in attributes.
For example :

<t t-set="string_to_translate">String to translate</t>
<Dialog title="string_to_translate>...</Dialog>

task-3292454

closes odoo/odoo#131390

Related: odoo/enterprise#45631
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-18 19:17:16 +02:00
Louis Wicket (wil) 75c69aeb38 [IMP] account, web_editor, base: remove useless use strict
According to the ECMAScript 2023 Language Specification:
> Module code is always strict mode code.

Odoo Modules mimic this behavior and automatically add “use strict“ at
the top of the file, so there's no need to do it yourself.

This commit removes all the useless occurrences of use strict.

closes odoo/odoo#132235

Related: odoo/enterprise#45908
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-08-17 19:51:17 +02:00
Rodolpho Lima ab10ed0c62 [FIX] web_editor: images converted to public attachments
Before this commit, since [1], when an image was pasted or dropped, it
was converted to a public attachment on save.

This was an oversight, and this commit fixes it by creating such
attachment as a private one instead, much like when uploading an image
via  the "/image" command.

Attachments created via the website remain public.

[1]: https://github.com/odoo/odoo/pull/128452/commits/1b3877191ee9d97d2c50ccacb41461827b42fd56

closes odoo/odoo#131975

X-original-commit: d939fc83ab645ebced6859e04269fb65bf47f323
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-17 18:43:08 +02:00
Rodolpho Lima ef9efcdc61 [FIX] web_editor: disable dropImageAsAttachment for mail and mailing
This commit deactivates the conversion of pasted or dropped images into
attachments through a controller within the web_editor module. This
alteration applies to mail and mass_mailing modules, as they have their
own mechanism to handle this process.

task-3457541
opw-3448851

X-original-commit: 291ca7496515701737f6940fa27c917ded205aa6
Part-of: odoo/odoo#131975
2023-08-17 18:43:06 +02:00
Nicolas Bayet 0c4a94e17d [FIX] web_editor: properly return the value of _hasICEServers
In the forward port #129226, the return value of _hasICEServers was
not properly returned, which led to the collaboration to always be
disabled.

task-3468261

closes odoo/odoo#132165

X-original-commit: e215290bd2d6091396aafadc58a93a68675d77dd
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-17 11:48:48 +02:00
FrancoisGe e3da5f1b7d [REF] *: convert legacy dialogs
The goal of this commit is to convert a bunch of legacy dialogs into owl dialogs.

closes odoo/odoo#131278

Task-id: 3453920
Related: odoo/enterprise#45484
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-16 16:05:12 +02:00
Louis Wicket (wil) 537b0ce712 [REM] base, *: remove binary_field_real_user from context
Formerly, using sudo() on a record had the effect of replacing the
current user with the superuser. But sometimes, knowing who the "real
user" was was necessary, so we needed to store it somewhere. This is
basically why the key `binary_field_real_user` was introduced in the
context: to keep track of who the user was before switching to sudo
mode.

Since 1e6c3bec2c, however, switching to
sudo mode no longer changes the current user; meaning that the
`binary_field_real_user` is no longer necessary.

This commit removes the remaining occurrences of the now useless
`binary_field_real_user` from the code.

* = hr, portal, web_editor

closes odoo/odoo#92032

Enterprise: https://github.com/odoo/enterprise/pull/27649
Related: odoo/enterprise#27649
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-08-16 10:23:49 +02:00
Maitri Patel b66c88df12 [FIX] web_editor: handle none value for description field
If a user gets the 'description' field None, then traceback will appear.

https://github.com/odoo/odoo/blob/907aba0f54f65788c78c1370a573fbe9b69be8c5/addons/web_editor/controllers/main.py#L50

Error: 'TypeError: expected string or bytes-like object'

Sentry-4319373991

closes odoo/odoo#131943

X-original-commit: d00a1fd4b3dbed7b55a32ce6bbd659b56dd06de2
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-14 19:28:58 +02:00
David Monjoie c8a63f2414 [FIX] web_editor: fix traceback when reconnecting
closes odoo/odoo#131896

X-original-commit: 581ec9209a2d5cc0f13de9ccb6f10e6255ba4959
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-14 13:42:36 +02:00
Jorge Pinna Puissant e338487028 [REF] *: remove owl="1" from the templates
As all the templates are now imported in the owl app, there is not need
anymore to specify the owl="1" attribute in the templates.

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:30 +02:00
Jorge Pinna Puissant 4b0a951af6 [REM] remove qweb library
Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:30 +02:00
Jorge Pinna Puissant f956e83c74 [REF] *: remove qweb.render
This commit removes the qweb.render method, instead it will use the owl
render engine (renderToString or renderToElement).

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:28 +02:00
Jorge Pinna Puissant 7b1d82aa9b [REF] *: add t-key when needed on the template
As all the templates are now imported in the owl app, the templates must
comply to owl.

t-key is mandatory when using a t-foreach

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:27 +02:00
Julien Carion (juca) 2a72028ce6 [FIX] web: prevent upload of large files
This commit ensures that files uploaded using the FileInput, upload
service or AttachDocumentWidget will not exceed the maximum file size of
the context in size before sending them to the server. It also moves
some utils from the formatters file to the numbers file so that one
can use them without requiring the view assets.

task-3390746

closes odoo/odoo#126914

Related: odoo/enterprise#45629
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-11 14:32:00 +02:00
Louis Wicket (wil) f1722c7334 [IMP] *: unify sprintf and gettext
Improve gettext to directly handle value injection within translations,
removing the need for sprintf.

closes odoo/odoo#123932

Related: odoo/enterprise#45370
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-10 18:14:04 +02:00
Nicolas Bayet 592ca1f02e [FIX] web_editor: remove dead code in html_field
The template `web_editor.assets_edit_html_field` was not used nor
required anymore. The files under that bundle were already included
in the backend.

The template under the key `cssEditAssetId` in html_field.js is in fact
loaded in wysiwyg_iframe.js through the option iframeCssAssets.

Moreover, the line `await getBundle` was doing nothing meaningful as
the bundle assets would not be loaded after being fetched.

task-3446819

closes odoo/odoo#131365

X-original-commit: 4eebfcbdf5428cd1c53bafcd89da7095964ff384
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-10 09:11:55 +02:00
Nicolas Bayet 645b6b2c10 [FIX] web_editor: properly fetching of colorpicker template
As described in #129974, the colorpicker cannot cache a promise
protected by `useService`. #129974 fixes the issue by through non
idiomatic practice (calling a service that is not protected by
`useService`). This commit fixes the issue idiomatically.

This commit caches the promise directly from a service and removes the
caching code from the `ColorPalette`.

task-3446691

closes odoo/odoo#130789

X-original-commit: 1d2e54088b0f0e28464ab6aa884fb2e1110e8e04
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-10 06:17:03 +02:00
Stanislas Gueniffeyandqsm-odoo 7880c1599b [FIX] web_editor, *: add system for editable medias in non editable envs
*: website

Some specific media items are meant to be editable even though located
in non-editable environments. The typical case in 15.0 is the website
"Team" snippet: it is made of multiple bootstrap rows, each containing
a column with an image and a column with texts. The columns with the
image are only meant to hold that image, it was therefore marked as
non editable to prevent users adding text in there by mistake... but the
image is still meant to be editable. See [1], later fixed by [2].

The problem now is that the system that [2] had to use is quite messy:
the column is marked non editable thanks to the `o_not_editable` class
but the inner images were to be declared editable via some custom JS
method overrides (`_getContentEditableAreas`). The debate about if we
should keep a class-based system and/or a method-override system will be
left to master. This commit although comes with an uniformisation about
this, introducing a new class to declare "an editable media despite its
non editable environment". This is not a counter-part of the class
`o_not_editable`: we do not want the media to be marked with the
`contenteditable` attribute. Indeed, this is actually required since [2]
was not enough to solve the problem. See those steps:

- Add a company snippet in your page
- Change one of the images by an icon
- (Save / Reenter edit mode)
- Try to change the icon again / edit its options

=> You can't. Indeed [2] relied on the media being an image to re-enable
edition on it... but even if it did not, it would not have been enough.
Indeed, icons are forced to being `contenteditable="false"` by the new
editor library (since 15.0 then), last update on that at [3].
We thus needed a different way to differentiate editable media, hence
the introduction of the new `o_editable_media` class.

Note: this system is not perfect, but so is not the whole system about
determining what is editable or not at the moment. In this case, it may
exist cases of a media marked with the class to be editable but end up
in an environment which is not editable by force (xpath somewhere etc)
... and ends up being editable anyway. Most cases work though and at
worse it will be about a non editable image being editable but not
possible to save in very rare cases. As advertised, the whole system
about what is editable or not should be improved.

[1]: https://github.com/odoo/odoo/commit/30db617bc8ff7727f40d7ef58c6578e84a13f284
[2]: https://github.com/odoo/odoo/commit/61270ee8bffb6e85f8ff0d19c7a3889fdce2f486
[3]: https://github.com/odoo/odoo/commit/7646429e894f28f398b7b212e893822c06c7b03d

task-3226172

closes odoo/odoo#131139

X-original-commit: 436265e815684046a37a8b80e4cd520c2bd637f0
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2023-08-09 21:01:17 +02:00
qsm-odoo 9f183ea0e9 [FIX] web_editor: properly bind dblclick to videos to edit them
Commit [1] refactored the event handler code in charge of handling
double click on media elements to edit them. A mistake was made making
the code consider inner elements of the media instead of the media as a
whole when clicking on it.

Steps to reproduce:
- Enter edit mode on the homepage
- Add a text-image snippet
- Change the image to a video (after dblclick on the image for instance)
- Try to change it back with a dblclick => it does nothing

[1]: https://github.com/odoo/odoo/commit/8ca115b3b9dfe87b59b6b064a4d85ea152d9214c

X-original-commit: 4b47ae0022a3e50d53dc02e399412585fc2131ef
Part-of: odoo/odoo#131139
2023-08-09 21:01:17 +02:00
Benoit Socias 205fad17a3 [IMP] web_editor, website: add drop-zone locking and exclusion
Since [1] form fields cannot be moved outside of their form and since
[2] table of contents cannot be nested within another table of content.
Those were implemented with specific references to website classes
within web_editor.

This commit introduces declarative mechanisms for both situations:
- `data-drop-lock-within`: prevents dropping outside the closest parent
that matches the specified selector.
- `data-drop-exclude-ancestor`: disallows dropping within a parent that
matches the specified selector.

[1]: https://github.com/odoo/odoo/commit/638d0e875dcb05191fe833d2f889235891dfb46a
[2]: https://github.com/odoo/odoo/commit/55339cd6a7b7916184893c0fe27b5483683a047a

task-3131384

closes odoo/odoo#130477

Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
2023-08-09 13:20:57 +02:00
Jinjiu Liu 3445ac4bb5 [FIX] web_editor: the dirty flag is set for character escaping
Reproduction:
1. Install Note, create a new note
2. Start the Inspector, edit the placeholder <p> element in the
description
3. Replace the element as `<p style="color: rgb(32, 31, 30); font-family
: &quot;Segoe UI&quot;, &quot;Segoe UI Web (West European)&quot;, &quot;
Segoe UI&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Helveti
ca Neue&quot;, sans-serif; font-size: 15px;">dsfhislahflidsahisa</p>`
4. The saving icon appears, click it but it will always be there, e.g.
always dirty

Fix: instead of comparing the raw value of the prop value and editing
value, we parse them and compare after the parsing

opw-3341605
task-3434080

closes odoo/odoo#131245

X-original-commit: eda483bd3c3bdc42b95f17a5278c1a9eb83adb05
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Jinjiu Liu (jili) <jili@odoo.com>
2023-08-09 03:08:29 +02:00
Nicolas Bayet f5405d61e7 [FIX] web_editor,mass_mailing: remove unnecessary loading of html2canvas
Since #119325, html2canvas is not used for the toInline process anymore.
Loading the script was still done in the web editor and mass mailing,
which is not needed anymore.

task-3446888

closes odoo/odoo#130862

X-original-commit: e3c9d3c4fb013124faf6d132297171a34854f991
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-09 01:53:07 +02:00
Pierre Pulinckx (pipu) b1ebe3b6f4 [REF] *: Replace core._t imports
In this commit, _t import from import { _t } from
"@web/legacy/js/services/core" and from
 web/static/src/legacy/js/core/translation.js are replaced by
@web/core/l10n/translation.js.

task-3292454

closes odoo/odoo#130865

Related: odoo/enterprise#45270
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-09 00:13:08 +02:00
Aurélien (auma) 12f004f281 [FIX] web_editor: fix uneditable block when height > 10000px
When applied, this commit will restore the edition of a block when
the content has a height > 10000px.

Steps to reproduce:
1) Go to a runbot
2) Go to a blog or on the homepage
3) Enter edit mode
4) Add some text in one bloc with a total height above 10000px
5) The text will be uneditable on the top

Current behavior:
If the text is too important in one block (more than 10000px),
the text will be uneditable

Expected behavior:
The text should be accessible and editable even if the block
has too much content

opw-3393570

closes odoo/odoo#130965

X-original-commit: 493d31a9b2f6508e1e48627ff510120f93870c4e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-08-07 19:57:57 +02:00
Michael (mcm) 00d8aef1c7 [REF] web, *: remove legacy patch
This commit removes legacy patch/unpatch functions and adapts their use
by using the modern patch. There was also a custom patch function used
in tests which has been replaced too.

closes odoo/odoo#130867

Related: odoo/design-themes#685
Related: odoo/enterprise#45271
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-08-07 10:58:48 +02:00
abd-msyukyu-odoo 5feda35e6f [IMP] web_editor: put rollback code assignation on its own line
If the `_toRollback` property of the editor is assigned on its own line, it is
easier to identify which assignation caused/prevented a rollback when
debugging.

closes odoo/odoo#130894

X-original-commit: 263dcbaf9aa0c48bd61bf85b091c746d7850cfe1
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-04 16:35:12 +02:00
Aaron Bohy 8a787f1866 [REF] web,web_editor: move SmoothScrollOnDrag to editor
This commit moves the smooth scroll on drag helper from web to
web_editor, which allows us to move it from frontend and common
assets to web_editor.assets_legacy_wysiwyg which is only loaded
in the website editor, the only place where it is used.

Note that it uses legacy Class and mixins, so it still needs to be
converted to the modern codebase, alongside editor snippets.

Part of task~3439226

closes odoo/odoo#130813

Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-08-04 12:21:58 +02:00
dhba-odoo a1f8de1454 [FIX] web_editor: avoid traceback when copying a list from a table
Before this commit:

When a user attempted to copy a list from a table, it would result in a
traceback.

After this commit:

Now, when a user copies a list from inside a table, the traceback error
will no longer occur.

Task-3384289

closes odoo/odoo#130759

X-original-commit: 53f5b98b350f6d7db80d2d1921c91c28ed7c3148
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-04 09:43:16 +02:00
Aaron Bohy 850427e4ba [REF] web,mail: remove legacy MockServer and related utils
This commit removes the legacy implementation of the MockServer
and test utils making it available in the test environment (e.g.
addMockEnvironment).

Part of task~3439226

closes odoo/odoo#130671

Related: odoo/enterprise#45141
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-08-04 09:43:08 +02:00
Antoine (anso) 59828459ad [IMP] mass_mailing: restore sheet
This commit restores the sheet layout in mass_mailing for consistency
reasons.

The chatter was extracted from the tab it was in and moved back on
the right side.

This commit also fixes an alignment problem when an alert is displayed
and the alert was vertically bigger that the buttons of the status bar

task-3355071

closes odoo/odoo#130616

Forward-port-of: https://github.com/odoo/odoo/pull/126646
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-08-03 19:31:36 +02:00
Robin Lejeune (role) 73317cb9d1 [IMP] web_editor, website: use consistent margins on buttons
Commit [1] added a margin-bottom on buttons within snippets to make some
breathing space when several buttons follow each other and appear on
multiple lines on mobile.
However, buttons added by the customer do not have a margin, which
causes misalignment when they add it next to a prebuilt button.

This commit checks that whenever a user adds a new button, if any of its
direct siblings is a button, the newly added button and its button
siblings get an appropriate margin-bottom.
It also reverts commit [1] and removes the `mb-2` class on the button in
`s_text_cover.xml` from commit [2], as it is not needed anymore with
this new behavior.

task-3369604

[1]: https://github.com/odoo/odoo/commit/075e915
[2]: https://github.com/odoo/odoo/commit/5ac340b

closes odoo/odoo#125824

Related: odoo/design-themes#680
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
2023-08-03 19:30:52 +02:00
Michael (mcm) 9d6b380a24 [REF] *: adapt patches after new patch function
In the commit [1], the patch has been refactored to support the
native keyword `super`. The current commit just adapts the codebase
to that change.

task 3410198

[1]: 19ea1ac08043e22a811630968e44715cc3bfc495

Part-of: odoo/odoo#125716
2023-08-02 17:29:05 +02:00
Benoit Socias cd46857b15 [FIX] web_editor, website: use dataset mimetype when modifying images
Since [1] the mimetype used when calling `modify_image` was obtained
from the data URL contained in the `src` attribute instead of the
dataset. This is wrong for background images because they do not have an
`src` attribute.
Thanks to [2] which repaired the value contained in `dataset.mimetype`,
this value can be used as it was before [1].

[1]: https://github.com/odoo/odoo/commit/0449fe85cb0e1d639a4e1aeba26e90906f79254d
[2]: https://github.com/odoo/odoo/commit/40811e72c50faf146ccdf9f26c332db9ebc69fa9

task-3446438

closes odoo/odoo#130322

X-original-commit: e3221fe5d5efa824365210f040e93654e0a30309
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-08-02 05:10:48 +02:00
Nicolas Bayet 1feeeda8b8 [FIX] web_editor: synchronise fields with oe_unremovable
When the mechanism that synchronise odoo fields contained an
unremovable, even though no unremovable got removed, the Odoo editor
would rollback as the syncing mechanism would set innerHTML to the
synced nodes, which would remove the unremovable. To prevent the
rollback in that kind of circumstance, this commit introduce a new
method on the OdooEditor `withoutRollback`.

task-3436834

closes odoo/odoo#129320

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-01 15:09:24 +02:00
Deependra Solanki 0c4d747aaf [IMP] web_editor: different numbered list marker at each level
Purpose:

To make the marker of a ordered list different at each level.
- Numbers for first level.
- Alphabets for second level.
- Roman numbers for the third level.
looping back to numbers if nested further.

To make the marker of a unordered list different at each
level.
- Disc for first level.
- Circle for second level.
- Square for the third level.
looping back to disc if nested further.

task-3412826

closes odoo/odoo#128532

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-01 15:09:17 +02:00
Rodolpho Lima cdc8e4daad [FIX] web_editor: images stored as base64-encoded sources
Commit [1] introduced an option in the Wysiwyg widget to save pasted
and dropped images as attachments instead of keeping them as inline
base64-encoded sources.

In order to prevent records from having excessively large sizes in their
html field content, this commit makes such option the default one for
the Wysiwyg class.

task-3289061

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

closes odoo/odoo#130213

X-original-commit: 7e06b40ea58f58069729f881f7d4559d17778fe7
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-01 13:51:40 +02:00
Pierre Pulinckx (pipu) 60fe2e9b17 [REF] *: remove _lt()
In a previous commit 8bfa76a, _lt() returns _t().
So, in this commit, all usages of _lt() are replaced by _t().

task-3292454

closes odoo/odoo#130179

Related: odoo/enterprise#44906
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2023-08-01 13:51:17 +02:00
Pierre Pulinckx (pipu) 3bc94e52ce [REF] *:Replace moment usages with luxon
luxon and moment are both used in the solution,
but these two libraries facilitate the manipulation
of dates. It was decided to replace all uses of
moment with luxon so we can then remove
moment.js from the code and lighten the assets.

task-3391739

closes odoo/odoo#128752

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-07-31 19:02:45 +02:00
Gaetan Vanden Bergh (gavb) 2008cff999 [FIX] web_editor: not access cssRules from other domains
domain = host = hostname + port

Cause: https://github.com/odoo/odoo/pull/125251

Steps to reproduce:
- Add in the custom with a href's host different than the current database host
- Open website
- Edit it
- Click on a block OR add a block and try to save

Actual:
- Infinite loading due to SecurityError on the cssRules fields

Expected:
- No infinite loading

opw-3432734
opw-3438480
opw-3435892
opw-3371073

closes odoo/odoo#130151

X-original-commit: 8d550d5cc5f055a9de26e3b050550268710b1827
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-07-30 10:06:42 +02:00
Rodolpho Lima 58352b6e69 [FIX] web_editor: toolbar position after mouseup
On mouseup the toolbar size might change (eg. link button removed),
leading to an ill-positioned toolbar.

This commit makes sure the toolbar position is updated after going
through changes after a mouseup.

task-3347670

closes odoo/odoo#130022

X-original-commit: af52356704f990ecb3c8a7832fe3de8898026885
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-07-28 16:29:32 +02:00
Rodolpho Lima 940ff56920 [FIX] web_editor: empty link button group in toolbar
Buttons in the floating toolbar are displayed depending on what is
selected. When selecting text that spans multiple blocks, the
"#create-link" button is hidden from the floating toolbar.

Before this commit, when the "#create-link" button was hidden, the
"#link" button group would be left empty but still visible on the
toolbar (its separator bar remained visible).

This commit ensures that:
- the responsability of displaying/hiding the "#unlink" button
is from Wysiwyg's _updateEditorUI method, as it is the case with the
other toolbar buttons,
- when a button group has none of its children button visible, it is
made invisible too, including its separator bar.

This commit also fixes the selector for toggling the "#create-link"
button active/inactive, bringing the affected code section alive from
the dead.

task-3347670

X-original-commit: ceedd72b893316f5994727063a6a6faf49476408
Part-of: odoo/odoo#130022
2023-07-28 16:29:32 +02:00