Commit Graph
2225 Commits
Author SHA1 Message Date
Sébastien Geelen (sge) 3275d19415 [FIX] web_editor,website_sale: monetary field UX fix
The forced selection of the entire text value was preventing the user
from changing the selection after the initial click inside the monetary field.

task-2679088

X-original-commit: d33d55aad46c9223192d15c01b7516340be77cce
Part-of: odoo/odoo#80071
2021-11-19 10:42:06 +00:00
Sébastien Geelen (sge) 54d2099c43 [FIX] web_editor: fix linting errors
X-original-commit: 00cc4681ebc787227e9740da1cb61060ec46158c
Part-of: odoo/odoo#80071
2021-11-19 10:42:06 +00:00
Benoit Socias d2f30d1109 [FIX] web_editor: avoid error popup when saving incomplete link dialog
Before this commit saving an incomplete link dialog triggered the
display of a stacktrace error popup.

After this commit saving is cancelled when an attempt at saving an
incomplete link dialog is done. The incorrect fields already did display
their error status.

task-2675252

closes odoo/odoo#80043

X-original-commit: 47f0596233c2d8a09d91cdfae117aa3f595bb6bf
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-11-18 18:45:35 +00:00
Nicolas Bayet 812115716e [FIX] web_editor: close link popover of removed links
Before this commit, the link could be removed from the DOM
before hiding the query popover. After being removed, the
reference of the popover from the jquery element was lost.

We now keep the reference to the popover to always be able
to hide it.

Task-2684819

closes odoo/odoo#79943

X-original-commit: 72c46aef751ebc0de3873c644e3b159ffa349d1e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-18 18:45:03 +00:00
Nicolas Bayet c9f1e56d87 [FIX] web_editor: prevent traceback when droping undroppable snippet
When trying to drop a snippet that could not be possibly dropped,
a traceback is shown but shouldn't.

Task-2692492

closes odoo/odoo#79924

X-original-commit: 4408dbaf74aa26272b6ed3ce718a2d915975d4b3
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-18 18:44:55 +00:00
Nicolas Bayet eb523fda3b [FIX] web_editor: use text url by default in link dialog
On an html field whenever selecting only text that contain an url
and opening the link dialog, the url was not reused.

Task-2580485

closes odoo/odoo#79923

X-original-commit: 8049c7cf937aec02fe0097ee4f233e2e76fb8ae3
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-18 18:44:51 +00:00
Nicolas Bayet 553906853b [FIX] web_editor: remove button tooltip of link tooltip
Whenever the link tooltip hide, the tooltip of the buttons
could remain in the page but shouldn't.

Task-2692301

closes odoo/odoo#79922

X-original-commit: 5a5fce48852a6ac2a60db205e99d49e2095d1730
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-18 18:44:46 +00:00
Younn OlivierandMatthieu Stockbauer aba31e9f2d [IMP] web_editor, website: add connector options to steps snippet
A new option StepsConnector is added to the steps snippets, allowing to
pick the type of the steps connector and its color.

The option listens to changes in the UI or in the columns size to
recompute the width and position of the arrows.
The width of the connector is computed based on the widths of the
current step and the next step, which are defined in bootstrap columns.

The s_process_steps snippet CSS version is now 001.

task-2463009

closes odoo/odoo#77282

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Matthieu Stockbauer <tsm@odoo.com>
2021-11-18 16:00:40 +00:00
Younn Olivierandqsm-odoo b71b784c98 [FIX] web_editor: fix logo poor quality
This commit fixes and improves the suggested width that we compute for
images optimizations.
Before, images displayed outside .container elements were resized to
their container size. As a result logos were resized to 2.5rem (40px).

Now, it handles these scenarios :
- The image is in the navbar, it is a logo
- The image is in a container/container-small
- The image is in a container-fluid
- The image is outside a container

Values are read from the css instead of being hardcoded.

Note: another issue remains with our resizing method. Drawing on a
canvas is not performant enough when there are large differences between
the width and the resize width. A solution could be to use
createImageBitmap for the resize, but it is not supported by enough
browsers.
In the meantime, imageSmoothing was enabled on the context.

Note 2: this also fixes rounding issues when computing the optimized
width which may break the UI update as comparing the integer and
floating value returned false.

task-2506205

closes odoo/odoo#79983

