Commit Graph
3737 Commits
Author SHA1 Message Date
Rodopho Cammarosano de Lima (rcdl) 9fe9df4df4 [FIX] web_editor: wrap table options in _t()
Text content of table buttons (move left, insert right, etc) are missing
the _t() in order to become translatable strings.

task# 3054440

closes odoo/odoo#107430

X-original-commit: 8856a6b55f4c9a0d68576439a06f3a957dcfabeb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-15 09:34:49 +01:00
Antoine Guenet 8ed49e3e0a [FIX] web_editor: add history step when checking stars from stars widget
When clicking on a star from the (3|5)-stars widgets, the stars light up
in yellow to reflect a rating. We weren't making a history step when
this happened, meaning that an undo or a rollback of anything that
happened just after clicking, would undo that rating change as well.

task-3084709

closes odoo/odoo#107669

X-original-commit: d4d592350e0b887cc10cc540ab3e5e1b20600946
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-14 18:33:10 +01:00
Antoine Guenet edd48fc799 [FIX] web_editor: properly handle selection in nested table
Custom table selections going through nested tables weren't working as
expected.

closes odoo/odoo#107624

X-original-commit: 670b27d4f8b99a9650cf915025ccf304a095d7de
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-09 15:12:53 +01:00
Antoine Guenet 7c19e7389e [ADD] web_editor: multiline tab and shift+tab
This adds the possibility to remove leading tabulations with shift+tab,
as well as supporting tabulation and untabulation over multiple blocks.

task-2792099

closes odoo/odoo#100386

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-09 13:03:33 +01:00
Benoit Socias 55339cd6a7 [FIX] web_editor: prevent putting a table of content inside another one
Dropping a table of content inside another table of content triggers an
infinite loop of generated menu content updates.

This commit prevents dropping a table of content into another table of
content, be it from its thumbnail or from a previous location inside the
page.

task-2752391

closes odoo/odoo#107586

X-original-commit: 69ab750127ac65a24106deb47de3e4d2bf0cd0f5
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-12-09 11:49:01 +01:00
Arthur Detroux (ard) ddfb9c2186 [FIX] website: prevent tb when using a background video as cover
Prior to this commit, when using a background video on the cover of the
website_slides homepage (/slides), after saving, a traceback would
occur and the video would not be displayed.

Steps to reproduce:
- Install website_slide
- Go to /slides
- Enter edit mode
- Change the cover of the page by a video
- Save
- Traceback

The reason for that is that the cover snippet used on the homepage of
elearning is the root of an XPath instead of its own oe_structure. (This
was changed in 16.0)
[1] made it so that the style and class attributes are saved but did not
save any data attributes needed for the background-video widget to work.

This commit adds those data attributes.

[1]: https://github.com/odoo/odoo/commit/5b252215dc375526af87c31a32256dd1a9582f02

opw-3063043

closes odoo/odoo#107577

X-original-commit: 86dc4d4349d033c95c0e04e8c173f63e5e2044ed
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-12-09 11:48:56 +01:00
Soukéina Bojabza 6bd580f353 [IMP] web_editor: make the background grid visible on dark backgrounds
Before this commit, when dragging/resizing a grid item, the background
grid that appears was not clearly visible if the background color was
dark.

This commit adds a light line next to the dark background grid lines in
order to make them always visible. It also moves the CSS rule about the
grid cell inside the background grid rule, as it is more correct
like this.

task-3060593

closes odoo/odoo#107576

X-original-commit: 1aa81243b7c80069c576381e2f3b04281455794f
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-12-09 11:48:53 +01:00
Nicolas Bayet 34b1f71491 [FIX] web_editor: spellcheck properly on Safari
Before this commit, when using the spellcheck of safari, the selected
word was interpreted as the text "#" by the editor.

task-3093997

closes odoo/odoo#107563

