Commit Graph
3146 Commits
Author SHA1 Message Date
Nicolas Bayet defccba4b3 [FIX] web_editor: add label in link_dialog from wysiwg
Open the link dialog from the wysiwyg with the label input.

Task-2704538

closes odoo/odoo#83454

X-original-commit: f7a0c321d94f84ed7daf4f6abff0740ad81024bb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-07 13:10:40 +00:00
Sébastien Geelen (sge) 89176da7d7 [FIX] web_editor: fix missing strikethrough in editor
Strikethrough option was missing in the editor toolbar.

* Added the option in the toolbar.
* Added the keyboard shortcut (CTRL+5)

task-2754007

closes odoo/odoo#84029

X-original-commit: 9808073c22eacf9f2bcc55aa96eaec56f55597cc
Signed-off-by: Antoine Guenet <age@odoo.com>
2022-02-04 21:44:53 +00:00
Sébastien Geelen (sge) 2e2914e5fe [FIX] web_editor: fix italic and underline in FF
When selecting the text content of a link
the underline and italic commands were not working in Firefox.

We re-implement the Browser command to fix this.

task-2667950

X-original-commit: 52a5b2bb692ab6712d497492f4f2fbef3a9a7874
Part-of: odoo/odoo#83895
2022-02-03 11:45:55 +00:00
Gorash e830953570 [IMP] IrQweb: refactoring and add technical documentation
Major changes:
- Remove some of the recursively when compiling
- Compile attributes became a directive
- Compile options became a directive
- `t-field` compilation now uses the same logic as `t-out`
- Simplification of ``t-if`` directive compilation
- Improved handling of errors wrapped by QWebException
- Constants defined outside the class

    Odoo
     ┗━► _render (returns MarkupSafe)
        ┗━► _compile (returns function)                                        ◄━━━━━━━━━━┓
           ┗━► _compile_node (returns code string array)                       ◄━━━━━━━━┓ ┃
              ┃  (skip the current node if found t-qweb-skip)                           ┃ ┃
              ┃  (add technical directives: t-tag-open, t-tag-close, t-inner-content)   ┃ ┃
              ┃                                                                         ┃ ┃
              ┣━► _directives_eval_order (defined directive order)                      ┃ ┃
              ┣━► _compile_directives (loop)    Consume all remaining directives ◄━━━┓  ┃ ┃
              ┃  ┃                              (e.g.: to change the indentation)    ┃  ┃ ┃
              ┃  ┣━► _compile_directive                                              ┃  ┃ ┃
              ┃  ┃    ┗━► t-if            ━━► _compile_directive_if                 ━┫  ┃ ┃
              ┃  ┃    ┗━► t-foreach       ━━► _compile_directive_foreach            ━┛  ┃ ┃
              ┃  ┃    ┗━► t-inner-content ━━► _compile_directive_inner_content ◄━━━━━┓ ━┛ ┃
              ┃  ┃    ┗━► t-options       ━━► _compile_directive_options             ┃    ┃
              ┃  ┃    ┗━► t-call          ━━► _compile_directive_call               ━┫ ━━━┛
              ┃  ┃    ┗━► t-att           ━━► _compile_directive_att                 ┃
              ┃  ┃    ┗━► t-tag-open      ━━► _compile_directive_open          ◄━━┓  ┃
              ┃  ┃    ┗━► t-tag-close     ━━► _compile_directive_close         ◄━━┫  ┃
              ┃  ┃    ┗━► t-out           ━━► _compile_directive_out             ━┛ ━┫ ◄━━┓
              ┃  ┃    ┗━► t-field         ━━► _compile_directive_field               ┃   ━┫
              ┃  ┃    ┗━► t-esc           ━━► _compile_directive_esc                 ┃   ━┛
              ┃  ┃    ┗━► t-*             ━━► ...                                    ┃
              ┃  ┃                                                                   ┃
              ┗━━┻━► _compile_static_node                                           ━┛

closes odoo/odoo#81024

Related: odoo/enterprise#22942
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2022-02-03 08:09:31 +00:00
Gorash 9ce5bc8881 [IMP] IrQweb: merge Qweb engine file qweb.py and ir_qweb.py
QWeb is the primary templating engine used by Odoo. It is an XML
templating engine and used mostly to generate XML, HTML fragments and
pages.