X-original-commit: 8355c10676e1dbb668702337863218bdda7c23dc
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-11-18 10:06:25 +00:00
Tom De Caluwé 4fd5fd4a97 [FIX] web_editor, website: fix removal of last item inside active slides
A bug currently makes the carousel snippet collapse/disappear when its
active contents are removed. This happens because after the removal,
the carousel no longer has an active item.

The solution that was chosen was to not allow the removal of slides
unless using the dedicated option which is there for that. This solution
has the advantage to also allow users to create empty slides (using a
background image for example) by simply removing the columns inside.

Note: Newly created carousels will include the oe_unremovable class on
their slides. As such they will no longer depend on isEmptyAndRemovable
checking them for having a carousel-item class on the parent.

task-2506165

closes odoo/odoo#79892

X-original-commit: 0cf36a227e7b90fb64b1bc8024de813894d10d14
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-11-16 19:21:14 +00:00
Siddarth Gajjarandqsm-odoo f23ef1e6be [FIX] web_editor: fix drag & drop with restricted editor access rights
task-2345098

closes odoo/odoo#79851

X-original-commit: cd051046c191f9f4cd6df4627319931720ceb257
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-11-16 16:58:00 +00:00
Sébastien Geelen (sge) 3a02d3970d [FIX] web_editor: remove warning on save
Pop-up warning was appearing when saving website pages.

task-2666177

closes odoo/odoo#79842

X-original-commit: 2b35640d9e1fb7f037eee1983a19876879936d67
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-16 13:03:17 +00:00
Nicolas Bayet 2706f6d7af [FIX] web_editor: prevent re-rendering of linktool
Before this commit, the linktool was re-rendered clicking on
same link twice.
If between click, the some property of the link changed, they
were lost after the linktool being needlessly re-rendered.

Task-2691483

closes odoo/odoo#79820

X-original-commit: 110790cb2482367867dbc0bdaa97ad0e224a3d1e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-16 10:49:39 +00:00
Nicolas Bayet 55cd20db47 [FIX] web_editor: not override root on website
Before this commit, if the editor was initiated as a simple
editor rather than the website editor (eg. the editor in the forum or profile)
the $root of the wysiwyg was wrongly assigned to #wrapwrap rather
than the $editable.

Subsequent binding (eg. LinkPopover) was bound to too many elements
which generated incorrect behaviors (eg, link popover on triggered on every
links).

Task-2691117

closes odoo/odoo#79810

X-original-commit: 58c1b04de1ec9179b940ee930984a232bb5de30d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-16 10:02:37 +00:00
Nicolas Bayet a101887f66 [FIX] web_editor: remove overlay of link
Before this commit, in the website builder or in mass_mailing, when
creating a link then hitting enter, then click somewhere in the page,
the outline was not removed from all the links.

In mass mailing, the overlay was never removed. Not even upon save.

Task-2682176

closes odoo/odoo#79634

X-original-commit: 71325540712342ef8f251a37ee29270bd3b87469
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-16 10:02:33 +00:00
Nicolas Bayet 12953e98b9 [FIX] web_editor: avoid scroll on undo/redo
When performing undo/redo on some page, because some unneded mutation
get recorded, the page scroll to another location (either up or down).
This commit add a mechanic that filter out thoses unnecessary mutations.

task-2667885

closes odoo/odoo#79620

X-original-commit: 125730ffd9322d34ef1c7d8d0298457de3e65f90
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-16 10:02:29 +00:00
Nicolas Bayet ebb4d39571 [FIX] web_editor: activate the redo button when needed
Because the `_historyStepsStates` was not fully set at the time of
calling `historyStep` in `historyUndo` or `historyRedo`, the listener
for the event "historyStep" was triggered to early and `historyCanRedo` at
that time could not possibly be accurate.

This commit call `historyStep` after setting all ids in
`_historyStepsStates`.

task-2667885

X-original-commit: 659b530516e13df77eed6254b81e72b8009a71bf
Part-of: odoo/odoo#79620
2021-11-16 10:02:28 +00:00
Sébastien Geelen (sge) c3bff57df2 [FIX] web_editor: avoid onbeforeunload pop-up issue
Remove onbeforeunload pop-up if editor has no snippet.
This fix pop-ups wrongly showing outside website editing.

see: #79731

task-2666177

closes odoo/odoo#79781

X-original-commit: 2f587eea4eea947597f0c4f7e5473c08e2175bcd
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-15 15:54:42 +00:00
Nicolas Bayet 6f972d9f9c [FIX] web_editor: undo after dropping a snippet
The commit 1b80fe9b56acea09a6784691561df65fe6349f50 made impossible
to undo after dropping a snippet.