X-original-commit: b8d1ff6bc39530e601baa29971bca720e2dd06cf
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-09 09:44:25 +01:00
Sébastien Geelen (sge) 9d1422f9d5 [FIX] web_editor: better command condition
Improve a condition to be more inclusive
and be truthy in some rare cases.

closes odoo/odoo#107545

X-original-commit: 51e37c00c749e6bf033317c612856d15daf6c39d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-09 09:44:23 +01:00
Antoine Guenet afbe0de46f [FIX] web_editor: paste a full table after copying custom-selected table
With the tables' custom selection in the editor, copy-pasting from a
table became awkward. This ensures that copying (from) a table in the
editor guarantees a valid table on paste.

task-3061274

closes odoo/odoo#107544

X-original-commit: 9730a1f1e0053cc9633faaf0ffb424ae373bbc38
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
2022-12-08 18:00:24 +01:00
Nicolas Bayet 569407d1a0 [FIX] web_editor: replaceMedia on contenteeditable
In website, clicking on the snippet option action "Relpace" did
not work for an icon inside s_social_media as s_social_media is
contenteditable false.

The code was simulating a double click on the icon to open the media
dialog but in the double click handler, a check is made to prevent
the media dialog to be shown if the contenteditable is false. This
is important for the knowledge app to prevent changing a button inside
a knowledge view.

task-3086881

closes odoo/odoo#107487

X-original-commit: 3339c50fbebca8a6d419df4ab14ef03952ea6635
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-08 13:38:19 +01:00
Antoine Guenet 0c2015ee0e [FIX] web_editor: prevent closestElement traceback with comment nodes
Comment nodes don't have a `closest` method so when passing one to
`closestElement`, the method crashed.

----

Step to reproduce in website:
- Go to debug mode and to website app
- Click on configuration > websites
- Select a website and in the `custom_code_footer` field add an HTML
  comment
- Go to the website and try to enter edit mode -> Crash

The same error will be visible if you simply enter edit mode and drag &
drop the "Code" snippet and enter an HTML comment inside it.

-----

Step to reproduce in marketing automation:
- Install marketing automation
- Click on a campaign > Add a new activity
- On the mail template field, type something > Create and edit
- Select plain text -> `element.closest is not a function`

----

task-3083797
opw-3081323
opw-3081278

closes odoo/odoo#107486

X-original-commit: 3a9177dd6a6f12f75d0df8146b692e3486f2467c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-08 13:38:17 +01:00
Rodopho Cammarosano de Lima (rcdl) ef41ffbb45 [FIX] web_editor: update z-index in CSS classes
Due to a change in Bootstrap, the tablepicker, the toolbar and the q-web
branching selector were hidden by modal dialogs.

In Odoo 15.0, the included Bootstrap version was 4.3.1, in which
.modal's z-index is set at 1050.

In Odoo 16.0, the included Bootstrap version is 5.1.3, in which .modal's
z-index is set at 1055.

Therefore, the previous z-index value of 1051 is now updated to 1056.

task# 3002456

closes odoo/odoo#107431

X-original-commit: 263137bcd38f788ff96d13d0810df4da13b72a19
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-07 22:48:45 +01:00
Chong Wang (cwg) eab341aec3 [FIX] core: drop mismatched and illegal model terms
The model terms translations assume the number of terms in each language of a
model_term translated field should be the same.
However, sometimes the assumption cannot be promised for sake of bad
translations

This commit
1. drops illegal model term translations while translating
2. drops mismatched terms at run-time in case the database has been contaminated

closes odoo/odoo#107373

X-original-commit: f9ab5ca3e99b2883ada18a8f6deb12d45608b43f
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-12-07 18:29:18 +01:00
luvi 60ac6be0d3 [IMP] web_editor: use of the useSpellcheck hook
This commit makes use of the spellcheck hook to only enable the spellcheck attribute
on the textarea element when needed (on focused element). Since form view are now
always displaying a textarea, instead of relying on a readonly state, the textarea
used by the HtmlField always displayed red underline on typos.

