Commit Graph
3174 Commits
Author SHA1 Message Date
Gorash a9343fae75 [FIX] web_editor: properly show snippet names via t-install directive
Since the refactoring done on ir.qweb at [1], directives are more
autonomous, so `t-att`, `t-options`, etc are no longer evaluated by
other directives. These directives are also ordered.

Before this commit, when directives such as `t-snippet`, `t-install`,
etc were called, the other attributes had already been consumed. Indeed,
at the end of the compilation, tags should no longer have attributes,
`t-att` removes all statics ones. So relying on the `string` attribute
in `t-install` was broken and so the snippet names for the snippets to
install from the editor panel in edit mode were gone.

This commit fixes that by evaluating those specific directives earlier.

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

task-2762377

closes odoo/odoo#84752

X-original-commit: f40b9522f20d5fbfe62c3718566c1d92ccfad75b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-02-16 18:41:23 +00:00
Antoine Guenet bf61c9a36a [FIX] web_editor: properly convert fonts to images
export_icon_to_png sometimes failed because PIL's getbbox returned None.
This fixes it by not using a default color of (0, 0, 0, 0) when creating
the image but using the actual color of the image instead.
Also, the size of the image was wrong because of using the default size
when width and height are defined.

task-2761098

closes odoo/odoo#84638

X-original-commit: efcb432f4c459b2d2d819c3aed7d63d53fc93809
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2022-02-15 14:55:05 +00:00
Antoine Guenet afc2e84a9b [FIX] web_editor: better align converted icons
Icons converted to images were improperly aligned because as inline
elements their vertical-align style property used their first block
ancestor as reference.

closes odoo/odoo#84513

X-original-commit: eb0fa518b563206afcc214a81f89cea45820b34c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2022-02-14 14:51:27 +00:00
Antoine Guenet 608a9909bc [FIX] web_editor: ensure border around comparison snippet
The conversion of the comparison snippet for mail compatibility involves
heavy changes in the html. In order to preserve the style, some style
changes were needed as well. This change to the style of cards allows us
to restore the border around the snippet.

X-original-commit: fae07f2dcd74ed3ce85d37cc7ea0180b40994ff1
Part-of: odoo/odoo#84513
2022-02-14 14:51:26 +00:00
Antoine GuenetandNicolas Bayet 18fb205c41 [REF] web_editor, mass_mailing: replace use of jQuery in convert_inline
jQuery was used extensively in `convert_inline`, slowing it down by a
factor of more than 2. This replaces all use of jQuery with vanilla
javascript so as to improve performance significantly.

X-original-commit: 8573a4ebbfe951c9ce0d3ef753174f4f0a6c829b
Part-of: odoo/odoo#84513
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Nicolas Bayet <nby@odoo.com>
2022-02-14 14:51:26 +00:00
Antoine Guenet 612cd4e092 [REF] web_editor: remove _applyOverDescendants
Rules used to be applied in the DOM sequencially, in traversal order.
This is slow and confusing to debug. Meanwhile, most functions had been
adapted to process the rules in a simple loop on the concerned nodes.
This commit does that for `classToStyle`, the last remaining function
that wasn't doing it yet, and removes the utility function
`_applyOverDescendants` altogether.

X-original-commit: 70253a98bd9d6752c29cfe61debf4567d0a872e8
Part-of: odoo/odoo#84513
2022-02-14 14:51:26 +00:00
Antoine GuenetandNicolas Bayet c40d9357fd [IMP] web_editor: apply rules only where needed
This improves performance of `classToStyle` by first selecting which
nodes and which rules will be concerned.
When parsing the css rules, we computed their specificity and normalized
their styles one by one. This applies these processes only on the
concerned rules, all at once.

X-original-commit: bb28624dcd69efe1aff546b37e66c05c001a5927
Part-of: odoo/odoo#84513
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
2022-02-14 14:51:25 +00:00
Antoine GuenetandNicolas Bayet 6ec2d52c6f [FIX] web_editor: remove rule grouping in css rules parsing
Since some css was loaded twice, when parsing rules, we grouped similar
rules in order to minimize the amount of rules on which to iterate
during conversion, so as to improve performance. This is not needed
anymore now css is loaded only once, so we can remove this extra
processing.

X-original-commit: 3db6f4a345015adf99c2a744066dcdf8f076a657
Part-of: odoo/odoo#84513
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Nicolas Bayet <nby@odoo.com>
2022-02-14 14:51:25 +00:00
Nicolas BayetandAntoine Guenet 96c859eb0a [IMP] web_editor: batch write in formatTables to avoid layout thrashing
This batches all writes in the `formatTables` method of `convert_inline`
so as to minimize layout thrashing and therefore improve performance.

X-original-commit: f3c0f0c62b9f31e47ef8644c79e1b9751d0ba746
Part-of: odoo/odoo#84513
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
2022-02-14 14:51:25 +00:00
Nicolas BayetandAntoine Guenet 382b77bec2 [IMP] web_editor: batch write in classToStyle to avoid layout thrashing
This batches all writes in the `classToStyle` method of `convert_inline`
so as to minimize layout thrashing and therefore improve performance.