Task-2688104

closes odoo/odoo#79649

X-original-commit: 92b1f78e8de6c343a9d1ef19459522b868cf108f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-15 11:22:34 +00:00
Nicolas Bayet 8087bd00e8 [FIX] web_editor: allow to move snippets
As an oversight of 2185e89e3f2a15b98b9cb8c3371a6031f9a6f055, it became
impossible to move snippets.

Task-2688281

closes odoo/odoo#79648

X-original-commit: f76ba944c516a0377cec324f564df604e52c2ffd
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-15 11:22:30 +00:00
Nicolas Bayet b6ea6d14d2 [FIX] web_editor: enable selection under toolbar triangle
In the editor, there was a little spot where it was impossible to
click in order to select a text.

Task-2684378

closes odoo/odoo#79642

X-original-commit: 02c0cce926b1252596f10299597a9c984a8341ac
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-15 11:22:26 +00:00
Nicolas Bayet 34d0f92a78 [FIX] web_editor: wait untill colorpicker is inserted
Before this commit, an update to the colorpicker could be called
multiples times with a `colorpicker` not yet in the document.

If a colorbpicker has been created, we need to await it's start method
to be fully resolved.

Task-2667983

closes odoo/odoo#79641

X-original-commit: 105208c8363f77130ee644ce8ec2e993d9955763
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-15 11:22:22 +00:00
Nicolas Bayet 7146a6fbf4 [FIX] web_editor: have correct linkPopover reference
Before this commit, the reference of the linkPopover was
the last popover being created which is not what this property
is supposed to correspond to. It should correspond to the latest
opened linkPopover.

Without this fix, the code that want to act on the last linkPopover
would not work as expected (e.g. `this.linkPopover.hide();` in
`_onSelectionChange`).

Task-2667983

X-original-commit: d1abbc9d66a5858c771fa643f8c73990e8f14792
Part-of: odoo/odoo#79641
2021-11-15 11:22:21 +00:00
Nicolas Bayet f726f40d25 [FIX] web_editor: prevent link o_default_snippet_text
Whenever a link is being manipulated through the link tool,
the classes are being saved before the manipulation. However,
the class `o_default_snippet_text` is removed in the meantime.

Because we never want that class after the manipulation, this commit
systematically remove it.

Task-2667983

X-original-commit: f82f004e1e1439c38a09d5eb0fded5197e058c1b
Part-of: odoo/odoo#79641
2021-11-15 11:22:21 +00:00
Nicolas Bayet 93537cf82a [FIX] web_editor: allow to select a link already selected
Before this commit, selecting a link was not working all the time.
This commit allow to properly select a link all the time.

Task-2667983

X-original-commit: 8c90772470046d0b932443ac7b2c2a868c443a85
Part-of: odoo/odoo#79641
2021-11-15 11:22:21 +00:00
qsm-odoo 1ebc7c301b [FIX] web_editor, website: fix onFocus/onBlur flow + add test
The flow has been broken multiple times across the years. Let's add a
test in all stable versions.

For the 14.0 forward-port, the test came with a fix which restores the
13.0 flow which we tried to change in 14.0... but only ended up broking
it. Indeed, with [1], the 13.0 was fixed. And, with [2], we tried to
simplify the flow... but the explanation given by the commit is just
wrong: the flow was just broken and the simplification that was to be
done in fact practically never occurs. The more the reason to add a
test, proving how the flow is working. The simplification may be done
someday but not sure it is really worth it.

For the 15.0 forward-port, another fix was needed because of [3] which
introduced a bug which makes the onBlur method be called multiple times
when hiding a whole editor hierarchy.

[1]: https://github.com/odoo/odoo/commit/076992bdf099f3a645c9a1ef6df2cdcccbf1c2b2
[2]: https://github.com/odoo/odoo/commit/5c007305c9998ade32c6677cac5552101c3a96af
[3]: https://github.com/odoo/odoo/commit/806a8db35b5e0e6a461422f5bba7c97180c3ef29

closes odoo/odoo#79734

X-original-commit: 0acc5e784b15d9c963660da3781763448503f33e
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-11-14 21:40:48 +00:00
Sébastien Geelen (sge) 287913ebbf [FIX] web_editor: fix translate button position
The translate button was overlapping the codeview button
in the mail template view.

task-2683847

closes odoo/odoo#79704