This means the UI can become difficult to read if there are multiple red lines in
the text.  Now, it is only present on focused textarea thanks to the useSpellcheck
hook.

This change can be noticeable in many apps, including notes from records and the
Knowledge editor.

A test has been added to verify that the hook enables/disables the attribute on the
contenteditable element used by the html editor..

task #2861428

closes odoo/odoo#106866

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-07 18:29:10 +01:00
Sébastien Geelen (sge) defce6b833 [FIX] web_editor: fix commands in inline
Some commands from the powerBox command bar were not working
properly in the e-shop product "terms and conditions" section.

This was due to the isolation of Odoo fields
inside the odoo editor as a all.
Those fields do not always have an editable block element
to apply the command on.

We disable some commands that should not be apear in this context.

We also remove a redundant command (separator) in website pages.

task-2962067

closes odoo/odoo#107174

X-original-commit: 3776faa178314c4df889f4c04cc3931f8bef225c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-07 15:32:04 +01:00
Benjamin Vray 4cd383175f [FIX] web_editor: prevent horizontal overflow caused by m2m widget
When a vertical overflow is triggered in the snippets menu, a vertical
scrollbar is added making the snippets menu slightly smaller. Most
widgets properly adapt their width, however the many2many dropdown
widget does not, causing a horizontal overflow and its associated
scrollbar.

Steps to reproduce the bug :

- Drag and drop the "text-image" snippet in a page.
- Click on the image in this snippet.
- Set the "visibility" option to "Conditionally".
- A horizontal scrollbar appears in the editor panel.

This commit adapts the CSS of the m2m widget to solve the issue.

task-2779530

closes odoo/odoo#107305

X-original-commit: de96c25a5ad94c524e129053ebbfcb10b020d069
Signed-off-by: Guillaume-gdi <gdi@odoo.com>
2022-12-06 14:34:42 +01:00
qsm-odoo dc140ef115 [FIX] web_editor, website: add cover/contain option for grid images
As a fix, this introduces a new option for images in grid mode. When an
image is alone in a column which later becomes a grid item, or when an
image is directly added as a grid item via the dedicated option, the
image used `object-fit: cover` so that when the image is resized as a
grid item, it fits the dimensions of the selected grid area.

This confused some users as the image did not appear the same depending
on the screen size. Indeed, if an image is set to take 5 columns as
width and 3 rows as height, it does not ensure the ratio in pixels to
stay the same depending on the screen size: the grid is always made of
12 columns (so the width of each column depends on the screen width),
while the rows are always 50px tall. We could enforce the ratio of grid
items to stay the same or limit the ratio loss by reducing the 50px
height on smaller breakpoints but that would actually increase another
problem: for colored text grid items, their text would more easily
overflow their fixed area.

In the end, using the grid mode is about compromises, even if it allows
to achieve nice things and to have more freedom. This commit although
adds a new option to mitigate the issue for images: users now have the
possibility to switch the default "cover" mode of grid images to
"contain": in that mode, the whole image will always be visible (and
thus keeps the same ratio) and is just "contained" in the grid area
which is selected as dimension.

opw-3069234

closes odoo/odoo#107172

X-original-commit: faf19ef7f87fc043fb9a814516e01b8eeafd9b61
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-12-06 13:34:59 +01:00
Soukéina Bojabza 7f8321aab0 [FIX] web_editor: display grid mode mobile view for higher screen sizes
When we are in grid mode, if we decrease the screen size small enough,
the display is back to `flex` and the columns are displayed one above
another (-> mobile view). However, the columns in normal mode do that
for screen sizes higher than the breakpoint set for the ones in grid
mode, which is inconsistent. Moreover, as the images have their
`object-fit` property set to `cover`, they become really deformed and
therefore do not look good.

This commit solves these issues by increasing the breakpoint at which
the grid mode switches to the mobile view, that is, from `md` to `lg`.

opw-3069234

