Whenever we clicked on a link that contained another element
(eg. span, bold, ...), the LinkTool did not open.
Task-2667989
closesodoo/odoo#83437
X-original-commit: d69d26a2dd8830aca8c5922d3548e5ff59c688fc
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
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
closesodoo/odoo#83396
X-original-commit: 0e37742d3caba1c6544e5b466503f155626375eb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#83378
X-original-commit: da7c1b5757a7780897c5736ddecc014a7fb50bdb
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
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)
closesodoo/odoo#83306
X-original-commit: 97da1c2106d2a0e76dff1353e56b74d70db55eb2
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#83295
X-original-commit: ebeeaf492285c9c1c9d9fd6e359dca27ee315021
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
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.
closesodoo/odoo#83098
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#83233
Related: odoo/enterprise#23695
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
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
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
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
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
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
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
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
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
When the user-select is none in firefox, it is impossible to select the
text even if the content is editable.
Task-2716365
closesodoo/odoo#83255
X-original-commit: 88a5269b2130bc82c48bc587a042c24062bc4e96
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
closesodoo/odoo#83254
X-original-commit: 5d8d98812a4f351abd27389c4992bf9e753833b7
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
In some undetermined circumstance in chrome, the selection rect is
wrongly defined.
Task-2728792
closesodoo/odoo#83248
X-original-commit: e9ee8175538e1201acb2ae108b2283f55217ca5f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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`.
closesodoo/odoo#83131
X-original-commit: 0d4342317d456ed37f0bf24f00538ef54f847e60
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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).
closesodoo/odoo#83137
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
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).
closesodoo/odoo#82924
X-original-commit: fb675251ce8b13d36dfac7a50e9b1cea4759cc02
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
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
closesodoo/odoo#82880
X-original-commit: 4cfa9e786d41a27d1bc850eff4fc89e1c4b32974
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
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
Since [1] options could still be used while a background positioning
overlay was opened.
After this commit the overlay is deactivated whenever an element outside
of it is clicked - as initially intended.
[1] https://github.com/odoo/odoo/commit/dfd98f49e7f2ab5c94dcae3af2d14750d301fa0a
task-2735690
closesodoo/odoo#82824
X-original-commit: 574ae49acb950d99ef4ab2b0504cfd7f39bca406
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Whenever the browser is lagging between multiple enter,
the command hints were not being updated until the browser
main thread process the event queue.
Task-2728794
closesodoo/odoo#82795
X-original-commit: bfed1edd26312488dc0f45e8982b51ea4d98db76
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
When clicking, double clicking or triple clicking in the stars widget of
the Powerbox, we don't want to see the regular options of icons or text.
This prevents them from showing.
task-2575449
closesodoo/odoo#81920
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Similar to checklists, this allows the user to click the powerbox stars
widget even in readonly mode, so as to change a rating without going in
edit mode.
task-2575449
Part-of: odoo/odoo#81920
When a checklist is present in an html field, there is a feature that
allows us to check/uncheck its boxes without going through edit mode.
That feature was broken due to a dead callback in wysiwyg.js, which is
hereby restored.
Meanwhile, the behaviour of checklists had changed but the python code
handling the readonly checking/unchecking hadn't so this brings it up to
date[1].
Finally, the code managing checklist ids was unnecessarily complicated
as it was trying to keep the ids consecutive for no particular reason.
This refactors it to simply use unique ids based on date stamps.
[1] It used to be that checking a box checked all the children of that
box but it was in the meantime decided not to do that anymore.
Part-of: odoo/odoo#81920
This adds two new widgets to the powerbox, which allow the user to
quickly insert 3 or 5 stars, then click on them to color them gold.
task-2575449
Part-of: odoo/odoo#81920
In mass_mailing, creating a link from the linktool in mass mailing
generated link that would not create a new tab when clicked.
Task-2734760
closesodoo/odoo#82735
X-original-commit: c6b7556a35182174c3384c2069256826205bba22
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Whenever adding a snippet from the powerbox, the postprocessing was not
made. This could result in unexpected behavior of the snippet.
Task-2601600
closesodoo/odoo#82694
X-original-commit: bcbf8e59c83200cb079ef15cb1fa5f7783023d88
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Before this commit a "List" command hint was set as placeholder in
navigation items without content upon selection of the header menu. This
showed up when using the sidebar template of the header menu.
After this commit the command hints are blacklisted for nav-items in
website.
task-2677310
closesodoo/odoo#82693
X-original-commit: e0cc23b44d798a5bf79d3e8f7e183f5e8a3c6901
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This restores a (basic) feature that was lost in 15.0 by mistake.
Allow the user to set a link on an image. The user can access this link
tool in the editor panel or via the CTRL+K shortcut. This tool is very
similar to the existing link tool for texts. This tool uses the
suggestion system already existing on the text link tool.
task-2666467
closesodoo/odoo#82512
X-original-commit: bfcd25c5d66765b7436114dba3316ac7331a4d97
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
This commit ensures that changes are applied in the same order as the
events are triggered on the InputUserValueWidget. This was not the case
because of another bug we had to consider and which is not there
anymore, this is why this fix is done in 15.0 and not before.
Actually, this also greatly improves the inputs behavior using the
natural "change" event which occurs... when a change was made. Before,
if you hit enter 5 times then left an input, you had the option applied
6 times (which was particularly annoying for options which reload assets
like the header border or something like that).
task-2666467
X-original-commit: db62a5fac123fc72e37e94709b1a0c80f32a8a29
Part-of: odoo/odoo#82512
Co-authored-by: qsm-odoo <qsm@odoo.com>
*: web_editor, point_of_sale, pos_restaurant
The grab cursor is currently not working on all browsers (at least
Chrome Linux). The fallback rule does not even work, meaning that if
you type:
```
cursor: move;
cursor: grab;
```
Those browsers does not even use "move" as they see "grab" as valid but
use the "default" cursor.
This commit replaces our "grab" uses with a local cursor ensuring it
works.
Related to task-2431469
closesodoo/odoo#82093
X-original-commit: 23ebcca902781f2fa0f2381997be4f3d375385b5
Related: odoo/enterprise#23193
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Inside a scrollable popup, the scroll was not correctly triggered when
moving one of its snippets through drag and drop.
This commit correctly defines the SmoothScrollOnDrag.$scrollTarget when
a modal is shown.
task-2431469
closesodoo/odoo#82040
X-original-commit: 844051168311ac0c3e8640dda2a90545e373c98d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>