Commit Graph
3254 Commits
Author SHA1 Message Date
Michael (mcm) 7422eb643c [IMP] *: remove legacy rpc
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.

closes odoo/odoo#136271

Task: 3439226
Related: odoo/enterprise#47775
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-27 11:33:01 +00:00
shsa-odoo 78d945dd81 [FIX] web_editor: remove toolbar on selection change
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

closes odoo/odoo#136466

X-original-commit: 210230f972c4468c3f472509adb25dfc87d4c2b2
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-26 09:32:35 +00:00
shsa-odoo 22ceb76560 [FIX] web_editor: update toolbar on list uncheck.
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

closes odoo/odoo#136541

X-original-commit: 2cf3dd5988914a09bbc2098eccb3c8419995e120
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-25 18:09:58 +00:00
Deependra Solanki f3cc75bac6 [FIX] web_editor: list indentation in table
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

closes odoo/odoo#136538

X-original-commit: 62c16468e2759eb0a0c3eecf3866b543be3bfabb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-25 18:09:57 +00:00
shsa-odoo 856149776e [FIX] web_editor: remove toolbar on selection collape in table
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

closes odoo/odoo#136533

X-original-commit: 89116f6f356df0b33ba61f8b2e725ae7530bdceb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-25 18:09:55 +00:00
Rodolpho Lima e5c1a19858 [FIX] web_editor: toolbar in website forum
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

closes odoo/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>
2023-09-25 17:11:33 +00:00
abd-msyukyu-odoo 74013202c6 [FIX] web_editor: ctrl+a container should be an element
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

closes odoo/odoo#136499

X-original-commit: e6fac045282465960c0e4a7ecbbbb5e5ac8dff92
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Damien Abeloos (abd) <abd@odoo.com>
2023-09-25 15:20:26 +00:00
Rodolpho Lima 196cf4a7ce [FIX] web_editor: update UI on link content change
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
2023-09-25 11:30:13 +00:00
Rodolpho Lima e881bc6284 [FIX] web_editor: Link(Dialog/Tools) label input field
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
2023-09-25 11:30:13 +00:00
Rodolpho Lima 7fe1731c66 [FIX] web_editor: update link content on URL change
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
2023-09-25 11:30:13 +00:00
Rodolpho Lima b622dba6db [FIX] web_editor: 'mailto' to 'http' link conversion
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
2023-09-25 11:30:13 +00:00
Rodolpho Lima 02add8e5de [FIX] web_editor: auto transforming email URL
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
2023-09-25 11:30:13 +00:00
Rodolpho Lima 832b945837 [FIX] web_editor: link update on label change
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
2023-09-25 11:30:13 +00:00
Rodolpho Lima 5f7c4dda1d [FIX] web_editor: persist URL-like text transformation to link
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
2023-09-25 11:30:13 +00:00
Rodolpho Lima 37ac0ba83d [FIX] web_editor: toolbar setup in website
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
2023-09-25 11:30:13 +00:00
Adnan Saiyed 859714e5f6 [FIX] web_editor: traceback when clicking button in table
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

closes odoo/odoo#135324

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-25 09:38:32 +00:00
hmai 8dfe8a8c6c [FIX] web editor: color of whole cell should change
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

closes odoo/odoo#130646

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-25 09:38:31 +00:00
abd-msyukyu-odoo 576afb3f27 [FIX] web_editor: reset MoveNodePlugin when switching record
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

closes odoo/odoo#135464

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-22 15:06:02 +00:00
Jinjiu Liu dfeb387b0e [FIX] website: suggest links breaks rpc
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
2023-09-19 16:37:15 +00:00
Rodolpho Lima 26f447a072 [FIX] web_editor: missing record info for converted images
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

closes odoo/odoo#135806

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
2023-09-18 23:31:39 +00:00
Rodolpho Lima 00701977ad [FIX] web_editor: skipped image conversion to attachment in HtmlField
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
2023-09-18 23:31:39 +00:00
Benjamin Vray b9c0d9f780 [FIX] web_editor: fix oi icons css for editor panel
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

closes odoo/odoo#135330