X-original-commit: 1ec3c4726ea92452dfe091eac96bcc9f3fdfa589
Part-of: odoo/odoo#107172
2022-12-06 13:34:59 +01:00
Achraf (abz) a8d30764ae [FIX] web_editor: Fix MissingError traceback
A MissingError traceback that occurs in `_build_bus_channel_list` was
caught by Sentry. This error has been seen 1.3k times in the last 30
days from several customers.

The fix simply consists in checking if the document exists before
checking the rights on it.

Traceback:
```
MissingError: Record does not exist or has been deleted.
(Record: project.task(83,), User: 6)
  File "addons/bus/websocket.py", line 879, in _serve_forever
    req.serve_websocket_message(message)
  File "addons/bus/websocket.py", line 752, in serve_websocket_message
    service_model.retrying(
  File "odoo/service/model.py", line 134, in retrying
    result = func()
  File "addons/bus/websocket.py", line 767, in _serve_ir_websocket
    ir_websocket._subscribe(data)
  File "addons/bus/models/ir_websocket.py", line 38, in _subscribe
    channels = set(self._build_bus_channel_list(data['channels']))
  File "home/odoo/src/enterprise/16.0/spreadsheet_edition/models/ir_websocket.py", line 13, in _build_bus_channel_list
    return super()._build_bus_channel_list(channels)
  File "addons/web_editor/models/ir_websocket.py", line 33, in _build_bus_channel_list
    document.check_access_rule('read')
```

SAAS-K22 (sentry code)
opw-3086292

closes odoo/odoo#106982

X-original-commit: 9e4c5e427285b76000398476e9d923e7ea036a65
Signed-off-by: Achraf <abz@odoo.com>
2022-12-05 14:03:49 +01:00
Antoine Guenet e0aae26c4d [FIX] web_editor: show the correct alignment in toolbar when in link
The `align` command applies the alignment to the closest block of the
selected node. Bootstrap sets the default alignment of `.btn` to
`center` but we don't support links with a width that is larger than
their contents so that alignment is not visible. For these two reasons,
we want the toolbar to show the alignment of a link's closest block
rather than that of the link itself.

closes odoo/odoo#107155

X-original-commit: a3bb5b0c4b010b7583af1440cb65e889586636c8
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-05 10:07:52 +01:00
Antoine Guenet c94c19cc3c [FIX] web_editor: properly apply alignment to links
When the selection was in a link, the alignment buttons didn't work.
That is because they are supposed to align the parent paragraph, which
is temporarily in a contenteditable=false context when the selection is
in a link. This restores the context before applying an editor command,
and restores it afterwards.

task-3083748

X-original-commit: 0a4eb266b198e5e02a3325d063d07c0dd8af0148
Part-of: odoo/odoo#107155
2022-12-05 10:07:52 +01:00
Antoine Guenet f3ad331f64 [FIX] web_editor: check if closestElement returns element
`getInSelection` had a check that depended on `closestElement` returning
an element (and not `undefined` or `null`).

closes odoo/odoo#107061

X-original-commit: 0eeff8266ab1c3bdd15d4587aaf83e299811c3fa
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-02 10:11:23 +01:00
Antoine Guenet 73815629ef [FIX] web_editor: prevent toolbar flicker on preview icon color change
If you clicked on a pictogram, then previewed various colors for it by
hovering colors in the colorpicker of the toolbar, the toolbar started
flickering uncomfortably. That's because the selection was changed
at every color change, which was unnecessary.

closes odoo/odoo#107041

X-original-commit: f0ff5dc4bdaf5a1704f1af55d46b253e234712a4
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-02 10:11:15 +01:00
Antoine Guenet 6a9f783872 [FIX] web_editor: do not open text toolbar on change icon color
If you clicked on a pictogram, then changed its color with the text
colorpicker in the toolbar, the toolbar was replaced with the regular
text toolbar, even though what was being edited was the pictogram.
That's because the information of the last media clicked was lost in the
process.

task-3045166

