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/d7245d2abf528d093226c80e40975e63d61e8997closesodoo/odoo#132726
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/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>
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
closesodoo/odoo#132574
X-original-commit: c799345f6ae81f10a8133688431fe63ed23617ad
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
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
closesodoo/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>
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
closesodoo/odoo#132561
X-original-commit: 7a9977882b0e9222beba7de23f026de937a60a4d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
*: 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
closesodoo/odoo#132377
X-original-commit: 425dfb07f21288caf56bceea3a86e0b7ecac4a91
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#132531
X-original-commit: 08432308819e83fd0122a8e87170ec8ff27ca2a1
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Divyesh Vyas (divy) <divy@odoo.com>
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
closesodoo/odoo#131748
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
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()`.
closesodoo/odoo#130818
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
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
closesodoo/odoo#131390
Related: odoo/enterprise#45631
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
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.
closesodoo/odoo#132235
Related: odoo/enterprise#45908
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
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/1b3877191ee9d97d2c50ccacb41461827b42fd56closesodoo/odoo#131975
X-original-commit: d939fc83ab645ebced6859e04269fb65bf47f323
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
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
closesodoo/odoo#132165
X-original-commit: e215290bd2d6091396aafadc58a93a68675d77dd
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
The goal of this commit is to convert a bunch of legacy dialogs into owl dialogs.
closesodoo/odoo#131278
Task-id: 3453920
Related: odoo/enterprise#45484
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
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
closesodoo/odoo#92032
Enterprise: https://github.com/odoo/enterprise/pull/27649
Related: odoo/enterprise#27649
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
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
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
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
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
closesodoo/odoo#126914
Related: odoo/enterprise#45629
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
Improve gettext to directly handle value injection within translations,
removing the need for sprintf.
closesodoo/odoo#123932
Related: odoo/enterprise#45370
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
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
closesodoo/odoo#131365
X-original-commit: 4eebfcbdf5428cd1c53bafcd89da7095964ff384
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#130789
X-original-commit: 1d2e54088b0f0e28464ab6aa884fb2e1110e8e04
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
*: 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
closesodoo/odoo#131139
X-original-commit: 436265e815684046a37a8b80e4cd520c2bd637f0
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
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
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
closesodoo/odoo#130477
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
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
: "Segoe UI", "Segoe UI Web (West European)", "
Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helveti
ca Neue", 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
closesodoo/odoo#131245
X-original-commit: eda483bd3c3bdc42b95f17a5278c1a9eb83adb05
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Jinjiu Liu (jili) <jili@odoo.com>
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
closesodoo/odoo#130862
X-original-commit: e3c9d3c4fb013124faf6d132297171a34854f991
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#130865
Related: odoo/enterprise#45270
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
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
closesodoo/odoo#130965
X-original-commit: 493d31a9b2f6508e1e48627ff510120f93870c4e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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.
closesodoo/odoo#130867
Related: odoo/design-themes#685
Related: odoo/enterprise#45271
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#130894
X-original-commit: 263dcbaf9aa0c48bd61bf85b091c746d7850cfe1
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#130813
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
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
closesodoo/odoo#130759
X-original-commit: 53f5b98b350f6d7db80d2d1921c91c28ed7c3148
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#130671
Related: odoo/enterprise#45141
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
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
closesodoo/odoo#130616
Forward-port-of: https://github.com/odoo/odoo/pull/126646
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
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/5ac340bclosesodoo/odoo#125824
Related: odoo/design-themes#680
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
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
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
closesodoo/odoo#129320
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#128532
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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/b8e7fb4a5ec8c75deff37dc1737b6a3d3b123cc3closesodoo/odoo#130213
X-original-commit: 7e06b40ea58f58069729f881f7d4559d17778fe7
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
In a previous commit 8bfa76a, _lt() returns _t().
So, in this commit, all usages of _lt() are replaced by _t().
task-3292454
closesodoo/odoo#130179
Related: odoo/enterprise#44906
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
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
closesodoo/odoo#128752
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
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
closesodoo/odoo#130151
X-original-commit: 8d550d5cc5f055a9de26e3b050550268710b1827
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
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
closesodoo/odoo#130022
X-original-commit: af52356704f990ecb3c8a7832fe3de8898026885
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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