To create new XML template, please see :doc:`QWeb Templates documentation
<https://www.odoo.com/documentation/15.0/developer/reference/frontend/qweb.html>`

In **input** you have an XML template giving the corresponding input
etree. Each etree input nodes are used to generate a python function.
This fonction is called and will give the XML **output**.
The ``_compile`` method is responsible to generate the function from the
etree, that function is a python generator that yield one output line at a
time. This generator is consumed by ``_render``. The generated function is
orm cached.

In the graphic below you can see theresume of the call of the methods
performed in the IrQweb class.

    Odoo
     ┗━► _render (returns MarkupSafe)
        ┗━► _compile (returns function)                                        ◄━━━━━━━━━┓
           ┗━► _compile_node (returns code string array)                       ◄━━━━━━━┓ ┃
              ┃  (add technical directives: t-inner-content, t-tag)                    ┃ ┃
              ┣━► _directives_eval_order (defined directive order)                     ┃ ┃
              ┃                                                                        ┃ ┃
              ┣━► _compile_directives                              (recursive) ◄━━━━┓  ┃ ┃
              ┃  ┣━► _compile_directive                                             ┃  ┃ ┃
              ┃  ┃    ┗━► t-if            ━━► _compile_directive_if                ━┫  ┃ ┃
              ┃  ┃    ┗━► t-foreach       ━━► _compile_directive_foreach           ━┫  ┃ ┃
              ┃  ┃    ┗━► t-*             ━━► ...                                  ━┛  ┃ ┃
              ┃  ┃    ┗━► t-inner-content ━━► _compile_directive_inner_content ◄━━━━┓ ━┛ ┃
              ┃  ┃    ┗━► t-tag           ━━► _compile_directive_tag               ━┫    ┃
              ┃  ┃    ┗━► t-call          ━━► _compile_directive_call              ━┫ ━━━┛
              ┃  ┃    ┗━► t-out           ━━► _compile_directive_out           ◄━┓ ━┫
              ┃  ┃    ┗━► t-field         ━━► _compile_directive_field          ━┛  ┃
              ┃  ┃                                                                  ┃
              ┗━━┻━► _compile_static_node                                          ━┛

Part-of: odoo/odoo#81024
2022-02-03 08:09:31 +00:00
Sébastien Geelen (sge) 26bbac2b61 [FIX] web_editor, project: better field html sizing
Allow wysiwyg field html to blend better in odoo view,
Remove the default resizer and make the field html's size
automatically fit its content

task-2637488

# Conflicts:
#	addons/project/static/src/js/project_form.js

Part-of: odoo/odoo#83792
2022-02-02 09:03:44 +00:00
Sébastien Geelen (sge) 14f4bd526a [FIX] web_editor: adjust codeview button placement
Move the codeview button to avoid conflict with the Translate button.

task-2637488

Part-of: odoo/odoo#83792
2022-02-02 09:03:43 +00:00
Sébastien Geelen (sge) c61150eb16 [FIX] web_editor: fix placeholders for multi editor
Fix placeholder not working properly when multiple editor exists

task-2637488

Part-of: odoo/odoo#83792
2022-02-02 09:03:43 +00:00
fcafe21f1e [FIX] web_editor, website: properly display the redirect old url list
When a user clicks on 'could be used in' in the page properties after
chaing the URL, a list is displayed in a popup. This popup was
not properly rendered:
- the content could not be scrolled through, it was thus truncated
- the popup appeared behind the technical modal that kicks in on small
screens

Now the popup is better positioned, a scrollbar is available to access
its content when it is too long and on small screens it is displayed on
top of the technical modal, making it visible on small screens.

task-2092269

closes odoo/odoo#83693

X-original-commit: e2f1f4967a2dd4d730895e924f0c7ca02e23a17b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Jitendra Prajapati <jpr@odoo.com>
Co-authored-by: Benoit Socias <bso@odoo.com>
2022-01-31 17:47:56 +00:00
Federico (fega) 97c8cf3ac2 [FIX] website, *: always allow scroll for popup taller than window
*: web_editor

