Commit Graph
2916 Commits
Author SHA1 Message Date
b63ee52552 [FIX] *: remove scss 'extend' from dropdown components
This commit removes all the 'extend' initially introduced to avoid code
repetition and ensure visual consistency across Bootstrap and Owl dropdowns.

Despite achieving the desired results, using 'extend' in this context
was seriously impacting the bundle generation time, probably due to an
underestimated amount of Apps' legacy-code applied on these elements.

In order to achieve the same results, the chosen strategy is to add
Bootstrap default classes directly into Owl dropdowns.
Also, it moves code related to bootstrap dropdown in 'webclient.scss',
leaving 'core/dropdown/dropdown.scss' for Owl code only.

Due to the discrepancies between Bootstrap and Owl html
structure, the '.dropdown-item' class could not have been added
directly to Owl's '.o_dropdown_item' itself, without refactoring
the Dropdown component structure.

// ==== Bootstrap 4.6 default Structure ================================
<div class="dropdown-menu">
  <button class="dropdown-item" type="button">Action</button>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== OWL default Structure before this commit =======================
<ul class="o_dropdown_menu">
  <li class="o_dropdown_item">
     <span>Action</span>
  </li>
  <li class="o_dropdown_item">
     <a href="#">Another action</a>
  </li>
</ul>

// ==== OWL Structure after this commit ================================
<div class="o-dropdown--menu dropdown-menu">
  <span class="dropdown-item">Action</span>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== web.assets_backend.css Bundle Generation Comparison ============
With all modules installed (enterprise edition over runbot):
Before this commit, bundle took ~2.5s and ~4s to generate and weighted ~322kB (~2.5MB uncompressed)
After this commit, it takes between ~1.2s and ~1.6s and weights ~257kB (~1.6MB uncompressed)

closes odoo/odoo#77649

X-original-commit: 84715436d87bb05b421bc9ccaacda67d07571690
Related: odoo/enterprise#21370
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Stefano Rigano <sri@odoo.com>
Co-authored-by: François Georis <fge@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
2021-10-04 07:57:00 +00:00
qsm-odoo a54f11edb1 [REF] web_editor, website: remove some start15 compatibility code
With the forward-port at [1], it was forgotten to adapt the PR to
simplify the code that was added to support current start15 databases.

[1]: https://github.com/odoo/odoo/pull/77255

closes odoo/odoo#77630

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-01 20:42:07 +00:00
Benoit Socias 2e35193b94 [FIX] web_editor: compute deepest position offset according to used node
Before this commit when computing the deepest position for a non-visible
node, if that node had no next visible sibling it used the previous
siblings, but it still marked the offset within that sibling as 0.
Because of this, the selection sometimes got lost.
E.g. in Firefox, drop an "Image - Text" block and triple click on the
header text: upon changing its color the range got set to the text node
but ending at offset 0.

After this commit if the used node in the "previous sibling" from the
evaluated element, the offset is set to the length of that node.

task-2655176

closes odoo/odoo#77567

X-original-commit: 3c4426c71ebe080bcbd285e271c61bf1580c3afa
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
Signed-off-by: Benoit Socias (bso) <bso-odoo@users.noreply.github.com>
2021-10-01 07:41:00 +00:00
Sébastien Mottet (oms) fe8f8eacf0 [FIX] web_editor: fix black line problem for odd width images
When adding an odd width images on website, a thin black line is
drawn on its right side. The problem comes from the getSourceCanvas
of the cropperjs library. A translation is applied followed by an other
translation in the opposite direction. However the second translation
was not the exact reverse of the first due to a rounding problem.

The fix proposed here comes from: https://github.com/fengyuanchen/cropperjs/pull/300/commits/a6481c052cfc93ef14dd95a3bd00142215dda36e

task-2652904

closes odoo/odoo#77562

X-original-commit: 53f13979cc363c74a8f4e2cec0d24ca10c6ac11c
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-30 18:28:04 +00:00
xO-Tx 98a0376a14 [FIX] web_editor: fix Theme tab infinite loading
ISSUE:

The click on "THEME" tab in editor panel triggers the
'_onThemeTabClick' method which:

1- Starts the loader ('_execWithLoadingEffect' method).
2- Runs '_activateSnippet' which uses the same mutex as the
loader.

Execution order:

A1- '_execWithLoadingEffect' with promise: adds the loader in
the DOM immediately.
A2- '_activateSnippet' sets a second loader to be added after
a delay = 500.
A3- 'releaseLoader' removes the first loader.
A4- '_activateSnippet' ends : (before adding the second
loader: t(4) - t(2) < 500) and timeout is cleared.