X-original-commit: 8a6de9089bfd77f5fdc6f4a11016906454e442cc
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-12 13:35:54 +00:00
Nicolas Bayet e68a9d37dc [IMP] web_editor: allow to use link popover everywhere
Before this commit, the link popover was only available in the website
builder. Now it is available anywhere the wysiwyg is used.

Task-2678412

closes odoo/odoo#79542

X-original-commit: 161c5fc8e742294e8d85c889b4bf8d3d8cd484f5
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-09 14:00:56 +00:00
Sébastien Geelen (sge) 90f0df32ac [FIX] web_editor: stop passing variables to _t function
Some variables were used in _t function instead of raw strings.
One string was not translated properly.

task-2686066

closes odoo/odoo#79505

X-original-commit: 7c5b475532dca1efea5599fb5a3f61ea646d8267
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-08 13:24:33 +00:00
Nicolas Bayet d5a031a9a3 [FIX] web_editor, website: only save dirty element
Before this commit, when inserting a new snippet or moving a snippet
that was already in the page would temporarily create hooks (`we-hook`)
in the page. The insertion of thoses hooks would trigger mutation
in the dirty observer (observer defined in edit.js) and mark all
oe_structure for which a hook was temporarily inserted.
Thus, creating unnecessary views in the backend.

Now, the code skip the mutations of the drag and drop hooks.

Task-2567752

closes odoo/odoo#79394

X-original-commit: 1b80fe9b56acea09a6784691561df65fe6349f50
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-08 10:15:56 +00:00
Sébastien Geelen (sge) 66851b042c [FIX] web_editor: fix the beforeunload warning
The warning shown on beforeunload when quiting a page during edition
was missing since the new editor merge.

task-2666177

closes odoo/odoo#79325

X-original-commit: 6a7fa263e72de45d2e92c436321c01c4b70870a8
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-03 16:44:40 +00:00
Hubert Van de Walle (huvw) 5f2c143623 [FIX] web_editor: don't show the active style entry if absent
Steps to follow

  - Edit a report with studio
  - Add an inline text element
  - Select it
  - Select the text in the sidebar
  -> An error is raised

Cause of the issue

  firstButtonEl is undefined because the style section is not always
  present in the toolbar

opw-2674302

closes odoo/odoo#79335

X-original-commit: 45b590d8961d56f8d207c22efbf1ba7188a3b1fa
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2021-11-03 16:02:11 +00:00
Nicolas Bayet bd8260b3f5 [FIX] web_editor: not showing toolbar in theme tab
In the website builder, the toolbar was appearing in the theme tab
incorrectly.

task-2664956

closes odoo/odoo#79311

X-original-commit: a2198490befddb8c4cc6f3a543f47bbffe243f64
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-03 12:38:59 +00:00
Hubert Van de Walle (huvw) 957ae2b84a [FIX] web_editor: resize the codeview with the field_html resize handle
Steps to follow

  - Go to email templates
  - Select some text
  - Click on the code button
  - Resize the editor
  -> Nothing happens

Cause of the issue

  The default view of the editor is resized but not the code view

Solution

  Change the code view height with the default view

opw-2669259

closes odoo/odoo#79315

X-original-commit: 3adc1ddb04dfc0dcd3b10e56e9ecaef7b04a18d4
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2021-11-03 11:48:51 +00:00
qsm-odoo 41d9546061 [FIX] web_editor: add perf. optimization when toggling editor options
This allows to avoid tens of thousands of instructions being done at
each click in the editor.

At multiple places, the editor is asked to close all its widgets (for
example, when clicking on another snippet to edit). The original cost
of that action was to remove a class on each widget, which is a very
primitive action. But in the end we had to do more to close a widget: we
trigger_up an event and ask to close all sub widgets. When we ask the
editor to close all widgets... it makes sense not letting every sub
button of every select trigger_up an event.

closes odoo/odoo#79220

X-original-commit: 7aaf0e17f9c3d4e78b975dbd3747513d186ccc1e
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2021-11-02 09:58:51 +00:00
Anh Thao Pham (pta) 5e3f143f1c [FIX] web_editor: prevent editing document in iframe with cross-origin access issue
- Go to Email Marketing
- Create a new mailing with template having social media links
- Save
- Click on one of the social links
An error is triggered:
"Error: Blocked a frame with origin xxx from accessing a cross-origin frame."

The traceback occurs because we try to change the content of something we
don't have access to, as these sites prevent display in an iframe.

opw-2599540

closes odoo/odoo#79208

