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>
This commit introduces a tooltip to indicate to the user that he can
drag and drop the block into the page.
This tooltip is shown after a delay; if the user has started dragging
the block in the meantime, the tooltip won't be shown. Otherwise, it
auto fades out.
task-2431469
closesodoo/odoo#81430
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
*: web_editor
Hovering the shadow mode option reset the entire shadow instead of just
previewing the mode change.
Related to opw-2701512
closesodoo/odoo#81980
X-original-commit: cae1b99052ded63a3e532b92419236dd51056fd8
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Steps to reproduce:
- Install `website_hr_recruiment` module
- Go to `your_website.com/jobs`
- Activate Edit mode and add a "3 Columns" block
- Select one of the columns and set the shadow to `None`
Issue:
Shadow is not removed, and by default the "outset" mode is selected.
Cause:
When we check the state of the shadow with `css('box-shadow')`, it
will always be set because a custom css 'box-shadow' is set by the
module website_hr_recruitment on card element, and therefore the value
will always be either 'inset' or 'outset'.
Solution:
If widget value is set to '', replace `box-shadow` style to 'none'
(only if needed) so it will override the style from css file.
opw-2701512
X-original-commit: 212d8ec10bb48e8fd7de3d3ff7660447b968c62a
Part-of: odoo/odoo#81980
Co-authored-by: qsm-odoo <qsm@odoo.com>
When clicking on save, the saved HTML should be what the user currently
sees. Before this commit, there might be cases where clicking on save
actually triggers a DOM update which occurs too late for the change to
be considered for the save. In 15.0, this manifests for example with
the blog cover saving*: if the color is being changed with the
colorpicker and that the user does not close the colorpicker before
saving, the color change is not considered because the previewMode=false
update of the colorpicker is not received. With this commit, we ensure
that DOM updates which occur because of the click on the save button
are considered before saving.
* That bug is however due to two other issues which are being fixed with
the PR at [1].
[1]: https://github.com/odoo/odoo/pull/79028closesodoo/odoo#81762
X-original-commit: 508332963202090bace0a3c877574132063c29a6
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
The previous code resulted in only the last editor to trigger its
handler having hints, as all the others would be killed by the last one.
closesodoo/odoo#81743
Task-id: 2632841
X-original-commit: e24b039ea120597ff5438deca3c69c7a1d54cd31
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Before this commit, it was possible to drag and drop a popup inside an
oe_structure which was itself inside an other oe_structure (e.g. snippet
parallax). It didn't make sense and moreover created bugs.
After this commit, it is no longer possible to drag and drop the popup
snippet or the newsletter popup snippet in a substructure.
task-2491976
closesodoo/odoo#81669
X-original-commit: 49050c124795852ce7ad51b92958498972730dcf
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
When pressing enter at the edge of an anchor that is a child of an
unbreakable element, we inserted line breaks in the anchor itself, which
is unexpected. This inserts the anchors after/before it instead.
closesodoo/odoo#81662
X-original-commit: df6f8dd0c54c40ea7edbd3821ae068d79b1b7af7
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
The snippet selection was lost on every action in mass mailing. The code
that prevents that was checking if the target of a click was the body
element but for mass mailing we needed to be a little bit more
restrictive since the editable area is not the body itself and we want
to actually prevent changing the snippet selection when the target is
the iframe target as well.
Since the mailing itself has a options, the sidebar is actually never
empty and therefore removing a snippet doesn't bring us back to the
block tab. Since therefore also ensures that we actually do.
task-2716397
X-original-commit: ecdb71bf6a566f5f6c294904e84f2132561dbb3c
Part-of: odoo/odoo#81662
Prior to this commit, the color presets generated by the color palette
would always be visible by the user which could lead to confusion.
Most users would click on the presets and edit them instead of editing
the color palette.
This commit groups the presets into a collapsed section under the color
palette to incentivize the user to click on the color bubbles instead.
task-2687469
closesodoo/odoo#79921
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Tests showed that users didn't understand the goal of the search bar
above the snippets block under the tabs.
This commit changes the placeholder of the search bar to better
indicate its purpose.
task-2607728
closesodoo/odoo#81222
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
A console.warn instruction was added with [1] in case an user interacts
with an editor widget which does not declare any linked option method
(as it is most probably a dev mistake). We have cases where it makes
sense though, adding a custom button with more complex events and
interactions or simply in some strange custo. This warning prevents to
test those uncommon behaviors in a tour test (which is what following
commits of this PR are trying to do).
This commit simply removes the warning.
[1]: https://github.com/odoo/odoo/commit/be05ac7e2b8d866a72693b761f3bc8576d54e59e#diff-ffb61e86e6b8297ef8997f9c605de14de896b54161c032d88a80bbaeac4f89beR490
X-original-commit: 1b18747c7a328df142d7b2cf206a84c39d5eac05
Part-of: odoo/odoo#81557
A traceback was triggered when removing flex styles in convert_inline.
This is fixed by iterating over the styles rather that over all keys of
the style object.
task-2697159
closesodoo/odoo#81540
X-original-commit: 18db94d9fc320c35e811d991fc4a32533d481083
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This adds a `toInline` function that replaces the code that was
duplicated between convert_inline and mass_mailing_widget. The
duplication was confusing and error prone.
X-original-commit: 916582af2d707fc1aa462c6feffa3f5defda75a2
Part-of: odoo/odoo#81540
This simply reorders (alphabetically and public/private), renames and
document (with docstrings) all functions of convert_inline.
X-original-commit: 970a3686b1f5edea97bbf86bf4fadc90cfe63357
Part-of: odoo/odoo#81540
When saving an email, its contents pass through convert_inline to ensure
wide e-mail client compatibility. One phase of that process is the
conversion of classes to inline styles, which involves parsing through
all the styles in all the stylesheets of the document, and matching them
with each element in the DOM. That is an extremely expensive process and
because of that, saving an e-mail can take a very long time depending on
how large the DOM is.
This refactors it for performance gains. Tested on an exaggeratingly big
DOM, what used to take about 12s now takes about 5s.
- The process of parsing through the document's stylesheets is now done
on opening the email (about 500ms) rather than on saving it so we
split the processing time between the two.
- When parsing the stylesheets, we now also preprocess them by grouping
whatever can be grouped together and precomputing the specificity so
as to sort them appropriately. This has the benefit of considerably
reducing the number of rules to iterate over for each element (from
11k+ to 3k+).
- In the process, some things were re-written for improved readability.
X-original-commit: 10e749537186dfb80aee1f2537f3b5804f66cfe5
Part-of: odoo/odoo#81540
This provide tests for the main unit testable functions of
convert_inline, as well as a couple of test utils to that purpose.
X-original-commit: 6a17ff7442a8395663c3e215cc14c057c098d4b5
Part-of: odoo/odoo#81540
This introduces a doctype declaration in the initialization of html
fields iframes and wysiwyg iframes. That prevents the browser from
rendering in Quirks mode[1] which makes tables override the usual style
inheritance patterns. As a result, this fixes an issue with text colors
and alignments that were lost on converting divs to table structures.
[1] See https://developer.mozilla.org/en-US/docs/Web/HTML/Quirks_Mode_and_Standards_Mode
X-original-commit: da5cf4bcac696a73c33d856ac889342fe8670e65
Part-of: odoo/odoo#81540
This covers minor refactors in convert_inline, and adds docstrings to
some of its functions that were missing them.
X-original-commit: 7c67a703ac5874cbd05ab5e82f566499b1e07849
Part-of: odoo/odoo#81540
There was a section of code in `getMatchedCSSRules` that didn't do
anything. Essentially its loop did `a === b ? a = b : break`. As for
what was done before the loop (a = b), it's what is done with the styles
returned by `getMatchedCSSRules` in `classToStyle`.
X-original-commit: 835dba6ec02f1eb4dc43c33fc3bd5eab08032707
Part-of: odoo/odoo#81540
There was dead code in `addTables` that would never get triggered. When
fixing that, the code crashed because of a reference to the wrong
variable. Those two problems are hereby fixed.
X-original-commit: 21dccd1521c654eb9723a93bceda8e3e3ec8cc6a
Part-of: odoo/odoo#81540
When converting an rem size to a pixel size, we sometimes ended up with
values with many decimal places. This rounds them to one decimal place.
X-original-commit: 8f8d5bf93f60560040a37695c3439600d5d88287
Part-of: odoo/odoo#81540
A percentage height will only be applied on an element whose parent has
a set pixel height. This is why convert_inline applies a pixel height to
the parent of each element with a percentage height when possible. But
it failed in the case where said parent also had a percentage height.
This keeps looking up the tree until we find an appropriate suitor for
that pixel height.
X-original-commit: a9b0184087bec08db523a02068cc3d04b5f1381e
Part-of: odoo/odoo#81540
For the purpose of good compatibility across email clients, we need
paddings to be applied to cells rather than to tables. The mechanism in
charge of that wrongly added up the paddings, and excessively rounded
them to integers. This commit fixes these issues.
X-original-commit: 6c6e0c18176b41bd1c6967973d0e774f8094c76f
Part-of: odoo/odoo#81540
When converting a list-group to a table, we sometimes ended up with <li>
in <td> element, which is non-sense and is hereby corrected.
X-original-commit: 41eda109d2fbc0eb6616fb03102a205b945ab9b2
Part-of: odoo/odoo#81540
When converting the last row of a grid to a table row, we may end up
having handled all of its columns, but there is still space in the row.
This ensures we properly insert the columns and fill the row.
X-original-commit: 52c35361a0cc86e87337ef321c1b198d4f8cc3c1
Part-of: odoo/odoo#81540
This fixes an issue with the conversion to table of rows that had such
long columns that they should span more than two rows.
X-original-commit: 4daf4378db023365415994296ea7bac53ecb907c
Part-of: odoo/odoo#81540
The http.addons_manifest is a map {module: manifest_dict} that is
populated upon the first http request. This map is basically a module
manifest cache with an extra `addons_path` key, the path of the module
on the file-system. This cache is eagerly populated upon the first http
request, the map is empty in non-http contextes (e.g. cron) which have
been a source of bugs (e.g. 50c8eb1).
A manifest cache is necessary because reading and parsing python files
from the file-system is not that cheap but there is no reason that cache
is located in `odoo.http`. A thin cache layer now wraps
`load_information_from_description_file()`/`load_manifest()` and is
lazily populated.
The `http.addons_manifest` have been removed. The extra `addons_path`
key is now present in the "normal" manifest. The `read_manifest()` was
hardly used so it has been deprecated. The only way to retrieve a
manifest is now `load_information_from_description_file()` which was
renamed `load_manifest()` (no cache) and `get_manifest()` (cache).
Side note about performances, the cache is necessary. Addons manifest
are read-only and reading + parsing python files from the file system is
not a cheap operation. Running the e-commerce tour
`@website_sale.test_04_admin_website_sale_tour` without cache on
`load_manifest()` requires 68,29 secs to complete on my laptop,
exceeding the default 1-minute time frame allowed in tests. Using a
cache the time is down to 36,53 secs. The performance impact is huge.
Part-of: odoo/odoo#79977
Before this commit, the EditMenuDialog was closed before reloading the
page. [1] introduced a new test on this dialog using a workaround to go
to the next step when saving, after the page was reloaded. This
workaround used an unreliable event 'unload', which was inconsistent.
To avoid using that event, the edit menu dialog is not closed after
saving. A new parameter closeOnSave is added to the wysiwyg Dialog,
which allows to keep the dialog open until the reload is done.
task-2513588
[1]: 725cad3478e5ab12ad7f0cf5166a2b968a1373da
closesodoo/odoo#81351
X-original-commit: d35125cc0444679488fa1a020b6bd8a6c4409b6f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Before this commit, editing a menu item after clicking on the "edit
menu" button of the link popover, in edit mode, would not save the
change.
This was caused by the "Double-click to edit" tooltip that is shown over
media and links. Triggering the bootstrap tooltip on a target leads to
attribute mutations (data-original-title, title and aria-describedby),
that were processed by the EditPageMenu observer to set a view as
o_dirty.
The website.menu was therefore saved a first time by the edit menu
dialog with the correct value, and a second time with the outdated label
from the page.
To solve that, the observer is deactivated when showing the
"Double-click to edit" tooltip over a link or a media, so that the
website.menu is updated only once, when saving the edit menu dialog.
task-2513588
X-original-commit: 4244b60f36acbdbdc17c24d45144604d1276c15f
Part-of: odoo/odoo#81351
There was an issue when saving the LinkDialog with invalid data.
The _DialogLinkWidget.save methods return values were not consistent.
Also, tests are added for the regular menus edition.
The existing mega menu edition test was not played from the python test
suite.
task-2513588
X-original-commit: 725cad3478e5ab12ad7f0cf5166a2b968a1373da
Part-of: odoo/odoo#81351
Co-authored-by: Arthur Detroux (ard) <ard@odoo.com>
[1] changed the event listener to toggle the link tools and the popover
on links from mousedown to click.
Before that, when clicking on the extra menu items toggle, the mousedown
target was most of the time the icon, so the link tools and the popover
were not initialized. Now, as we listen for the click event, the target
is the <a/> element, for which the tools and the popover are
initialized.
It should not be the case, as this is a technical element that the user
has no control over.
task-2513588
[1]: add3e05840869d4a885ca18a2bbabfcb61c7a83d
X-original-commit: f1f40517be9280c6f770a116e6909a6d147a3e43
Part-of: odoo/odoo#81351
when we crop illustrations using the editor crop tool,
the resulted image will disappear as soon as we save the update.
we have this issue because we cannot get the right svg string using
toDataURL on the new cropped canvas with mimetype = 'image/svg+xml'
(see 'web_editor.image_processing' > 'applyModifications')
To solve this issue we set svg illustrations as uncroppable (for now).
task-2312878
closesodoo/odoo#81179
X-original-commit: fdddac4f9c19515f5631ee7e9a05f9ad798b07a1
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
In a undeterministic circumstance, the editor element is not
in the page at the moment of checking it. There is probably
some promises somewhere that remains unresolved and
prevent the element to be inserted in time.
Task-2682104
closesodoo/odoo#81139
X-original-commit: f2557455ed164fc52e38a45ba14ae15f4125c202
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
It is possible that the wysiwyg focus method is called before the
odooEditor being loaded. This commit insure that the odooEditor
properly being loaded.
Task-2704538
closesodoo/odoo#81114
X-original-commit: 33782020906988322598c4a3e61b8a6b16970aa0
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Whenever there was a tag inside a link
(e.g.`<a href="..."><b>link</b></a>`), it was impossible to unlink.
closesodoo/odoo#81112
X-original-commit: a7f2027c6131309b239026b4e1299a6f396171dd
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
A designer may not have access to ir.model.fields, use the fields_get
helper instead
Fixesodoo/odoo#80948closesodoo/odoo#81123
X-original-commit: 826100a5b5ecaf62dfe6870bf5ad48a37cd2d7f7
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>