In some cases we get t(4) - t(2) > 500 which adds a second
loader to the DOM, and the new flow will be:

B1- Same as A1.
B2- Same as A2.
B3- Second loader added to the DOM / replaces the first one
in 'loadingElements'.
B4- 'releaseLoader' removes the second loader (from the DOM
& 'this.loadingElements').
B5- Same as A4 but the first loader still in the DOM.

The goal of this commit is to fix this behaviour by preventing
more than one loader on the target element.

task-2656308

closes odoo/odoo#77500

X-original-commit: 9f21b2eefab2115c1b8581ad9f43fe1e65f934ed
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-30 13:32:06 +00:00
Nicolas Bayet e52bde906f [IMP] web_editor: allow qweb edition
Add a plugin for the Odoo editor that includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching
- style t-tags to make them stand out

Task-27033

X-original-commit: odoo/odoo@300da82eb4
Part-of: odoo/odoo#77377
2021-09-28 23:42:55 +00:00
Nicolas Bayet 810f832703 [FIX] web_editor: allow to delete backward a contenteditable
Deleting a node content-editable false did not work.

X-original-commit: odoo/odoo@de42d0f965
Part-of: odoo/odoo#77377
2021-09-28 23:42:54 +00:00
Nicolas Bayet 4813f42997 [IMP] mail,*: replace jinja with qweb
Jinja as a templating engine was problematic in differents respect:
- introduce external dependency to Odoo (less controll)
- add another templating mechanism in the stack
- specific feature in qweb cannot be reused
- difficulty in rendering easily editable templates
- more knowledge required with no betterment

By replacing jinja with qweb we can now build tools to edit a qweb
that will work with the previously jinja encoded document
(essentially `mail.template` records).

There is a catch however. Some email fields (eg. email_to) used jinja
syntax for rendering dynamic variables (ie. ${object.something} and
${object.something_that_should_not_be_escaped | safe}).

We still want user to use dynamic variables for some char fields (eg.
subject, from, to, ...). We made a new rendering engine called
"inline_template" that will render an expression enclosed by `{{` and
`}}`.

To be able to edit the templates from the backend interface, a
plugin to the Odoo editor has been made for seamlessly edit the
document.

This qweb plugin includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif, and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching

Task-27033

X-original-commit: odoo/odoo@68182baff4
Part-of: odoo/odoo#77377
2021-09-28 23:42:54 +00:00
Nicolas Bayet 21e9088839 [FIX] web_editor: save codeview changes
Before this commit, if there were a change in the codeview of the
field html and the record was saved while the codeview was still open,
the changes made in the codeview were not saved.

closes odoo/odoo#77367

X-original-commit: d8a9d23a66d3662fc1c5e4e07e35a1de6800ffa5
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-09-28 21:02:18 +00:00
Sébastien Mottet (oms) 433f6c2758 [FIX] website, web_editor: prevent mega menu removal
The user was able to remove the mega menu snippet without removing
the corresponding link in the menu. To avoid this flow to happen
we removed the delete button for the mega menu snippet. We also
handle the case where the user remove the mega menu snippet element
by element. On last element removal we put back the original template.

task-2636545

closes odoo/odoo#77256

X-original-commit: 97810a9c40396bb27cb5779937734849d185cf1f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-28 09:29:09 +00:00
qsm-odoo 9d8803f6ba [IMP] web_editor: allow onRemove to be async
Now, a snippet option can do async operations in its onRemove
implementation.

task-2636545

X-original-commit: ef2e55d7f407dedfbf724f2cae32a0fcaede6890
Part-of: odoo/odoo#77256
2021-09-28 09:29:09 +00:00
qsm-odoo 48092fcf85 [IMP] web_editor, *: add a generic class for large editor widgets
*: website, website_payment, website_sale

Instead of having a "o_we_large_input" class, now to have large widget, we can
use the generic "o_we_large" class (a future update is needing that for a non-
input widget).

task-2431285

X-original-commit: a8446e5d0f0b10f99f8174c012a6a53e2134b77a
Part-of: odoo/odoo#77255
2021-09-28 09:29:02 +00:00
Nicolas Bayet a2cf13eec2 [FIX] web_editor: save zone with proper res_model
Without this commit, the method `saveModifiedImages` did not use
editables zone but rather the whole `$editable`.
Because of that, oeModel and oeId were undefined and saving images
was done without the proper metadata.