X-original-commit: fa1c7e68eaa544445621ca7e7e2c647ffe857447
Part-of: odoo/odoo#107041
2022-12-02 10:11:15 +01:00
Nicolas Bayet acacdff5af [FIX] web_editor: reset the options of the editor
Before this commit, when the editor was reset through updateWidget, the
options were not updated.

closes odoo/odoo#107029

X-original-commit: ffd77cf6aee37f8912e1367f8f9ca2f6344e9577
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-01 18:31:10 +01:00
Antoine Guenet 091dfca6fb [IMP] web_editor: align editor columns with editable bounds
Columns added with the "columns" Powerbox commands should be aligned
with the editable element's bounds.

task-3001988

closes odoo/odoo#106747

X-original-commit: fb55f688f6be2211ebeea4ba431a06230c40fb6b
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-28 19:49:04 +01:00
Rodopho Cammarosano de Lima (rcdl) 3c12c5e939 [IMP] web_editor: add forceNewWindow to LinkTools
Upon instantiation of a LinkTools object, the forceNewWindow property is
now added to the options object. This allows us to take advantage of the
pre-exisiting mechanism to conditionally display the "open new window"
checkbox in the LinkTools widget
(odoo/addons/web_editor/static/src/xml/wysiwyg.xml:334).

The possibily of not having the checkbox in the DOM demanded a
modification of LinkTools._isNewWindow().

_isFromAnotherHostName(), being used by both LinkDialog and LinkTools,
was moved to their parent class Link.

task# 2789222

closes odoo/odoo#104923

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-28 14:51:07 +01:00
Nicolas Bayet 0340537152 [FIX] web_editor: check method addNeutralStyle
Because of css limitation, the child of a parent that define a
text-decoration cannot "neutralize" that decoration defined by its
parent with a css property (ie. the text-decoration cannot be
overridden).

When a block define an inline style or any tag that have a class, the
method `formatSelection` tries to "neutralize" the style by calling
`addNeutralStyle`. As it is impossible to "neutralize" the style for
underline nor strikeThrough, there is no method `addNeutralStyle`
defined for those properties.

Before this commit the method `formatSelection` was crashing because
`addNeutralStyle` was not defined.

Task-3002123

closes odoo/odoo#106635

X-original-commit: ce068a3113204dc558e69e88f1d2d778fa446c73
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-28 13:20:47 +01:00
Antoine Guenet b5af8198fa [FIX] web_editor: handle default_focus form attribute for html_field
When rendering a form view that has a truthy `default_focus` attribute,
the renderer looks for the element in its tree that has its `name` as
`id`. However in the case of `html_field` it couldn't find it since
`html_field` failed to apply that `id` to its focusable element (the
editable root). This adds the `id` to the editable root when rendering
the element in `wysiwyg`, and also directly applies `contenteditable` to
it so the `focus` method actually does what we expect it to, even though
we are waiting for `HtmlFieldWysiwygAdapterComponent` to be mounted
before actually instantiating the editor itself.

task-3073096

X-original-commit: 7e14e2a9c055f5b30b7510ffad994fa10196e34d
Part-of: odoo/odoo#106622
2022-11-28 13:20:41 +01:00
vishal padhiyar 1488a35c61 [FIX] web_editor: impossible to add signature at some times
Before this commit:

When we try to add signature from powerbox then sometimes it does not show
the signature.

After this commit:

Now when we try to add signature from powerbox then it will show the signature.

Task-2939080

closes odoo/odoo#106490

X-original-commit: 7d5f61abf8076ff77543844f6355907118e3729d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-25 10:52:10 +01:00
vishal padhiyar ff366852fe [FIX] web_editor: remove copy paste unwanted newline
Before this commit:

- When you try to paste text beside a text which is in code formate it
  puts the new text in new line with smaller font.

- When we try to paste text in code formate in new line then it will
  give a blank space below the pasted text

After this commit:

- when you try to paste text beside a text which is in code formate it
  puts the pasted text in new line with original fontsize.