X-original-commit: 9702e541f27616a5249a140878d028335a0b3775
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-10-29 16:05:30 +00:00
Didier (did) 1afcc9c368 [IMP] bus, mail, *: improve longpolling bus notification format
* = auth_signup, calendar, im_livechat, snailmail_account, survey, test_mail,
    web_editor, website_crm_iap_reveal, website_livechat

The aim of this PR is to improve/fix various flaws and limitation of the current
API, to make it easier to use and more efficient.

Notification are now defined with 3 distinct parts:

- the channel determines which client(s) should receive it
- the type determines how it should be handled
- the payload determines any extra information helpful for handling it

Channel
=======

Business code
-------------

- Record channel is introduced for ease of subscribing to and sending
  notifications to specific partners, channels, documents, ...
- String channel is still supported (but it is converted internally to the tuple
  channel).
- Tuple channel is still supported without any change (but should be avoided
  whenever possible due to its complex syntax).

The channel is no longer sent to the client. When the channel was used for
business purpose, the information it contained has been moved into either the
new type, or the payload itself.

Technical note
--------------

All channels are now internally converted to the tuple (db, ...) channel, which
is necessary for the platform code (saas/sh).

Internally, the bus.bus table is not changed, type and payload are grouped
together into what was (and still is) called message.

Type
====

Type is introduced to uniformize the way notifications are sent and handled.
All existing notifications already had some kind of manually-built type in them.
This is now officially supported at the bus API.

In client code this will allow (to be done in future commits) to register one
handler per specific type, instead of having to iterate and to filter all
received notifications on every handler.

Payload
=======

Payload (ex message) did not change, it can still be anything depending on
business needs.

Few adaptations:
- When the type was included on the payload, the type has been moved to the new
  type parameter.
- When the channel was used in business code, its data has been copied into the
  payload.

task-1891151

closes odoo/odoo#79201

X-original-commit: 543af27c7d6836ffac9e80ff8490b6ddbd849221
Related: odoo/enterprise#21998
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-29 16:05:23 +00:00
Benjamin Vray f534d20674 [FIX] web_editor, *: fix active class disappearing on tabs snippet
* = website

Before this commit, the active class of the tabs snippet buttons
disappeared when leaving the edition of the buttons.

After this commit, it is no longer possible to enable link options for
the buttons of the tabs snippet and accordion snippet. Being able to
customize these buttons introduces too many bugs and is not really
necessary.

task-2656662

closes odoo/odoo#79190

X-original-commit: 7f33cdcd14ef753cc5bf823bfc1de0d2431e285a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-29 12:39:58 +00:00
Nicolas Bayet 0f668e28bf [FIX] web_editor: allow non editable to be unbreakable
When starting the editor in a web page, if there is no content, the
oe_structure is not editable. Adding snippet at that moment will
trigger `idSet` on the node with isUnbreakable returning `false` for
the node that is unbreakable because of the check
`!node.isContentEditable` in `isUnbreakable`.

When setting the ouid for the first time with `idSet`, `getOuid` is
called with `optimize` to `true`. So all the ancestor of a node that
should be unbreakable will have the wrong ouid.

Performing any command to a node with a wrong ouid is suceptible to
wrongly be reverted.

By removing `!node.isContentEditable`, the node will have the proper
ouid in case an ancestor is not editable.

task-2633368

closes odoo/odoo#79108

X-original-commit: 13804df7740317b8198e7c1de418ff019c05862b
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-28 07:49:29 +00:00
Nicolas Bayet 3c80860110 [FIX] web_editor: properly remove hint on mass_mailing
Before this commit, the editor hint were not properly
removed because the queryselector was made on
the wrong document.

Task-2678410

closes odoo/odoo#79104

X-original-commit: d582f43d81cb570017ef6ff90159cdb6a7ff2874
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-28 07:49:25 +00:00
Nicolas Bayet e2763e0f8b [FIX] web_editor: use wrapper around video
When pasting an youtube url in the website builder, the iframe
was inserted without the wrapper used by the website builder.
Now we use the same wrapper as by adding a video through the
video modal.

task-2668224

closes odoo/odoo#79095

X-original-commit: 0cffd7fcdc631b95795d9d819197e5f91ed8195c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-28 07:49:21 +00:00
Nicolas Bayet 85b0845c65 [FIX] web_editor: poperly add youtube on website builder
In the website builder, when pasting a youtube url,
we can transform it to an iframe in the editor through the
Powerbox.
Adding the iframe did not remove the text in the website builder.
Now it properly remove the text in note and the website builder.