That made impossible the retrieval of the images from the method
`ir.qweb.field.image` `from_html` defined by the module `web_unsplash`.

task-2581567

closes odoo/odoo#77259

X-original-commit: c32ef686e9744fc66f372921fce5cfaff739a76c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-09-27 18:07:51 +00:00
Sébastien Geelen (sge) 0589b36506 [FIX] web_editor: collaboration should be opt-in
The new collaboration feature of the web editor was active by default.
We fix it to by making it an opt-in option on the field html.

X-original-commit: 86678b98dad069d864cb78baec5eb8af8bf30ce3
Part-of: odoo/odoo#77160
2021-09-24 14:00:45 +00:00
David Monjoie f50f880655 [FIX] web_editor: fix traceback when no command is selected
closes odoo/odoo#77150

X-original-commit: 4b15136799ec3e394b61f2ef2a7949e1bd0f2340
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-09-24 12:35:29 +00:00
David Monjoie 17b864ce0e [FIX] web_editor: split list on enter in empty li
This matches the behavior of GDocs and CKEditor.

closes odoo/odoo#77115

X-original-commit: a84a6c869b815bf372d81db538b458cd23c99b07
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-09-24 11:09:13 +00:00
David Monjoie df1267f4d6 [FIX] web_editor: fix traceback when no image selected
closes odoo/odoo#77114

X-original-commit: aca97276446f8d9bd9977aeb665ae9a93d28a7bf
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-09-24 11:09:09 +00:00
Cocographique af666dff20 [IMP] web_editor: add new "Zigs" background shape
Related to task-2545200

closes odoo/odoo#77119

X-original-commit: 1624b1659d15df731a954912b88908a24aeddb5d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-24 01:50:16 +00:00
qsm-odoo ff1f5e6c8c [REF] web_editor: simplify shape scss definition
Don't set 'repeat-y' to false explicitely as it is the default value.

X-original-commit: 26612818d71f072eaf291df6d4ee839301f36dc7
Part-of: odoo/odoo#77119
2021-09-24 01:50:15 +00:00
Nicolas Bayet 5b7151e0ef [FIX] web_editor: wait editor loading in tests
In a undeterministic circumnstance, the editor has not enough
time to be loaded after `testUtils.nextTick()`.

By using a 100ms timeout instead, it will give more time for
the editor to be loaded and therfore reduce the risk of a false
negative to appear.

closes odoo/odoo#76980

X-original-commit: 190ddf08b8bb6c4750f1d0ad1c57f19b936794de
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-09-22 18:13:49 +00:00
Sébastien Mottet (oms) 59e4bb6526 [FIX] website, web_editor: fix wrong indentation and comment
Fix wrong indentation and comment introduced by commit https://github.com/odoo/odoo/commit/a57cda43c3b097b49baa2fc2a394494bbb01419a

task-2636545

X-original-commit: 0a589389860a9c1f18eae5cbd90a1ba3e85f5dfc
Part-of: odoo/odoo#76883
2021-09-21 09:38:26 +00:00
qsm-odoo c276545de7 [FIX] web_editor: properly await all async parts for onRemove/onClone
Even though onRemove and onClone cannot be async themselves (yet?), it
is called via a trigger_up of `call_for_each_child_snippet` so that each
part of the snippet being removed / cloned has their onRemove / onClone
called. Doing that way, some SnippetEditor instances may have to be
created and it can be an async operation... the problem is that our code
was only awaiting the first of those instanciations instead of all of
them.

closes odoo/odoo#76881

X-original-commit: ea2a40afb96147e83c897a0376e187d8c957e66a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-21 09:38:21 +00:00
Younn Olivier 3b598dbdf8 [FIX] web_editor: correctly init "open in new window" link option
The "Open in new window" checkbox was always initialized as false, even
if the link would open in a new window - both in the link tools and
dialog.

task-2172311

closes odoo/odoo#76880

X-original-commit: 52b034e8844336cc424e3126b843ec084fd7118e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-21 09:38:17 +00:00
Philémon van Helden ca9aebf8c2 [IMP] web_editor, *: add btn to form editor to redirect in the backend
* website, website_form_project

In master, there was an error when adding a form to a website and
selecting "Create a Task" with no active projects. This issue was solved
in PR #73269, by allowing tasks without a project associated. This
introduces a new problem: if a user wants to create a project (e.g. if
there is no active project), they will have to save their changes, close
the editor, navigate to Project, and only then will they be able to do
it. This issue could happen for other modules, so the solution has to be
generic.