Steps to reproduce:
- Activate the cookie dialog from the website settings
- Remove the backdrop from the cookie dialog
- Add some blocks to the cookie dialog in the website editor
until the dialog height is bigger than the page height.

Result:
The cookie dialog is not scrollable, so it's impossible to reach
the "I agree" button and close the dialog, leaving the user stuck
at the first page.

I check if the popup content is higher than the window. If it is, I
give priority to the popup scroll over the page one. I had to
overwrite the _showElement method to call _setScrollbar after
the content rendering, in this way I can get its correct height.
I also try to update the scrollbar each time a block in the cookie bar
has been changed and each time the window resize. This is optimize, so
if the overflow isn't changed from the last time I tried to update the
scrollbar no action will be taken. In this way you can always see the
whole popup without refreshing the page.

Also I have to set 'pointer-events' to none only if the popup is
smaller than the page itself (to interact with and scroll the
page behind), otherwise the popup won't be scrollable. I did
this by adding a class "s_popup_overflow_page" if the popup is
higher than the page and I adapted the pointer-events
property accordingly.

opw-2660786

closes odoo/odoo#83691

X-original-commit: 022a4486a99d855a3c6e2cef326bb3b0c5e66db9
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-01-31 17:47:52 +00:00
Benjamin Vray aca85f9f19 [IMP] website_sale: improve the design of the product block options
task-2501515

Part-of: odoo/odoo#74206
2022-01-28 12:21:47 +00:00
Benjamin Vray 368cd051eb [FIX] web_editor: add a space between the video option's switches
Since the redesign of the switches made at [1], there was no space
between the switches anymore.

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

task-2723819

closes odoo/odoo#83532

X-original-commit: 677d07e0529cd4087bd1e3c2bac8ea5c1133ca89
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-01-28 09:52:57 +00:00
Benjamin Vray 2de0ad7259 [FIX] web_editor: fix popup options displayed after removing a block
Before this commit, after removing a snippet followed by a popup in the
DOM, the popup options were displayed while the popup was closed.
Indeed, selecting the next snippet after one's removal is a feature that
was introduced by [1] but did not consider that the next snippet could
be an invisible one (like a popup).

[1]: https://github.com/odoo/odoo/commit/2cdd95f140b6ec5f3b95ee19bde2f281de21f337

task-2735551

closes odoo/odoo#83512

X-original-commit: cc802d33885700543c753558dc40cc07d971f87f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-01-27 16:17:32 +00:00
xO-Tx 1e4ba0f49a [IMP] web_editor: allow shapes option on gifs
To apply shapes on images, we need to store them (in base64) inside the
shape SVG, but before that, we need to use 'applyModifications()' to get
the dataURL that contains the image with applied filters and size
options...(see ImageOptimize > _writeShape). But since we can't handle
GIFs on applyModifications(), we get a single frame of the animation as
a result...

The goal of this commit is to skip the updates from 'applyModification()'
(when the target is a .GIF) and only apply the shape.

This way, other "data-attributes" options should be disabled for GIFs
and only shapes option is allowed.

task-2679905

closes odoo/odoo#79330

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-01-27 11:07:09 +00:00
Nicolas Bayet 51e6b349e3 [FIX] web_editor: open the linktool when clicking an element inlide link
Whenever we clicked on a link that contained another element
(eg. span, bold, ...), the LinkTool did not open.

Task-2667989

closes odoo/odoo#83437

X-original-commit: d69d26a2dd8830aca8c5922d3548e5ff59c688fc
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-26 18:23:56 +00:00
Nicolas Bayet 84df34daa2 [FIX] web_editor: resolve ajax request of cleanForSave
Upon save in website or in mass_mailing, if a `cleanForSave` of a
`SnippetEditor` or a `SnippetOption` wait for the end of an
`this._rpc()` request AND the `SnippetEditor` or the `SnippetEditor`
of the `SnippetOption` has a `SnippetEditor` ancestor, the
`cleanForSave` will never resolve.

Here is the scenario:

- **SnippetEditor B** has **SnippetEditor A** as its odoo widget parent

