This commit removes the files ajax.js and rpc.js then adapts all the
places where their exports were used. For most of the changes, it's a
replace of `this._rpc({...})` by a new `useService("rpc|orm")` like
pattern in the widgets.
closesodoo/odoo#136271
Task: 3439226
Related: odoo/enterprise#47775
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit:
-On selecting fullscreen/description for image toolbar stays.
-On selecting description for image focus in not set on input field.
After this commit:
-Now toolbar is removed when selection changes.
-Now on selecting description for image, focus is set on input field.
task-3468251
closesodoo/odoo#136466
X-original-commit: 210230f972c4468c3f472509adb25dfc87d4c2b2
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Before this commit:
-With selection on checklist, on unchecking it toolbar is not updating.
After this commit:
-Now toolbar is updated when list unchecks.
task-3504398
closesodoo/odoo#136541
X-original-commit: 2cf3dd5988914a09bbc2098eccb3c8419995e120
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Before this commit:
Indenting list using tab inside a table used to switch to the next cell.
After this commit:
Indenting list using tab inside a table now indents a list instead of switching
to the next cell.
task-3470092
closesodoo/odoo#136538
X-original-commit: 62c16468e2759eb0a0c3eecf3866b543be3bfabb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Before this commit:
when selected cell is clicked, its selection collapses yet toolbar is visible.
After this commit:
Now toolbar is removed when selection collapses.
task-3458048
closesodoo/odoo#136533
X-original-commit: 89116f6f356df0b33ba61f8b2e725ae7530bdceb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Steps:
In a website forum post without any previous scrolling, select some
text. A traceback appears due the fact that there's no .o_action_manager
element in website forum.
This commit uses the document body as a fallback for the scroll
container when the .o_action_manager element is not present.
task-3506312
closesodoo/odoo#136508
X-original-commit: fc6f66f179798a731489a6a3e73af0d37af27f7d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Rodolpho Cammarosano de Lima (rcdl) <rcdl@odoo.com>
If somehow there is no selection but the `_handleShortcuts` handler still gets
called with `CTRL+A`, `container` would be a JQUERY object instead of an
element leading to a crash in `selectNodeContents` which expects a `Node`.
task-3506666
closesodoo/odoo#136499
X-original-commit: e6fac045282465960c0e4a7ecbbbb5e5ac8dff92
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Damien Abeloos (abd) <abd@odoo.com>
When changing a link's content, its URL (href attribute) might change
(if the new label is a valid URL), due to a mechanism in OdooEditor.
Before this commit, when a change in the link's content leads to a href
change:
- if the LinkTools is opened, the URL input field would become outdated
and display an incorrect URL.
- likewise, if the popover is shown, its content and position would be
outdated (possibly covering the link's new content).
This commit makes sure both the LinkTools URL input field and the
popover stay up-to-date if a link's content or href changes.
task-3284649
X-original-commit: 1b0952f3635f5677ba3ab221a28ceb26920a1862
Part-of: odoo/odoo#136278
Before this commit, any changes made to label input field were lost when
the LinkDialog or LinkTools component was re-rendered.
This commit fixes it without leveraging OWL's reactivity/declarative
approach, because most of the code in these components is imperative and
not yet converted to the OWL paradigm, leaving such refactor to be done
in the master branch.
Part-of: odoo/odoo#136278
If a link's content is equivalent to its URL, two problems can arise
when its URL is changed via the LinkTools:
- The link's content becomes outdated, showing a different URL;
- On LinkTools destroy, the OdooEditor mechanism that updates a link's
href on label(content) change will update the href according to the old
label, effectively reverting the changes in the URL.
This commit avoids such issues by syncing the label with the URL input
field in such cases.
task-3284649
X-original-commit: 8ddcc08c1700151e697ecb3c0c1daec2db9f8fd2
Part-of: odoo/odoo#136278
Before this commit:
- URLs like "domain.com/@/page" were incorrectly detected as an email
URL by Link(Dialog/Tools),
- switching from an email URL to a http URL with the Link(Dialog/Tools)
was not possible (URL remained prepended with "mailto:").
This commit improves email detection from simply looking for a "@" to
something slightly more robust, and makes switching between 'http'
and 'mailto' links possible.
task-3284649
opw-3245501
X-original-commit: e849ff4333355386dfb79bc574c93c76ed3e2d3b
Part-of: odoo/odoo#136278
Typing a URL + SPACE transforms the URL into a link.
Before this commit, email URLs were incorrectly prepended with
'https://'.
Because it is not desirable to automatically transform email URLs, this
commit disables link transformation for email URLs, leaving it only
active for http URLs.
task-3284649
X-original-commit: ad0e7845fceb578398e42e4b35820c415734452a
Part-of: odoo/odoo#136278
OdooEditor has a mechanism to update a link's href on label change, if
the new label is a valid URL.
Before this commit, there were two issues:
1. it did not work for email links. In fact, because this mechanism was
incorrectly prepending email URLS with 'https://', [1] disabled it for
'mailto:' links.
2. when a link had a 'http' href but its label did not contain the protocol,
upon label change (into a valid URL) the link had its href changed to 'https'.
This commit:
1. re-enables the auto update mechanism for email links and fixes it, so
that it can correctly update both http and mailto links.
2. fixes the 'http' to 'https' coercion issue, making sure the current
protocol is kept when updating http(s) links.
task-3284649
[1]: https://github.com/odoo/odoo/commit/ea00a628969a0eeda66e06776af721a99a32cc57
X-original-commit: 6740e2821c51897baa110e9e4129b40c403e000c
Part-of: odoo/odoo#136278
Commit [1] separated the two responsabilites of _onURLInput: making
changes to the DOM and updating the UI, taking care that only the second
one is done at start.
But this broke the following functionality:
- Have a URL-like text (ex: odoo.com), select it and click the link icon
on the sidebar.
- The URL is deduced from the link's label.
- Click anywhere to close the sidebar.
Before [1], the link transformation would be kept. After it, it is not.
This happens because this is a particular case in which we want to apply
changes to the DOM at start time, as if a URL input event had happened.
This commit fixes it.
task-3284649
[1]: 54746012d3
X-original-commit: da0a3f34401547478107945626034d7932855f02
Part-of: odoo/odoo#136278
Before this commit, the setup actions performed by _configureToolbar
were missing for the website toolbar. This resulted, among other things,
in non-responsive buttons like create link or insert media.
Part-of: odoo/odoo#136278
Current behaviour before commit:
In table, when clicking table menu icon it throws
traceback.
Desired behaviour after commit:
Now, clicking table menu icon opens table menu
without any traceback.
task-3503806
closesodoo/odoo#135324
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit fixes the issue of partial coloring of table cells.
Before this commit, if one colors part of the text in the cell
and then seeks to color the whole cell, the last coloring
would not apply on the previously colored text.
We do that by preventing the cell coloring to be done differently
than other elements except if we want to change the
background color.
Task-3454903
closesodoo/odoo#130646
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
How to reproduce:
- open a record with an html_field (i.e. todo or a Knowledge article)
- switch back and forth with the pager or the knowledge sidebar between 2
records
Current behavior:
- traceback `this._elementHookMap.get(element)` is undefined
Expected behavior:
- no traceback
Technical explanation:
When changing the editable content (i.e. `resetContent` when changing record),
there is no guarantee that `_intersectionObserverCallback`
(intersectionObserver) won't be called before `_updateHooks` (mouseMove/resize
after a mutation occured).
This is an issue because `this._elementHookMap` may not yet have a hook element
related to the editable element which stops intersecting the document.
If such a case occurs, the next `_updateHooks` should be called when the
mutationObserver flags `_resetHooksNextMouseMove` to `true` and then after the
next `mouseMove` (or after the next resize).
Ignore the hook style update if there is currently no hook for an element which
stops intersecting.
Remove a redundant check in `_getMovableElements`
task-3506666
closesodoo/odoo#135464
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Reproduction:
1. Install website
2. Change to edit mode and edit a link on the main page, for example,
“contact us” at the bottom
3. When you replace the link with /, the rpc breaks and no suggested
links returned
Fix: this issue is gone with a recent update on master, now the rpc used
by linkTools is the new rpc
Task-3444671
[FIX] web_editor: restore double click focusing on URL when editing link
Reproduction:
1. Install website
2. Change to edit mode and edit a link on the main page, for example,
“contact us” at the bottom
3. The focus is on the url at the link tool
Fix: The desired behavior when clicking on links in editing mode is: one
click, edit the text of the link; double click, focus on the URL in link
tools. After converting to OWL, focusing on URL is handled by props, e.g
. `shouldFocusUrl`. We also need to update the state of this prop in
`toggleLinkTools` as we did before conversion.
Task-3444671
Forward-Port-Of: #132167
Also added fix for using the new rpc function instead of the legacy one,
edited the test accordingly.
Part-of: odoo/odoo#135371
When the Wysiwyg is used by website, multiple editable elements are
possible, and each of them carry the related record's model and id in
the element's dataset.
On the other hand, when the Wysiwyg is used by the html field, there's
only one root editable element, and such information is not present in
the editable's dataset, but in the widget's options object.
Before this commit, when saving the content of an html field, modified
images were converted to attachments without the correct reference to
the record's model and id.
This commit makes sure that such information is passed to the route that
handles attachment creation.
task-3495668
closesodoo/odoo#135806
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
Commit [1] added a check for the closest ".o_dirty" editable element in
order to define which editable is used for obtaining the model and id
reference from its dataset, and also to avoid multiple attachment
creation for the same image.
But such check for the closest ".o-dirty" element evaluates to null when
the Wysiwyg is used by the HtmlField component, as such class is not
added to editable when saving/committing changes. This resulted in
skipping the attachment creation for pasted, dropped or modified images.
After this commit, attachment creation for modified images is not
skipped if an element with the ".o_dirty" class does not exist.
task-3495668
[1]: https://github.com/odoo/odoo/commit/e631bff05a3588f3304b75b6a0018b096c13f68d
Part-of: odoo/odoo#135806
Since the commit [1], some Font Awesome icons have been replaced by 'oi'
icons in the editor panel. This has resulted in a situation where both
'fa' and 'oi' icons coexist.
These changes have caused two issues in the editor panel:
- The icons in the two buttons used to flip a background shape are no
longer centered within their buttons.
- When a row of buttons contains a mix of 'oi' and 'fa' icons, all these
buttons no longer have the same width. This issue was identified in
Master when new options for flipping/rotating an image shape were
introduced (see this commit [2]). Even though this bug may not be
visible in version 16.3, it is still necessary to address it here since
any potential changes could reveal this bug.
This commit resolves these issues by adjusting certain parts of the CSS
code of the the editor panel to handle 'oi' icons in the same way as
'fa' icons for these two specific cases.
[1]: https://github.com/odoo/odoo/commit/418413e4997a6b65eb7ad9e9ef8aba42805f1c0c
[2]: https://github.com/odoo/odoo/commit/fbb395021da5e8ba115d36dfd683f8576a74bf80
task-3493051
closesodoo/odoo#135330
X-original-commit: 3729cf6ab4261a29431ef05fcb7cc33ba5e3ad5a
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
[1] introduced the grid mode and with it a util that reloads lazy
images in order to prevent a bug in Chrome which make images disappear.
This util read the .src property of the image element. That property is
the absolute URL.
In order to keep the exact URL that was on the img attribute, one needs
to use "getAttribute".
This commit does exactly that.
Steps to reproduce:
- Drop a Image - Text snippet
- Drag the image to enter grid mode
=> At the same time the image is reloaded with the wrong src
[1]: https://github.com/odoo/odoo/commit/cc406afcea7bf5846233a9f97a4a8ac5f618f3ecclosesodoo/odoo#135392
X-original-commit: 3528f2c3f9d3b30266f3421672986d202c724a76
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
The Dynamic placeholder was not opening properly in mail template since the wysiwyg OWL conversion.
Fix it and also fix the tour that should have detected this error.
The tour itself was not running properly.
task-3495254
closesodoo/odoo#135275
X-original-commit: df8532cffc74038db0faef36b5f43758e1bbdf43
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
This commit fixes the issue of animations that got trigger by backspacing, pressing enter
and other causes
The cause of the issue was a custom historyRevert event that was only used to
trigger a widgets_start_request event which ended up restarting the options,
which lead to the animation option replaying the animation.
We were not able to pinpoint the use of this particular trigger_up as it does
not seem to serve any purpose anymore. Since its presence does create a bug, we
decided that the best course of action was to remove it. If this commit creates
a regression and the original bug comes back, we will reassess the situation.
Task-2752421
closesodoo/odoo#135332
X-original-commit: cef24b89405205ee0484555209e59a8599d9deb2
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit will apply the following changes:
1. Introduce a new `VideoIframe` component for the `VideoSelector`
component. With that change, one can easily mock the `VideoIframe`
component in a tour and replace the iframe of the video with
alternative content. It will then be possible to test the whole video
integration flow with a tour without relying on Third-Party services.
2. Enhance the Python video parser to include the video id and the video
parameters of the url being parsed. These new information will be
used for the new video behavior of Knowledge.
3. Call the callback function notifying that the video url has changed
when the textarea is emptied (see: `selectMedia`).
4. Authorize non-internal users to call the /web_editor/video_url/data
route. This will ensure that portal users will be able to integrate
videos in their Knowledge articles.
5. Apply some minor UI and UX adjustments:
- The label next to the toggle buttons will now be properly aligned.
- The textarea to input the video url will be automatically focused.
task-3297215
closesodoo/odoo#127452
Related: odoo/enterprise#40683
Signed-off-by: Damien Abeloos (abd) <abd@odoo.com>
This commit makes the clear button of the toolbar always visible
even if no style is applied.
Since the display is controlled by the css, we removed the concerned
style.
Task-3459819
closesodoo/odoo#135293
X-original-commit: 78d3e1c327e81a1fddbe068860eeec498af29b89
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Before this commit, when pasting or dropping an image, the insertion of
the image element to the DOM and the addition of the
"o_b64_image_to_save" class to it were recorded in two separate history
steps. This commit makes sure they are both recorded in a single step.
Additionally, the dataset was removed from the image element by the
(unnecessary) call to _prepareClipboardData. This resulted in losing the
file name information, which is useful when converting the image into an
attachment.
Before this commit, the "width: 100%" addition to the image's style
attribute had no effect, as it was later removed by the call to
_prepareClipboardData. In fact, the class "img-fluid" sets "max-width"
to 100% instead, which is offers desirable behaviour.
task-3497880
closesodoo/odoo#134832
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
In odoo/odoo#133349 some code in website was adapted to use the new
datetime picker and luxon instead of tempusdominus and moment, but some
conversions were improperly performed causing a crash that would prevent
the website editor from opening. This commit fixes this issue and also
formats the chosen default date/datetime correctly while within the
editor.
This commit also fixes a minor issue with props validation of the
datetime picker, where we would give it an empty string instead of null
or false, causing props validation to fail in debug mode.
closesodoo/odoo#134493
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Commit [1] introduced a stronger regex to detect urls. Unfortunately,
it did so using a negative lookbehind, which is is only supported on
very recent version of Safari iOS.
This commit is an attempt at reproducing the same behavior, albeit
with a more complicated regex, unfortunately.
[1]: https://github.com/odoo/odoo/commit/a42a19e484d63cebeaed10b75ac20e507ff85d56closesodoo/odoo#134943
X-original-commit: ff99e454e2a38ae54aa57cb0df80df139e921ccb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit rewrite the module loader to simplify it and to improve error handling.
before this commit, you could have silent errors or "lucky" imports (import a module based on the fact that his asset will surely be load and if not, the error would be silent anyway).
e.g.: The tours cannot import modules extern to tours' bundle anymore. Or load module before your libs in assets.
TASK ID: 3266021
closesodoo/odoo#128502
Related: odoo/enterprise#44100
Signed-off-by: Bastien Pierre (ipb) <ipb@odoo.com>
This commit tried to remove owl_compatibility completely but its last
uses are either in refactoring or a bit complex to migrate. Instead of
removing the helpers completely, this commit simplifies them a lot and
makes them more readable and safe.
closesodoo/odoo#134295
Task: 3439226
Related: odoo/enterprise#46899
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
*: mass_mailing,website,website_sale
Before this commit, the ComponentWrapper was used to mount some
components which then render a dialog. This commit replaces these cases
by using the dialog service.
Task: 3439226
Part-of: odoo/odoo#134295
Steps to reproduce the bug:
- Drop a "Text-Image" on the website.
- Add a shape on the image.
- Replace the image.
Problem: The image version selected by default is the original one
instead of webp.
Because the mimetype of an image with a shape is `image/svg+xml`, a
condition has to be added in order to convert its format and its width
at the `_autoOptimizeImage()` call.
task-3449866
closesodoo/odoo#133517
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
*account,web_editor,website,website_sale,website_slides
This commit removes all legacy utils except Markup, which will be
removed in another PR. A lot of those utils were no longer used and
thus have just been removed. Those that were still used either
already existed in the wowl codebase, so usecases have been adapted
to use the new version instead. A few have been re-implemented (or
moved basically) to the wowl codebase (e.g. isEmail and humanSize).
Part of task~3439226
closesodoo/odoo#134620
Related: odoo/enterprise#47044
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Steps to reproduce:
1. add a paragraph
2. add a blockquote
=> the cursor will jump in the paragraph
This commit fixes a bug detected when inserting a blockquote. The cursor
jumps to nearby paragraph on insert, and other issues.
The cause of the bug is tied to the fact that we rely on a complex behavior
when inserting paragraph related elements (within the insert command).
The way to make blockquote behave like the other paragraph related
elements is simply to add it to the list as done in this commit.
Task-3383441
closesodoo/odoo#134700
X-original-commit: 8195beacbd878c56bc93290bc03665e30667e177
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
In order to fix wrong url recognition, improve the url REGEX by:
- Recognize an url with a dot at the end in the string
`www.google.be.`. It was not recognized before this commit.
- Do not allow a special character after an url that is not
separated by "/", "?", or "#". Before this commit, the content
`www.google.be!` would have been recognized the url as
`www.google.be!` instead of `www.google.be`.
- Do not include in the url some character if they appear at the end.
The chars are:
- .
- ,
- }
- )
- ]
- '
- "
task-3373367
closesodoo/odoo#134660
X-original-commit: 0327ed28e855c89f9c13266c4aba5c99d80263ac
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
PURPOSE
The main reason is that when there are two block side by side that are
not editable (eg. the `HR` tag, the `/template` block), it is impossible
to set the cursor in between to add more content.
task-2984709
closesodoo/odoo#105179
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
In order to use the class outside a legacy context, this commit
convert SmoothScrollOnDrag into a regular class.
task-2984709
Part-of: odoo/odoo#105179
- Add the ability to add a container to a tree of absolute containers
- Draw the avatars and the avatar overlaps in their own containers
- In order to clearly understand what draws the user avatar and a
selection, create the method _drawUserAvatar.
task-2984709
Part-of: odoo/odoo#105179
In this commit, the loadXML function has been removed. We use registry with
xml_templates to load XML templates for OWL Apps.
The goal of task is to remove loadXML and getBundle from assets to simplify
the understanding of assets api.
task-3266441
closesodoo/odoo#134520
Related: odoo/enterprise#47001
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Current behaviour before commit:
-When pasting copied content from editor inside
link inserts text with HTML content, in result
the pasted content seems isolated from the link.
e.g. <a href="#">te[]st</a>
+ pasting <h1>123</h1> <=>
<a href="#">te<h1>123</h1>st</a>
Desired behaviour after commit:
-Now only text content is pasted which makes
pasted content as a part of the link.
e.g. <a href="#">te[]st</a>
+ pasting <h1>123</h1> <=>
<a href="#">te123st</a>
closesodoo/odoo#134516
X-original-commit: 1cc3354b88658620c15fa18427b8725b6215337d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit allows you to change the icons of custom links of the social
media block after the first save. Thanks to [this other commit], there
is now a class that permits to inform the editor that a media is
editable even if it is a non-editable parent. This commit permits to use
the new class to fix the issue.
Steps to reproduce the bug:
- Drop a social media block on a page
- Add a custom social media
- Save
- Edit
- Try to change the icon of the custom social media with a double-click
=> The icon cannot be changed.
Note that [another commit] had already been made and fixed the problem
halfway (the icon change didn't work on double-click). This commit
reverts it and fixes the problem correctly with the new system.
[this other commit]: https://github.com/odoo/odoo/commit/6ead397f33512c918f51feb2b32fb3e15ffedf34
[another commit]: https://github.com/odoo/odoo/commit/bb291b35e46e42ca098aa3e04ac0b473f72be423
Fixes https://github.com/odoo/odoo/issues/104048
task-3073171
X-original-commit: b844351b9814ff2167d2183ab3216e2d1ec1d216
Part-of: odoo/odoo#134281
In the frontend of project, the bus service is not available.
Since #129785, the test `portal_project_sharing_tour` crash
because `this.busService` is `undefined` when we try to access
it in `Wysiwyg.setupCollaboration`.
task-3434068
closesodoo/odoo#133477
Related: odoo/enterprise#46479
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Before this commit:
* A delete at the end of an empty block just before a table (unbreakable), nothing happened.
After this commit:
* A delete at the end of an empty block just before an unbreakable block, the empty paragraph should be removed and the selection put at the beginning of the unbreakable block.
task-3186679
task-3252775
closesodoo/odoo#125211closesodoo/odoo#134327
X-original-commit: 70a03c931438fd549d167deb9ad500f3fc8b6024
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
Before this commit:
* A backspace at the beginning of a List Item (LI), the indentation of the list item was reduced by 1 unit.
If not possible, the current LI was merge with the previous LI.
* A delete at the end of a LI, first we remove one unit of indentation from the next LI,
only when not possible anymore we merge next LI in the current LI.
After this commit:
* A backspace at the beginning toggle off the current LI ( the LI tag is remove and popped out of the List )
The parent List is splitted if needed.
* A delete at the end of a LI directly merge next element inside the current LI.
task-3186679
X-original-commit: b177c29ee0df8c7edf72b177c59c5dff6bd0d270
Part-of: odoo/odoo#134327
Co-authored-by: Aashish Thakur <aath@odoo.com>
Before this commit:
On backspace current node is removed and it's content were moved to it's
preceding node.
After this commit:
Now keeping the current node it removes preceding node if empty and if not empty
then merge current node to previous node.
Task-2909314
task-3186679
X-original-commit: bca7f0455ce56268a592c924ac22f9f2dc6541db
Part-of: odoo/odoo#134327
Co-authored-by: Sanjay Sharma <shsa@odoo.com>