In this commit, we add the possibility to add a button to the form
editor, next to a we-select item, which will redirect the user to a
specified action after prompting them to save their work. This button
can be added by specifying an action window in the corresponding
registry.

We also add the action window to the website form project editor, so
that the user can be redirected towards the Project app if they want
to create a project to select in their form.

task-2580436

closes odoo/odoo#76772

X-original-commit: e4233643b93b521454cc146c6a2ae876781fb9ba
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2021-09-18 05:42:55 +00:00
Sébastien Geelen (sge) 02b7bf524a [FIX] web_editor: toolbar outside of editable zone
On very small editors the restriction on the toolbar size
and position could generate issue (blocking text visibility).

So we changed the rules to allow the toolbar to overflow
outsize of the editable zone.

task-2648156

closes odoo/odoo#76710

X-original-commit: 6390a4225ea8a97fd0bc0b267d0d016846d27e46
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
Signed-off-by: Sébastien Geelen <sebgeelen@users.noreply.github.com>
2021-09-17 05:59:10 +00:00
Romain DerieandPhilémon van Helden 86c8cd76cc [IMP] web_editor, website_event: hide duplicate dates on edit
In master, when editing a date, the same date will be shown multiple
times next to each other. This is because each date is comprised of a
few times the same field with different formats, and when editing them,
they all remove their formatting and show the entire date.

In this commit, we allow adding the class `oe_hide_on_date_edit` to date
fields we don't want to show when editing, which will be dynamically
hidden (by adding the `d-none` class) when a user clicks on a field with
the same date.
We also add this class to some date fields in website_event.

task-2618494

closes odoo/odoo#75205

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Co-authored-by: Philémon van Helden <pvh@odoo.com>
Co-authored-by: Romain Derie <rde@odoo.com>
2021-09-16 18:14:55 +00:00
Philémon van Helden 85cb19b294 [IMP] web_editor, base: allow parameters in image URLs
When adding an image to the library from an URL, if the URL contains
parameters (e.g. ?width=200&height=200), the link will not be accepted.

In this commit, we remove these parameters from the URL before checking
the image, so that the URL is considered valid.
We also remove these parameters before computing the mimetype of the
image, since it is computed based on the end part of the URL.

task-2618494

Part-of: odoo/odoo#75205
2021-09-16 18:14:54 +00:00
Sébastien Geelen (sge) e1ad97a7d3 [FIX] web_editor: prevent multiple collaborative editor
When displaying a view with the same html field in multiple places,
we would have some conflicts between the editors if they start in collaborative
on the same channel.

task-2647125

closes odoo/odoo#76676

X-original-commit: 7bc676d751baeb030030eb814fc4a78200b80777
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
Signed-off-by: Sébastien Geelen <sebgeelen@users.noreply.github.com>
2021-09-16 16:57:57 +00:00
Benoit Socias 198b999f5b [FIX] web_editor: open palette below if insufficient space above
Before this commit opening the color palette only checked for the
available space below the button to open the popup above instead.
Because of this the popup sometimes opened higher than the top of the
screen making it unusable.

After this commit an additional check is done on the space available
above the button. If there is not enough room above then just opens
below, which makes the area scrollable if there was insufficient space,
thus keeping the palette usable.

task-2599771

closes odoo/odoo#76611

X-original-commit: 3ac197de28f7b4403a55342f387189fc9a1d74e0
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-16 15:45:57 +00:00
Romain Derie 6dd7207b6f [FIX] web_editor, web_unsplash, test_website: make unsplash work
Since cfe079221c, unsplash is not working anymore as that commit did not adapt
the unsplash code to that change.

task-2581567

closes odoo/odoo#76617

X-original-commit: 9a4723628e868836c7bbe8bec31ec9b6ce3f2554
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-16 10:01:14 +00:00
Benjamin Vray 360abc0570 [IMP] web_editor, website: make animation options available on text
After this commit, it is possible to animate text in website pages.

task-2545252

closes odoo/odoo#76610

X-original-commit: 187acb938f70a2130d25fa76079221339c742f1e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-16 10:01:06 +00:00
Benjamin Vray c0dcc8265b [FIX] web_editor: not hide the toolbar container by clicking in itself
Before this commit, the toolbar container was closed when we clicked
on its background or in its title bar.

task-2545252