- When we paste the text in code formate in new line then it will not give
  a empty line below it,

Task-2683455

closes odoo/odoo#106488

X-original-commit: bf7835e80ffa70236dca4b4b8fb4edb45d42f46a
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-25 10:52:07 +01:00
vishal padhiyar 12f2cd2d34 [FIX] web_editor: stuck after manual link creation
Before this commit:

When we try to create link manually and try to press enter cursor gets stuck.

After this commit:

Now when we create link manually and press enter cursor moves to next line.

Task-2745129

closes odoo/odoo#105968

X-original-commit: 4d14fa559b2ffcb768fa0a0a42b9b9eb2703a050
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-24 17:23:40 +01:00
Nshimiyimana Séna 445d4cd97c [FIX] web_editor: fix codeview toggle
### Steps to reproduce
* Enable Dev mode
* Open an email template
* Open Code View of the template
* Click the green button in the top right corner of the content box

You should be met with a traceback.

opw-3045759

closes odoo/odoo#106408

X-original-commit: 01fb9cab941d9055efbeac738490fe53a91ceccf
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-24 13:29:00 +01:00
Arthur Detroux (ard)andqsm-odoo 0a83f41d59 [FIX] web_editor, website: improve perf of color previews
Follow-up of [1].

After [2], color previews on the side panel would be changed by the
wysiwyg adapter. The adapter would add each block individually inside
the iframe and check its current styling to then add the style to the
color preview elements. This was performed many times (as color palettes
all have their own individual rendering of the color previews)
and slowed down the editor.

This commit improves that by relying on the copied variables introduced
at [3]. This removes the "re-render" of the color preview elements,
instead relying on styling rules and CSS variables which are initialized
when the editor is started.

[1]: https://github.com/odoo-dev/odoo/pull/1149#discussion_r900120846
[2]: https://github.com/odoo/odoo/commit/212a8bfdd21269b18054200b9e2585e1c95540d6
[3]: https://github.com/odoo/odoo/commit/a396f791da94d064d58cce15892e74f45d29b7b7

closes odoo/odoo#106366

X-original-commit: 7f5a9d040348048990b25c271875c77d2c314e4d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2022-11-24 11:08:39 +01:00
abd-msyukyu-odoo 51b5ee8d5f [FIX] web_editor, knowledge: prevent modification of data-oe-protected
Change class="oe-blackbox" to data-oe-protected="true" (same purpose), because
the name was decided in a rush before 16.0

When the editor history management and sanitization (sanitize.js) handle nodes
of an embedded view, OWL can become corrupted, which will lead to a traceback.

This commit uses the attribute data-oe-protected="true" to prevent
historyRollbacks or sanitization, and ensure that protected elements children
are removed during the cleanForSave operation.

The collaborative DOMPurify sanitization is untouched, for security reasons. To
properly use `data-oe-protected` in collaborative mode, a more complex
mechanism should be put in place to ensure that the protected element children
are properly reconstructed for each client, and that it is not part of the
collaboration. (i.e.: embedded view in knowledge do not support the
collaborative mode currently).

This commit also blocks the selection handling in tables which would be in a
data-oe-protected="true" node.

Task-3012552

closes odoo/odoo#106255

X-original-commit: 394e4fe567bb2eecbd0865de82914aa7396fde63
Related: odoo/enterprise#34245
Signed-off-by: David Beguin (dbe) <dbe@odoo.com>
Signed-off-by: Abeloos Damien (abd) <abd@odoo.com>
2022-11-23 11:26:12 +01:00
Rodopho Cammarosano de Lima (rcdl) 55fbb8d89a [FIX] web_editor: remove dot in powerbox commands
The dot (period) is removed from user-facing strings in powerbox
commands, and the corresponding msgid in .pot files are updated.

task-2901665

closes odoo/odoo#106032

Related: odoo/enterprise#34116
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-18 17:03:53 +01:00
vishal padhiyar e87a3b8d4f [FIX] web_editor: copy paste link keeps the old url
Before this commit:

When we try to copy paste link into another link then url of the old link does
not change and only lable change.

After this commit:

Now when we try to copy paste link into another link then the url of the link
changes with the label.

Task-2768541

closes odoo/odoo#105966

X-original-commit: ea1e410f4174d235609181bdba692a98e7381396
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-18 12:58:00 +01:00
Sébastien Geelen (sge) 0fbcf9a2cb [REM] web,web_editor,sms : remove legacy DPH
Remove the Dynamic Placeholder from the legacy Odoo field.

Introduce in 308f639e295fce07e4f34d6c76b35aab259e21ad
And migrate to be OWL compatible in #101768

Therefore the old code targeting legacy odoo field is unnecessary
and need to be cleaned.

task-3071417

closes odoo/odoo#105920

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-17 13:57:30 +01:00
Nicolas Bayet ad36d893e8 [FIX] web_editor: prevent disconnection from peer to peer
Before this commit, once a user was disconnected from internet (eg.
network failure, laptop screen closed), the code disconnected the user
from the peer to peer network and upon reconnection to the internet
network, the code did not try to reconnect to the peer to peer network.

This created a network partion in the peer to peer network each time
a user disconnected and reconnected to the internet network.

When there is a partition in the peer to peer network, the last subnet
to write to the record erased the changes of another subnet without
notification.

This commit prevent the code to disconnect from the peer to peer network
when there is any disconnection signal triggered.

closes odoo/odoo#105900

X-original-commit: 8bce8cd53d1c6da89fce8c2f8b64615168d45a0d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-17 13:57:25 +01:00
Antoine Guenet d23f06ae78 [FIX] web_editor: properly copy editor content
When copying some list items in the editor and pasting it back into it,
we lost their parent list, leading to paragraphs being pasted rather
than a list. This restores the list.

task-3050150

closes odoo/odoo#105386

X-original-commit: 2333d8470df2fac80247e6f39d740a29f1eeb561
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-14 15:21:12 +01:00
Antoine Guenet 0aa4b317cd [FIX] web_editor: handle the cut clipboard event within the editor
The feature of not altering pasted content that was copied from the
editor was not enabled for content _cut_ from the editor.

X-original-commit: d79ed0298a8366ca51b1ca54fe725c7a55860254
Part-of: odoo/odoo#105386
2022-11-14 15:21:12 +01:00
Antoine Guenet c7cb454a67 [FIX] web_editor: allow pasting nested lists
The class that Odoo adds to nested list items to display them nicely was
not whitelisted for pasting so pasting nested lists ended up looking
ugly.

task-3050150

closes odoo/odoo#105378

X-original-commit: edfc8f318529a7e513c5ef1631461a5dc0258d4f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-14 15:21:02 +01:00
Younn Olivier a377708436 [FIX] web_editor: fix pasting youtube videos from the editor
Before this commit, following this flow in the Website Builder:
- Enter edit mode,
- Drop a snippet with text,
- Paste a youtube video link,
- Click on the "Embed Youtube Video" option of the powerbox,
=> There is a traceback.

This is coming from the bad function calls in the Wysiwyg to create a
video node.
When [1] reworked the MediaDialog in owl, a first implementation was
done exporting some utils (saveVideos, videoSpecificMediaClasses). But
this implementation was not kept and later changed to use static methods
and properties on the VideoSelector class (createElements and
mediaSpecificClasses).

Unfortunately, the outdated util methods used in the Wysiwyg were not
changed, and it was breaking the youtube video instertions.

This commit changes the Wysiwyg to use the existing
VideoSelector.createElements and VideoSelector.mediaSpecificClasses
static method and property to fix this flow.