In `SnippetMenu` `_destroyEditors`:
- **SnippetEditor A** and **all its SnippetOption** call `cleanForSave`.
- **SnippetEditor B** and **all its SnippetOption** call `cleanForSave`.
  One of the promise of **SnippetEditor B** includes the result of
  `rpc()` in `ajax_service.js`.

- **SnippetEditor A** and **all its SnippetOption**
  `cleanForSave promises` resolve (but not **SnippetEditor B**).
- **SnippetEditor A** get's destroyed (`snippetEditor.destroy()`). As
**SnippetEditor B** is a `Widget` child of **SnippetEditor A**:
- **SnippetEditor B** get's destroyed (here is where the problem start).

... in the mean time ...

The ajax request of a promise of **SnippetEditor B** ends. The promise
of the `rpc()` will never finish because **SnippetEditor B** is
destroyed and the condition in `rpc()` is:
```js
if (!target.isDestroyed()) {
    resolve(result);
}
```

Because the promise will never finish for `_destroyEditors`, the save
action will never fully complete.

Task-2742008

Part-of: odoo/odoo#83103
2022-01-26 14:08:47 +00:00
Nicolas Bayet 013f0da147 [FIX] web_editor: properly save history step when pasting text
Before this commit, when trying to paste an url, the editor was
properly creating a link but did not create a step in the history.
So when the user hit enter just after the paste, the last link
insertion was reverted.

Task-2720366

closes odoo/odoo#83396

X-original-commit: 0e37742d3caba1c6544e5b466503f155626375eb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-26 13:11:14 +00:00
qsm-odoo e4e69d54fb [FIX] website, web_editor: prevent traceback on popup removal
Before this commit, a traceback occured when trying to remove a popup
snippet, only if content inside was clicked on before (base case but
that last part was not covered by our main test which drags and drops +
removes all snippets).

The problem is complex and annoying to solve in stable. The cause is the
combination of [1] and [2]. Indeed, with [2] we solved the snippet
activation flow to ensure the onFocus and onBlur methods are called when
needed... but that new correct implementation relies on the fact that
the number of snippet editor instances does not change for the whole
async operation of activating a snippet. That should naturally be the
case but is not because of [1]: when we remove a snippet we first
trigger a snippet activation then destroy the snippet (and its editor
instance)... but the snippet activation is not awaited at the moment.
Thus making the snippet editor instance be destroyed *during* the
snippet activation flow. Of course a better solution than this commit
must be found but this fixes the traceback with a very minimal change
for the 15.0 stable version while waiting for that miraculous solution.

[1]: https://github.com/odoo/odoo/commit/ae219ec06baf0280c76ae09b1453cc1481eece30
[2]: https://github.com/odoo/odoo/commit/0acc5e784b15d9c963660da3781763448503f33e

task-2735663

closes odoo/odoo#83378

X-original-commit: da7c1b5757a7780897c5736ddecc014a7fb50bdb
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-01-26 13:11:10 +00:00
Benoit Socias 9943931c6f [FIX] web_editor: remove gradient background image when removing format
Before this commit the removeFormat command was only doing its default
native implementation, which did not clean the background-image CSS
property. Because of this, text-gradients became highlight gradients.

After this commit in addition to the default native implementation, the
removeFormat also clears the background-image CSS property.

Steps to reproduce:
- edit the website homepage
- drop a text snippet
- enter a new line of text
- set a text gradient on the new line
- switch the new line to Heading 1
=> new line has the gradient used as background

task-2741684 (was part of task-2666200)

closes odoo/odoo#83306

X-original-commit: 97da1c2106d2a0e76dff1353e56b74d70db55eb2
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-25 12:19:22 +00:00
Guillaume (gdi) 109f34d13e [FIX] web_editor: fix media link tool activation
Before this commit, the shortcut activated the link tool on all images
in the section. This commit permits to activate the link tool only on
the target image.

task-2666467

closes odoo/odoo#83295

X-original-commit: ebeeaf492285c9c1c9d9fd6e359dca27ee315021
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-01-25 09:57:19 +00:00
Guillaume (gdi) d88431961c [FIX] web_editor: support media link tool shortcut on firefox
The CTRL + K shortcut to activate the media link tool did not worked on
firefox. This commit fixes that.

task-2666467