X-original-commit: a9c363cb2c6a88f7f4b1ef09b8a8f9caf39d8f32
Part-of: odoo/odoo#79095
2021-10-28 07:49:21 +00:00
Nicolas Bayet f950fd1190 [FIX] web_editor: wait editor loading in tests
In a undeterministic circumstance, an element in the editor
is not found. It might be because the check is done before the
editor is fully loaded.

The commit 46c22143b22e204e93c70b21d002eb179be34a33 tried to
wait 100ms, but the bug continue to appear.

This commit only perform the check when the editor is fully
loaded. If the undeterministic bug continue to appear, it means
that the cause is different.

Task-2678110

closes odoo/odoo#79078

X-original-commit: 930b6822961f1ffdd1198e1ab2fe52229e14a50d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-27 17:16:53 +00:00
Nicolas Bayet 403c06504d [FIX] web_editor: always show codeview button
When activating the editor code view, the button is hidden in
the floating toolbar. This commit always shows the button when
the codeview is activated for a particual html field.

Task-2672259

closes odoo/odoo#79072

X-original-commit: 66d706bbcc1cd49e69f58ac154eee2d6f2ec3628
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-27 14:01:47 +00:00
Nicolas Bayet e795186dec [FIX] web_editor: delete unicode character
Before this commit, when trying to delete one
unicode character (e.g. 😍), only one javascript character was delete
but one unicode character (e.g. 😍) could be two javascript characters
as the javascript string is coded in utf-16.

This commit fixes that by calculating the size of one unicode character
from the javascript string.

Task-2658890

closes odoo/odoo#79071

X-original-commit: fea5b87615077f5f41dec8c4d1480f157bbd26ae
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-27 14:01:43 +00:00
Antoine Guenet 218e9bb2aa [FIX] web_editor: prevent pasting blocks into paragraph-related elements
When pasting HTML, we have to be careful not to introduce invalid HTML.
The editor corrected for blocks within inlines but failed to prevent the
invalid pasting of blocks within paragraph-related elements
(eg., `<p><h1>text</h1></p>`). This fixes that issue by unwrapping all
blocks from the copied content when trying to paste within an element
that doesn't accept paragraph-related elements as children.

Notably, this fixes an issue that was caused by that problem, in which
pasted HTML content could not be saved because it was invalid.

task-2632676

closes odoo/odoo#79070

X-original-commit: 9c77834e03516f831a9600f0ba4131c957b3ba74
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-27 14:01:39 +00:00
David Monjoie 30c53a4370 [FIX] web_editor: fix traceback when clicking outside any snippet
This bug was introduced by
https://github.com/odoo/odoo/commit/2a7436d83abe178bd21c0694edc9825f5d70d65f.

closes odoo/odoo#79057

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-27 11:56:15 +00:00
Antoine Guenet 7dd6698bd4 [FIX] web_editor: properly display the state of list in the toolbar
When selecting text in a list, the toolbar should show that a list is
selected, and which type. It however failed to do that, which is fixed
with this commit.

task-2638422

closes odoo/odoo#77738

X-original-commit: 2a7436d83abe178bd21c0694edc9825f5d70d65f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
Part-of: odoo/odoo#79057
2021-10-27 11:56:15 +00:00
Nicolas Bayet 4c1c38bb85 [FIX] web_editor: allow iframe on website builder
On website, if an iframe was in the page, the iframe was removed
when calling the redo command of the insertion of the iframe (and
also other cases).
 The reason is because of a sanitization process that is usefull only
 in a collaborative context.

 This commit disable the sanitization when the collaboration is not
 active.

task-2670597

closes odoo/odoo#79056

X-original-commit: 2b9595a1f2d8ee1c019751d4cb080fe9b9f4c05c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-27 11:56:10 +00:00
xO-Tx ce3b09dff2 [FIX] web_editor: fix empty save on dialogs
I- mediaDialog/linkDialog:

1- Website editor > Add image/link using "/" commands.
2- The mediaDliaog/linkDialog will be shown to select item.
3- Click on "Add/Save" without selecting any image/setting
   any link.
4- traceback.

II- mediaDialog (Video):

The same flow for videos will add an empty <iframe> (with
no src specified) to the DOM.

The goal of this commit is to prevent this behaviour
by adding a test on values passed to the 'save' event
listeners.

task-2628964

closes odoo/odoo#78967

X-original-commit: 1e5c7d6f3525823101215cb18b44d2b936c9c521
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-26 07:48:10 +00:00