X-original-commit: addf3e8fa37f4f2cc212a55a332ec61090655232
Part-of: odoo/odoo#84513
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
2022-02-14 14:51:24 +00:00
Nicolas BayetandAntoine Guenet a8cf97bdee [FIX] web_editor: prevent double-loading css in mass_mailing
`web.assets_frontend` was called in `wysiwyg_iframe_editor_assets` _and_
in `iframe_css_assets_edit`. As a result, they were loaded twice in edit
mode.

X-original-commit: 4bea292681039c1954c6c9038742fa6e2cc2c31e
Part-of: odoo/odoo#84513
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
2022-02-14 14:51:24 +00:00
Nicolas Bayet 8f829fb7bc [REF] web_editor, mass_mailing: remove unused code
`__extraAssetsForIframe` had been kept in `mass_mailing` and
`web_editor` for historical reasons but was not used anymore. This
removes it.

X-original-commit: 88b91df3ff75bb0be9a84761cb251d0b7b3c976d
Part-of: odoo/odoo#84513
2022-02-14 14:51:24 +00:00
Antoine Guenet 0791c31654 [FIX] web_editor: correct reference to editable in tests
Some tests depended on a variable to be defined, which was only defined
in other tests.

X-original-commit: d3e30a532526e7be54d6153a3ed375ff30d8f8e3
Part-of: odoo/odoo#84513
2022-02-14 14:51:23 +00:00
Martin Trigaux 9fbf706ba8 [I18N] *: export saas-15.2 translations
closes odoo/odoo#84475