X-original-commit: 2ca87a5142a03540fc5e6428530d394faa223d17
Part-of: odoo/odoo#76610
2021-09-16 10:01:06 +00:00
Martin Trigaux ef8ad324b0 [I18N] *: export 15.0 source terms
closes odoo/odoo#76542

X-original-commit: 63e6807437295519a0f4705fb88644d6d557ca3a
Related: odoo/enterprise#20882
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-09-16 07:17:40 +00:00
Benoit Socias 700888217c [IMP] web_editor: update opened colorpickers upon button color picking
Before this commit the button custom color colorpickers were not updated
when a color was selected - but this was alright because the
colorpickers did not remain opened.

After this commit the button custom color colorpickers are updated
whenever a color is picked, which is necessary during gradient edition.

task-2599771

X-original-commit: f40c980d7ff68f27b389a93cd2b8f60cbff5baa6
Part-of: odoo/odoo#76608
2021-09-15 23:51:14 +00:00
Benoit Socias 28e4335669 [IMP] web_editor: update color palette during UI update
Before this commit the color palette was updated directly during the
color picking event management.

After this commit picking a color updates the whole UI, and the global
UI update also updates the already opened palettes.

task-2599771

X-original-commit: 5698cf982c7e4499ed8b6f933ad364b9db475922
Part-of: odoo/odoo#76608
2021-09-15 23:51:13 +00:00
Benoit Socias d3c9a9cc00 [IMP] web, web_editor, website: make gradients editable
task-2599771

X-original-commit: bfb97ce3ed829905e943f18cd83107a92e695e76
Part-of: odoo/odoo#76608
2021-09-15 23:51:13 +00:00
Younn Olivier 096a6e72a9 [FIX] website: only display website languages for conditional visibility
The languages displayed for the ConditionalVisibility option are now the
ones available for the website.
The select widget is hidden if there is only one.

task-2629245

closes odoo/odoo#76537

X-original-commit: 380edf50bd1d8d1f7b1a33fd4fa1ad70dbc12804
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-15 09:02:16 +00:00
Benoit Socias 9e20e7d9c0 [FIX] website: avoid displaying the link popover when opening user menu
Before this commit toggling the user menu did display the link popover.

After this commit no link popover is displayed when clicking on the user
menu (or any other dropdown menu) anymore.

task-2612755

closes odoo/odoo#76511

X-original-commit: ffaa406884bd5a897a0f76e993c915691ab850ba
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-14 16:40:56 +00:00
Benoit Socias 338b437d54 [IMP] web_editor, website: make button colors selectable
Before this commit button colors were only obtained from one of the
predefined styles.

After this commit button colors can be specified by using the new
"Custom" style.

task-2612755

closes odoo/odoo#76461

X-original-commit: a010c91b5ee119cf54ed1a68a6ea06b2bc5f3978
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso-odoo@users.noreply.github.com>
2021-09-14 12:07:50 +00:00
Benoit Socias 85dfd3e180 [FIX] web_editor: handle palette history better
Before this commit several history steps were added when picking a color
and history steps were added when previewing a color.

After this commit history is only updated on color selection and not
during color preview: applying the color relies on execCommand which
adds an history step => no need to add another step upon picking a color
but must be prevented during preview.

task-2599771

closes odoo/odoo#76417

X-original-commit: 4c1956d697a52e4d561e93930bb9e9f5c61e8a35
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso-odoo@users.noreply.github.com>
2021-09-13 17:21:44 +00:00
Romain Derie 2658d29e03 [FIX] web_editor, website: re-introduce link double click
It was previously decided that double clicking on a link shouldn't do anything
other than opening the popover (which happen on single click).

It was recently decided that we should actually open the right panel link tool
on double click.

Adding double click behavior, it was needed to refactor the way the popover is
opening/closing -> We now use `focus` as trigger instead of `click`.
Side effect, it will also fix 2641448 (part about double click on word)

Courtesy of SAD for debugging the double click issue (with trigger click)

task-2618494

closes odoo/odoo#76372

X-original-commit: 4eff35ab31bfc45b4c8dca8392e9da4f4e2a7afd
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-10 19:36:57 +00:00
Benoit Socias 5be974283d [IMP] web_editor: add possibility to not focus LinkTool input
Before this commit, when requesting the link tool in the right panel, it would
always focus its input.

This commit adds an option to not focus the input when link tool is requested.

It will be used by next commit.

task-2618494