[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b

task-2687506

closes odoo/odoo#105475

X-original-commit: 4923c20c29170407d43908f983f2a168241f4817
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Younn Olivier (yol) <yol@odoo.com>
2022-11-09 18:06:56 +01:00
Jorge Pinna Puissant 4f24e34b39 [IMP] test_lint, *: eslint remove caughtErrorsIgnorePattern from no-unused-vars
Unused catch block arguments are now forbidden even when prefixed with an
underscore:  if the argument on the catch block is not needed, the use of the
optional catch binding is enforced.

Part-of: odoo/odoo#105433
2022-11-09 16:08:07 +01:00
qsm-odooandJulien Castiaux 0e8e5d4c0a [FIX] web_editor: restore shape on default images in themes
Website themes make customizations to the default snippets. In
particular, some are applying shapes on default images. To do that, the
customization is not applied on the image directly but by changing its
src to a special web_editor route in charge of automatically adding the
shape on whatever default image the configurator chose for this snippet.

Typically, in a snippet with an image whose src is:

/web/image/website.my_snippet_default_image

The src is replaced by the theme with:

/web_editor/image_shape/website.my_snippet_default_image/website/some_shape.svg

That controller/route crashed since [1], making those images blank
areas in pages generated by the configurator. Indeed, the image from
the filestore was accessed via `file_open` which only allows reading
inside the addons_paths.

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

closes odoo/odoo#105421

X-original-commit: d536e0a23cf0aa06c3ee13fb2c105e83201434e0
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Julien Castiaux <juc@odoo.com>
2022-11-09 15:04:03 +01:00
Sébastien Geelen (sge) edfa446fd5 [FIX] web_editor: block commandbar in non html field
Prevent the PowerBox command bar to open in (non html) Odoo field
embedded inside the editable zone.

task-3040872

closes odoo/odoo#105372

X-original-commit: cab3a9b9b89a6b1c0d430e5374feb2f963e466fc
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
2022-11-09 08:14:53 +01:00
Aaron Bohy 9db9dbd38a [FIX] web(_editor): protect RPCs from component destruction
The rpc service has a protection (when used via useService) that
prevents the returned promise from being resolved/rejected if the
component has been destroyed meanwhile.

However, as the FormView still uses the legacy BasicModel, all rpcs
done by its model do not go through our new rpc service. As a
consequence, before this commit, they did not benefit from the
protection. This caused a non deterministic issue in the main flow
tour.

This commit implements a similar protection as the rpc service, but
specialized for the BasicRelationalModel, which redirects all RPCs
done by the BasicModel.

This change highlighted two scenarios where we sometimes performed
RPCs (or could perform RPCs) on a destroyed component. This commit
fixes those as well.

X-original-commit: f613e916d5e8b465fc360e340094c09037450ff1
Part-of: odoo/odoo#105332
2022-11-08 15:56:08 +01:00
Antoine Guenet e3a364122d [FIX] web_editor: restore deleteForward versions of deleteBackward tests
Tests for `deleteBackward` with a non-collapsed selection should always
be repeated using `deleteForward` to ensure the behavior is indeed the
same for both. This was not the case for some of the tests.

task-3032817

closes odoo/odoo#105217

X-original-commit: 183246102406ccb4730ee2e11c8d42ccca6dce6b
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-08 09:41:07 +01:00
Antoine Guenet 8c42506648 [FIX] web_editor: properly handle deleteRange where tables are involved
Tables have their own custom selection in Odoo Editor, so rectangular
cell selection is supported. Selecting a whole row/column/table then
pressing delete/backspace removes the whole row/column/table. But just
selecting some cells should only empty them, which we failed to do,
resulting sometimes in broken tables.

The code to remove selected rows/columns/table was triggered when
pressing backspace/delete, which failed to account for cases where we
need to delete the range without pressing those keys (for instance when
typing a character). This moves that code to `deleteRange` so as to make
it the standard behavior when deleting a range that includes table
cells.

task-3032817

X-original-commit: fad5d2d7e241e22382a2f3dc0fd68eca741e59a7
Part-of: odoo/odoo#105217
2022-11-08 09:41:07 +01:00