X-original-commit: 13375c5f079597abadb77ba5e17bc2087f6c24fc
Part-of: odoo/odoo#83295
2022-01-25 09:57:19 +00:00
Antoine Guenet 76cf71a86f [REF] web_editor, mass_mailing: rename wysiwyg "intance" typo functions
This properly renames the functions _createWysiwygIntance and
_restartWysiwygIntance to, respectively, _createWysiwygInstance and
_restartWysiwygInstance since they both had a typo in them and it's
triggering all of our OCDs.

closes odoo/odoo#83098

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-24 16:55:20 +00:00
Guillaume (gdi) 36258053c5 [FIX] web_editor: clean media link tool for master
As we added the media link tools in a stable release (15.0) with [1], we
had to make all the changes in static files (JS and lazy loaded XML).
We don't have to worry about that in master so the code is simplified
with this commit.

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

task-2666467

closes odoo/odoo#78578

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-01-24 16:05:49 +00:00
Antoine Guenet c82c38b178 [FIX] web_editor, mass_mailing: fix 0 dimensions of img when not visible
The conversion process of emails for mail clients involves retrieving
the dimensions of images and icons in order set them as element
attributes. This can however not possibly work if they are invisible at
the time of conversion. This therefore makes sure they are visible by
changing the visibility of whichever parent was invisible before
conversion and restoring it when we're done.

opw-2686316
opw-2735636

closes odoo/odoo#83233

Related: odoo/enterprise#23695
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-24 15:09:27 +00:00
Antoine Guenet fd0c0976c2 [FIX] web_editor: properly convert img dimensions
Images sometimes shrunk on conversion because of a parenthesis error in
a conditional chain, because dimensions set via element attributes
should be preserved, and because the offset height should be
used rather than the element height as returned by jQuery.

Part-of: odoo/odoo#83233
2022-01-24 15:09:27 +00:00
Antoine Guenet e641575150 [FIX] web_editor: properly apply padding in tables
The conversion of padding from grids to their equivalent
tables was sometimes faulty due to an error in the
evaluation of the cell's position within the table.

Part-of: odoo/odoo#83233
2022-01-24 15:09:27 +00:00
Antoine Guenet 1013b63571 [FIX] web_editor: properly convert cards to tables
Cards need to be double wrapped in tables to be
displayed properly because of a bizarre hack by
bootstrap that uses background-color rather to give
the effect of a border, and because we can have
card-body be a sibling of a list-group.
Incidentally this also prevents the introduction of a
new row for each whitespace text node.

Part-of: odoo/odoo#83233
2022-01-24 15:09:27 +00:00
Antoine Guenet cc90b972f8 [FIX] web_editor: prevent useless tbodys on convert
When converting, we ensure each table has a tbody
but inadvertently were wrapping each <tr> in a
separate tbody rather than wrapping all the contents
of the table.

Part-of: odoo/odoo#83233
2022-01-24 15:09:26 +00:00
Antoine Guenet badd8922f7 [FIX] mass_mailing: ensure body_arch and body_html have the same fonts
The mail-safe font is applied to a style in <head> for emails. But the
way it was applied, <div>s were forgotten. Since most of those are
converted to tables when converting body_arch to body_html, it resulted
in visible font differences between body_arch and body_html.

Part-of: odoo/odoo#83233
2022-01-24 15:09:26 +00:00
Antoine Guenet fcc220c336 [FIX] web_editor: prevent cropping fonts->images on apply padding
When fonts with a round border were converted to images, the dimensions
often ended up slightly off, and most visibly a little bit cropped by
the border.

Note that this also removes the "alpha" argument of the font_to_img
route since it wasn't used anywhere and transparency is not supported in
emails anyway.

Part-of: odoo/odoo#83233
2022-01-24 15:09:26 +00:00
Antoine Guenet 3fb6eee447 [FIX] web_editor: round conversion from grid to percentage to 2 decimals
When converting from grid to tables, we need to convert values from x/12
to x/100. The rounding error was a little too big, making it too visible
at times. With this commit we now round to 2 decimal places instead of
rounding to the nearest integer.