X-original-commit: 8ea2605fbfec6277d7a01b6e73548a9585866c61
Related: odoo/enterprise#24289
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-02-14 10:44:50 +00:00
Guillaume (gdi) 05d133c47c [FIX] website, web_editor: fix form ids generation
Commit [1] modified the function that generates HTML ids, unfortunately
this was not done correctly and should have been done in all versions
since 14.0. This commit fixes that by bringing the benefits that commit
[1] brings (correction so that HTML Ids don't start with a number) but
without the defaults that it has.
See the related discussion here [2].

[1]: https://github.com/odoo/odoo/commit/3dde03308d4adffd861570230edcef1c5f7fc1c4
[2]: https://github.com/odoo/odoo/pull/80217#discussion_r787975515

task-2760205

closes odoo/odoo#84474

X-original-commit: 105f80e57cacf48dcdafc41dc3d1cf418c75311e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-02-14 10:44:46 +00:00
David MonjoieandAntoine Guenet d4835b20a8 [FIX] web_editor: properly solve image in image button bug
Commit 57701b2 resulted in another bug as links could not longer be
edited. This refines it so it fixes the bug it solved without the
nefarious side effect.

closes odoo/odoo#84464

X-original-commit: 84fd0b0a1bc1d874e7d6d6ff10b4fb6351f5a1af
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
2022-02-14 08:49:51 +00:00
qsm-odoo 7c0b026487 [FIX] web_editor: remove divs created by default shadow computation
The shadow option needs to create a div on the fly to be able to
retrieve the default shadow value. This commit makes sure these divs
are also removed when no longer needed.

This also simplifies the code and actually avoids that div creation when
it is not needed.

task-2752326

closes odoo/odoo#84324

X-original-commit: 309f03c011fc8e5e0bec9882af54a8147025118f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-02-11 15:04:48 +00:00
Antoine Guenet 1eba237f64 [FIX] web_editor: prevent traceback on create and quick discard mailing
In mass_mailing:
1. Click CREATE
2. As soon as it appears, click "DISCARD"
3. Wait a little bit
-> A traceback appeared.

That is because wysiwyg was still busy starting and, in that process,
requested the window object of the iframe that was already removed.

closes odoo/odoo#84358

X-original-commit: 48ce4f0f834b55692e32868194a635b817c6ed13
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-10 15:43:00 +00:00
Antoine Guenet 533bf1ee1e [ADD] mass_mailing, web_editor: add editor message on empty mass_mailing
When choosing the empty template for mass_mailing, it was confusing to
face a blank page with a tiny dropzone. With this we adopt the website
builder's solution, which is to include a message when the page is
empty. That message functions as a bigger dropzone.

task-2734469

closes odoo/odoo#84356

X-original-commit: fbe048c202ff7878984adf26bef0651a45851f0a
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-10 15:42:56 +00:00
Antoine Guenet 03ffa1d1c7 [FIX] web_editor: prevent traceback on destroy link tools
When saving a mailing with the link tools open, link tools' destroy
is called after OdooEditor's destroy, causing a traceback when link
tools tries to set a history step.

task-2733825

closes odoo/odoo#84354

X-original-commit: f565f965fdc15d744efd38cfca9b098e24181e7e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-10 15:42:52 +00:00
Nicolas Bayet 9ab1bb66f5 [FIX] web_editor: add youtube video from paste
The PR #44537 changed the method _createVideoNode to be async while
the wysiwyg still called the method as if being sync.
This commit adapt the code to be asynchronous.

Task-2727906

closes odoo/odoo#84327

X-original-commit: 683de2b41c2e3699c39126852c82f1bb988bd3e9
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-10 13:30:48 +00:00
Antoine Guenet 34e8b7874b [FIX] web_editor: properly add image in editable rather than in toolbar
In mass_mailing, when clicking the media button in the toolbar, the
image would end up being added to the media button itself rather than
at the selection. That is because the selection had been replaced by
the button. This fixes it by preventing default behavior of the
mousedown event on toolbar (thereby preventing the change of selection).

task-2745984

closes odoo/odoo#84218

X-original-commit: da55a5fa6344734bf751a5976e0dc5bdacd4e119
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-09 08:13:54 +00:00
Antoine Guenet 3b5497169d [FIX] web_editor: prevent horizontal overflow of toolbar in website
Since the introduction of the strikethrough button, the text toolbar
overflowed website's sidebar. This reduces their size so they don't
overflow.

task-2758967

closes odoo/odoo#84190

X-original-commit: 896c64cdf74e5c602a92a28f95f79e20c08ffd87
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2022-02-08 15:48:12 +00:00
Antoine Guenet 23278b7b5a [FIX] web_editor: prevent height 0 on mailing
When saving a mailing (mass_mailing) with invalid fields, the mailing
ended up having a height of 0. This is because some changes from
convert_inline are applied inline and may be incompatible with the grid
structure of the mailing. This was the case with height=0 applied on the
mail layout element as a result of it having a child with a height
expressed in percents. Rather than set the height to 0, we now set it
to whatever the height was measured to be.

task-2734605

closes odoo/odoo#84174

X-original-commit: 5c606188d1a57a0702213298f5ffa3ace8fd5523
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2022-02-08 14:53:59 +00:00
stefanorigano (SRI) 0f64e506f2 [MOV] web, * : move font-awesome library in an editable location
This commit "forks" fontAwesome into `src/libs` in order to allow
further customization.
Part of v16 overall restyle (task-2704984).

task-2745275

Part-of: odoo/odoo#83501
2022-02-08 12:05:54 +00:00
Antoine Guenet 3b7a9671fd [FIX] web_editor: ensure fontawesome icons displayed on buttons
The undo-redo buttons on top of the snippets menu of mass_mailing had no
icon when website was not installed. This was because there was css
forcing the font family to something other than fontawesome. This
ensures we don't do that for elements with the "fa" class.

task-2746002

closes odoo/odoo#84126

X-original-commit: b3a91899cd7e6772a241badfc0bd9699bb6e0e74
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-08 07:20:06 +00:00
qsm-odoo a0ddaa8931 [FIX] website, *: restore unconventional dialogs opening + review scroll
*: web_editor

Commit [1] was not coded defensively enough: after it, dialogs not using
a proper bootstrap structure triggered a traceback once they were opened
(this was discovered on odoo.com where such unconventional dialogs do
exist). Bad luck: there was actually a check to allow unconventional
dialogs but it was not done at the right location.

However, fixing this, it was found that more than this was not ok. There
is actually no need to consider the modal-content element at all. Just
using our `hasScrollableContent` method is enough and requires no extra
search in the DOM. This actually also properly computes if the modal
overflows or not while it was not the case before as it did not consider
the modal-dialog element's paddings.

Finally, the whole customized behavior of the modal scrollbar here was
only designed to affect our Odoo modals with the s_popup_no_backdrop
class (see original commit [2]). Indeed, only in that case we want to be
able to switch between body scrolling and modal scrolling while the
modal is opened. In custom cases and other Odoo cases, we want the
standard Boostrap behavior of only being able to interact with the modal
while opened. This commit cleans the code to restore that spirit
(hopefully this does not cause stability issues as [1] was introduced
only a week ago). Sorry for any inconvenience.

[1]: https://github.com/odoo/odoo/commit/8f1dd6d6087ad8252d6e7b22d13aad2c4a3f19c6
[2]: https://github.com/odoo/odoo/commit/e5a5f98819b3a70b3e2564fb91722cab415ceea9

X-original-commit: a2363337355ccf4363249657000cd85bfcb3ab4e
Part-of: odoo/odoo#84139
2022-02-08 00:07:22 +00:00
Nasreddin Boulif (bon) 2ca5fdcaac [FIX] web_editor: resize favicon preview image
Steps to reproduce:

  - Install Website
  - Go to Settings -> Website
  - Replace favicon with a 'big' image
  - Go to Website and edit any page
  - Click on Home

Issue:

  Favicon preview in popover is too big.

Solution:

  Set a max height/width for favicon preview (16x16).

opw-2744522

closes odoo/odoo#84101

X-original-commit: bb90ff7f320f815310ca8e76d19bccadf4204cc2
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
2022-02-07 17:15:52 +00:00
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