X-original-commit: 3729cf6ab4261a29431ef05fcb7cc33ba5e3ad5a
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
2023-09-15 09:22:07 +00:00
Arthur Detroux (ard) 26218171a8 [FIX] web_editor: fix images getting absolute URLs in grid mode
[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/cc406afcea7bf5846233a9f97a4a8ac5f618f3ec

closes odoo/odoo#135392

X-original-commit: 3528f2c3f9d3b30266f3421672986d202c724a76
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-09-14 20:34:54 +00:00
Sébastien Geelen (sge) 639a2b2296 [FIX] web_editor: open DPH in mail template
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

closes odoo/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>
2023-09-14 11:22:50 +00:00
hmai 573c59cad2 [FIX] web editor: animation triggered on every backspace
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

closes odoo/odoo#135332

X-original-commit: cef24b89405205ee0484555209e59a8599d9deb2
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-13 15:34:42 +00:00
Julien Banken 95e6d0199b [FIX] web_editor: video selector component adjustments for Knowledge
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

closes odoo/odoo#127452

Related: odoo/enterprise#40683
Signed-off-by: Damien Abeloos (abd) <abd@odoo.com>
2023-09-13 15:34:27 +00:00
hmai f567a8ef8a [FIX] web_editor: clear format button always visible
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

closes odoo/odoo#135293

X-original-commit: 78d3e1c327e81a1fddbe068860eeec498af29b89
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-13 13:49:37 +00:00
Rodolpho Lima d72e471e5f [FIX] web_editor: extra history step on image paste
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

closes odoo/odoo#134832

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-13 13:49:36 +00:00
Samuel Degueldre 239d8c0a06 [FIX] website: fix editor unable to open with filled date field
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.

closes odoo/odoo#134493

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-12 17:16:18 +00:00
Robin Lejeune (role) 03bea918ba [FIX] web_editor: remove regex look-behind for browser support
Commit [1] used a regex with positive and negative look-behind
assertions, which is not supported before Safari 16.4 [2].
This commit rewrites the regex with a more widely supported syntax.

[1]: https://www.github.com/odoo/odoo/commit/73317cb
[2]: https://caniuse.com/js-regexp-lookbehind

task-3497427

closes odoo/odoo#134658

Signed-off-by: Colin Louis (loco) <loco@odoo.com>
2023-09-11 21:12:43 +00:00
Aaron Bohy 0d7acf60b4 [REF] *: remove legacy Markup
Use owl.markup instead.

Part of task~3439226

closes odoo/odoo#134793

Related: odoo/enterprise#47124
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-11 19:13:59 +00:00
David Monjoie 524dc07d8e [FIX] web_editor: fix url regex on Safari iOS
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/a42a19e484d63cebeaed10b75ac20e507ff85d56

closes odoo/odoo#134943

X-original-commit: ff99e454e2a38ae54aa57cb0df80df139e921ccb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-08 21:39:39 +00:00
Géry Debongnie e0fdb6a0b4 [IMP] *: rewrite module loader
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

closes odoo/odoo#128502

Related: odoo/enterprise#44100
Signed-off-by: Bastien Pierre (ipb) <ipb@odoo.com>
2023-09-08 16:47:56 +00:00
Michael (mcm) 36061a4ab0 [IMP] web: simplify owl_compatibility
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.

closes odoo/odoo#134295

Task: 3439226
Related: odoo/enterprise#46899
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-08 11:12:39 +00:00
Michael (mcm) 290a9b9055 [IMP] web_editor,*: use dialog service
*: 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
2023-09-08 11:12:39 +00:00
Louis (loco) 0d608e80b9 [FIX] web_editor: optimize the width and format of shaped image
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

closes odoo/odoo#133517

Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
2023-09-08 09:47:03 +00:00
Aaron Bohy dc680a4429 [REF] web,*: stop using and remove legacy utils
*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

closes odoo/odoo#134620

Related: odoo/enterprise#47044
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-08 08:29:58 +00:00
hmai 0c49049aef [FIX] web editor: cursor jumps out of blockquote
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

closes odoo/odoo#134700

X-original-commit: 8195beacbd878c56bc93290bc03665e30667e177
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-07 14:45:31 +00:00
Nicolas Bayet 661705da13 [FIX] web_editor: update link url regex
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

closes odoo/odoo#134660

X-original-commit: 0327ed28e855c89f9c13266c4aba5c99d80263ac
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-07 14:45:28 +00:00
Nicolas Bayet 52a1f267b7 [IMP] web_editor: drag and drop nodes within the editable
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

closes odoo/odoo#105179

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-07 14:45:18 +00:00
Nicolas Bayet 4c71662c95 [REF] web_editor: convert SmoothScrollOnDrag into a regular class
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
2023-09-07 14:45:18 +00:00
Nicolas Bayet e47b07f4ef [REF] web_editor: prepare absolute containers for the movable node
- 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
2023-09-07 14:45:18 +00:00
Nicolas Bayet d0ab79a296 [REF] web_editor,mass_mailing,website: make closestElement support predicate
To improve the api, make closestElement take a predicate as an
argument.

task-2984709

Part-of: odoo/odoo#105179
2023-09-07 14:45:18 +00:00
Pierre Pulinckx (pipu) 038169ee9f [REF] web: simplify assets loading
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

closes odoo/odoo#134520

Related: odoo/enterprise#47001
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-09-07 09:00:28 +00:00
Adnan Saiyed 84276cbd63 [FIX] web_editor: unexpected copy paste behaviour of link
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>

closes odoo/odoo#134516

X-original-commit: 1cc3354b88658620c15fa18427b8725b6215337d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-06 14:42:20 +00:00
Guillaume (gdi) 620cf19574 [FIX] website, web_editor: allow to re-edit social media icons
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
2023-09-06 11:50:58 +00:00
Nicolas Bayet 0d4d0409ec [FIX] web_editor: ensure the bus is available
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

closes odoo/odoo#133477

Related: odoo/enterprise#46479
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-09-06 11:50:50 +00:00
Sébastien Geelen (sge) bfa3090be2 [FIX] web_editor: delete behavior before table
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

closes odoo/odoo#125211

closes odoo/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>
2023-09-06 05:53:48 +00:00
Sébastien Geelen (sge)andAashish Thakur 8c481c7b8e [FIX] web_editor: delete behavior in LI
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>
2023-09-06 05:53:48 +00:00
Sébastien Geelen (sge)andSanjay Sharma d8d30bc7b1 [FIX] web_editor: backspace should keep current node
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>
2023-09-06 05:53:48 +00:00