Part-of: odoo/odoo#83233
2022-01-24 15:09:25 +00:00
Antoine Guenet fba1aee5dd [FIX] web_editor: properly preserve exact font size
The conversion from rem to px was rounding the value to 1 decimal place
but the browser handles up to 2 decimal places. As a result there were
visible inconsistencies in the conversion (12.25px in the original
becoming 12.3px in the converted email).

Part-of: odoo/odoo#83233
2022-01-24 15:09:25 +00:00
Antoine Guenet a1915ab986 [FIX] web_editor: properly convert table cell/row alignment
The align-self and justify-content styles don't work on cells so when
converting a Bootstrap column to a table cell, we should also apply a
vertical alignment. The same applies to align-items on rows.

Part-of: odoo/odoo#83233
2022-01-24 15:09:25 +00:00
Nicolas Bayet eca0fe7450 [FIX] web_editor: allow to select inside a button when editing
When the user-select is none in firefox, it is impossible to select the
text even if the content is editable.

Task-2716365

closes odoo/odoo#83255

X-original-commit: 88a5269b2130bc82c48bc587a042c24062bc4e96
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-24 14:13:49 +00:00
Antoine Guenet 93151fb73b [FIX] web_editor: properly apply color in nested inline contexts
The colorpicker failed in cases like:
```xml
<font>a<span>b</span>c</font>
```
where we select the letter "b".
This was because `applyColor` only considered direct children of the
`font` element. This extends it to deal with further descendants of it.

task-2623347

closes odoo/odoo#83254

X-original-commit: 5d8d98812a4f351abd27389c4992bf9e753833b7
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-24 14:13:45 +00:00
Antoine Guenet c616f38f77 [FIX] web_editor: display current text color in text color button
The editor toolbar button to trigger the colorpicker is supposed to show
the color of the currently selected text. This was failing in iframes
because the code was called on the wrong document.

task-2623347

X-original-commit: 7ad6536dd98f9749d63bfc7292e490f6ac629b9c
Part-of: odoo/odoo#83254
2022-01-24 14:13:45 +00:00
Nicolas Bayet a565e73574 [FIX] web_editor: properly position the toolbar
In some undetermined circumstance in chrome, the selection rect is
wrongly defined.

Task-2728792

closes odoo/odoo#83248

X-original-commit: e9ee8175538e1201acb2ae108b2283f55217ca5f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-24 13:19:49 +00:00
Antoine Guenet f02b15dcc2 [FIX] web_editor: restore rules cache
This commit restores the cache on the document that was lost with the
new parsing system [1]. It allows for faster convertion to inline styles
after the first time on the same document.

[1] https://github.com/odoo/odoo/commit/10e749537186dfb80aee1f2537f3b5804f66cfe5#diff-5922d38ff6520249ff5b3a3240eebc350c6f9f4d9f486d512128c23261c45841L19

closes odoo/odoo#83139

X-original-commit: 0ee96727793cfa64c9cdb9f3ef3b7e6b1ef1f631
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-24 07:41:52 +00:00
Fabien Pinckaers 6b87526048 [IMP] Speed Imp: remove unnecessary base64 encode & decode
Avoid to base64 encode, then decode to process assets and images for a ~25% speed improvement.
Change image processing tool to work on images, rather than base64 encoded strings.

Performance is ~25% faster on assets & images:

  /web/assets/...frontend.min.css:    13ms to 7ms,  base64 enc/dec: 2 -> 0
  /web/image/XML_ID:                  10ms to 8ms,  base64 enc/dec: 3 -> 0
  /web/image/res.users/2/avatar_128:  40ms to 20ms, base64 enc/dec: 6 -> 2

closes odoo/odoo#82851

Related: odoo/enterprise#23537
Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-01-22 11:51:42 +00:00
Antoine Guenet 171ae90cd0 [FIX] web_editor, mass_mailing: speed up opening of field html inline
On opening field html with the inline styles option we were parsing all
the css in the page. This should only be needed when we save. This
commit moves the call to `getCSSRules`back to `commitChanges`.

closes odoo/odoo#83131

X-original-commit: 0d4342317d456ed37f0bf24f00538ef54f847e60
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-21 16:49:54 +00:00
Antoine Guenet 2093aefbe8 [FIX] web_editor: remove check ids in tests
The random ids of checklists and stars are preserved in the dom, which
is needed for their readonly check features to work. However, it
complicates testing. This systematically removes these ids in tests.
It also removes the ids when they are not needed anymore (the node is
not a checklist anymore for instance).