X-original-commit: ad13055d58b6cd92d56f483bce17ab2e19216809
Part-of: odoo/odoo#76372
2021-09-10 19:36:56 +00:00
Benoit Socias b5263be24c [FIX] web_editor: restore lost selection when updating color
Before this commit if the text selection was lost while the color
palette was used, the color selection was not applied on anything.

After this commit if the text selection was lost, it is restored to the
last selection known in history before applying (or previewing) the
color selection.
Also avoid to remember selections that are not part of the editable.

task-2599771

closes odoo/odoo#76357

X-original-commit: 0e706d508d6e747cff566c33d34b794a321eef5c
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
2021-09-10 16:10:47 +00:00
Nicolas Bayet 0a0a108969 [FIX] web_editor: use the proper serialize method
Use the method serializeNode of the editor rather than directly
the one from utils  in order to only serialize when the collaboration
is active.

closes odoo/odoo#76143

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-09-08 10:22:06 +00:00
Nicolas Bayet 4c03a56dab [FIX] web_editor: stop making snapshot when no collaboration
When the collaboration is not active, it is not necessary to create
snapshot as they will not be sent to anybody.

Part-of: odoo/odoo#76143
2021-09-08 10:22:06 +00:00
Gorash 4d0e111733 [IMP] profiling: Add profile qweb execution into the performance tools.
By activating the profiler debugger, the two qweb options is added. The
qweb templates that need to be rendered are compiled into a new function
to add instructions for saving data.

`Add qweb directive context`
It's a sub-option of "Record sql" or "Record traces", add some context on
thread at current call stack level.  This context stored by collector
beside stack and is used by  Speedscope to add a level to the stack with
this qweb directive information.
```
    directive=t-call='website.layout', xpath=/t/t
    t_call_content
    directive=t-foreach='5' t-as="'a', xpath=/t/t/div/div
    directive=t-esc='website.search([])', xpath=/t/t/div/div/t
    execute
```

`Record qweb`
Add profiling data used by ProfilingQwebView widget. In the `ir.profile`
form view, the widget display the duration and number of sql of every qweb
directives with the xml of templates. Every xml is recorded to be
consulted even if the user change the xml templates.
```xml
    <t t-call="website.layout">
       <div>
          <div t-foreach="5" t-as="a">
             <t t-esc="website.search([])"/> <!-- will display 5 separate requests -->
          </div>
       </div>
    </t>
```

closes odoo/odoo#74712

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-09-08 10:21:42 +00:00
Nicolas Bayet cc66d73836 [FIX] web_editor: ensure editor history always has more than 0 steps
344d82c commit changed how the editor `_historySteps` should behave.
Before that commit, `_historySteps` could have 0 steps whereas after
that commit `_historySteps` should always have at least the first step
be a snapshot. When reseting the history, we should now add a snapshot
as a first step. This commit guarantees it.

closes odoo/odoo#75901

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-09-08 09:03:07 +00:00
Antoine Guenet 68d27ec73e [FIX] web_editor, mass_mailing: use new historyReset io/ resetHistory
344d82c renamed `resetHistory` into `historyReset` but failed to update
some calls to it and rename its equivalent in wysiwyg.js. This commit
corrects the discrepancy.

Part-of: odoo/odoo#75901
2021-09-08 09:03:07 +00:00
Antoine Guenet c0d6f1993d [IMP] mass_mailing: remove outdated and expensive from_inline conversion
When saving a mailing, we do some processing (converting classes to
inline styles mostly) in order for the mailing to display properly in
all email clients. Until we started saving the processed version
separately from the unprocessed version, we had to revert the process
whenever we would start editing the mailing. This was extremely
expensive and made the loading of a previously created email very, very
slow. This was kept so far for backward compatibility reasons 3 years
ago (see f296992). This commit removes the that unnecessary conversion.

Part-of: odoo/odoo#75901
2021-09-08 09:03:07 +00:00
Antoine Guenet 95754eb6a4 [FIX] mass_mailing: save transpiled html without affecting body_arch
Since the introduction of Odoo Editor, `field_html`'s `_getValue` uses
`wysiwyg.getValue`. This conflicts with the mechanism of `mass_mailing`
which modifies the html of the editable area in place to save an
"e-mailable" version on the `body_html` field, then relies on
`_getValue` to reset the original html (`body_arch`).
This ensures the field has a value before modifying the html in place,
so we can manually restore it instead of relying on a side effect of the
old behavior of `_getValue`.

Part-of: odoo/odoo#75901
2021-09-08 09:03:06 +00:00