closes odoo/odoo#83137

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-21 15:04:09 +00:00
David Monjoie 5474c8b1df [REV] web_editor: revert prevent editor powerbox hint duplication
This reverts bfed1edd26312488dc0f45e8982b51ea4d98db76.

That commit had issues which were hidden by the fact that tests had an
only in them due to a prior mistaken commit. Therefore, it must be
reverted as a proper fix needs to be found.

X-original-commit: 22c2a9dca29adcad84072e3f053ab78b7834f4f3
Part-of: odoo/odoo#83137
2022-01-21 15:04:09 +00:00
David Monjoie d2d763f30e [FIX] web_editor: fix lingering only in tests
X-original-commit: 47dc1639ab18ae9080fc4a7a3c2822c4cce2175a
Part-of: odoo/odoo#83137
2022-01-21 15:04:08 +00:00
Fabien Pinckaers eedf37d6e2 [IMP] Better handling of indexes
Three supported types:
- btree (default for index=True)
- btree not null (when >90% of the data are null)
- gin trigram search (for char fields)

Review of indexes on all objects.

closes odoo/odoo#83015

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-01-19 16:52:23 +00:00
Nicolas Lempereur 96ec641217 [FIX] web_editor: no !important bg-color
The tool to change background color in mass mailing will currently
set the CSS property as !important.

On outlook software (or windows mail app) this seems to fail:

- !important on inline CSS should not be used

In this fix we remove !important when inlining CSS.

opw-2641343

note: this forward-port is only taking half of 14.0 d7e5101603 since the
issue of targetting DIV elements does not apply here (the <div/> with
the background color are transformed in table in convert_inline.js).

closes odoo/odoo#82924

X-original-commit: fb675251ce8b13d36dfac7a50e9b1cea4759cc02
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2022-01-19 10:30:52 +00:00
Thibault Libioulle 54c5160264 [IMP] website_sale: search tag in product snippet
This commit adds a search on tag in product snippet.

task-2675384

closes odoo/odoo#79296

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-01-17 14:07:46 +00:00
Nicolas Bayet b467e4df8c [FIX] web_editor: remove image toolbar when removing image
Task-2728793

closes odoo/odoo#82881

X-original-commit: 0ff6f919e10388f7fd6d8efbfb0c8f9644b2505e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-17 12:17:31 +00:00
Nicolas Bayet 48045a069b [FIX] web_editor: change fix for scrolling powerbox
The fix to add an `overflow: hidden` in order to prevent the browser
from chaning the scroll create a glitch where the scrollbar dissapear
when it is overflow: hidden.
A new css property exists to specify exactly this behavior
(`overscroll-behavior: contain;`).

Task-2728791

closes odoo/odoo#82880

X-original-commit: 4cfa9e786d41a27d1bc850eff4fc89e1c4b32974
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-17 12:17:28 +00:00
Guillaume (gdi)andRomain Derie 8f7c6997e8 [IMP] website: propose a new social media snippet
This commit introduces a new social_media snippet that allows social
networks to be displayed. This snippet shares the same options as the
share snippet, but also provides a list to edit the URLs of the social
networks in the company data (social_facebook, ...). This list also
allows to manage links to custom social networks (which are not stored
in the DB).

Headers and footers now use this new social_media snippet instead of the
share snippet and in the settings, the urls to the DB social networks
are editable/visible only in developer mode.

task-2687447

closes odoo/odoo#80217

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Co-authored-by: Guillaume (gdi) <gdi@odoo.com>
Co-authored-by: Romain Derie <rde@odoo.com>
2022-01-16 23:36:46 +00:00
Guillaume (gdi) 3dde03308d [IMP] web_editor, website: add placeholder and undeletable on we-list
This commits introduces new behaviors on the we-list:
1. Possibility to add a placeholder on inputs
2. Possibility to make elements non deletable
3. Possibility to make element activated/toggled by default
4. Possibility to generate ID for new elements

task-2687447

Part-of: odoo/odoo#80217
2022-01-16 23:36:46 +00:00