Trying to select the contents of a content-less element should select
the element itself instead.
closesodoo/odoo#69173
X-original-commit: 6905eaad2ccaa782e3dce99b9581ed0194c37db9
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Bootstrap sets a z-index of 1050 for modals while the editor's floating
toolbar has no set z-index and is therefore invisible in modals. This
ensures the visibility of the toolbar in bootstrap modals.
closesodoo/odoo#69160
X-original-commit: 9cd4eb6db072fd55d47240260e63fd5923b3bddb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
LinkTools were recently introduced to provide a new UI from link editing
within a sidebar where there is one. It was implemented separately from
the existing LinkDialog despite them having a lot of code in common. In
order to prevent future discrepancies between them, this commit
introduces the Link widget which contains the common logic for link
editing, to be extended by LinkTools and LinkDialog (via an intermediary
widget).
closesodoo/odoo#69137
X-original-commit: 5415ea46f8d3ee4732111a21b0cd9fa8bdb9526e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
The transcoder (transforming CSS rules into inline CSS for mail clients)
was not working for text-decoration property because it would transform
text-decoration values in:
{'text-decoration-thickness': 'normal', 'text-decoration': none}
And the regex that ensures we don't add duplicates check if there is:
"(^|;)\s*text-decoration"
so if there is text-decoration-thickness, text-decoration is not added.
The regexp could be changed to:
"(^|;)\s*text-decoration[^\w-]"
but we already have special case for other text-decoration-* properties.
With this change we should get text-decoration applied in:
- edit mode (was already the case)
- readonly mode (new)
- mail client (only if mail client does not override it)
As a side note: text-decoration-thickness seems to be rather new[^1] so
at one point in time there was probably no issue.
[^1]: https://developer.mozilla.org/docs/Web/CSS/text-decoration-thickness
opw-2496490
closesodoo/odoo#69078
X-original-commit: f4f1b890e15e98d9a7e72586faf73327d3f7b716
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Co-authored-by: Kamen Zhekov <kzh@odoo.com>
Focus is sometimes called on the Wysiwyg class in Note.
When the user use TAB to select the next field.
Implementation was missing.
closesodoo/odoo#69033
X-original-commit: 720c1f38a17ef54cf30e0a52bab5bceed70c2144
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Rationale:
The majority of cases where an ir.asset is manually declared
outside of manifest files is to specifically add a single asset file.
This means developers are specifying a single asset *path*, and not a
glob expression. In this context, it seems better to name the filepath
field `path`, and document that it can be specified with a glob
expression when (seldom) needed, rather than making the exception appear
to be the norm - possibly puzzling many developers (What's a glob and
why do I need one?)
The doc is updated as well, and some spell-checking and wording
improvements were done too.
This required some adaptations to the existing `ir.asset` declarations:
- odoo/enterprise#17465
- odoo/design-themes#459closesodoo/odoo#68695
Related: odoo/upgrade#2348
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
*: web_editor
It prevents user writing in the image preview of products.
Also, the product image view now fit its container so that the user can
click wherever in the frame to change the picture.
Part of https://github.com/odoo/odoo/pull/68823
task-2446852
closesodoo/odoo#68850
X-original-commit: e4f06666307e79b9a5b26357a1545a56e6bd40b2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Before, depending on the screen size, it was not always clear for the
user that he can use the search bar to find library images.
The upload buttons and search bars have been switched in order to make
the search the first choice for the user. Also, make the arrow pointing
at the searchbar more understandable.
task-2446852
closesodoo/odoo#68821
X-original-commit: 4237916d1f103baef5760e8508c9ebd5e91ac163
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Mobile browsers implement their own floating toolbar in text selections.
As a consequence, Odoo Editor's floating toolbar ends up mingled with
the native one, making it hard to use.
This commit, in conjunction with adaptations on Odoo Editor's side,
replaces the floating toolbar on mobile devices with a static toolbar on
top of the editor and adapts styles accordingly.
Some instance options of Summernote remained in the code after replacing
Summernote with Odoo-Editor. This removes them as they effectively did
nothing.
- The test was clicking on a link "too soon" in some cases (editing a
link then immediatly clicking on it while the save action is not fully
performed). Ideally, this should probably be more robust around the
save action to first edit the link synchronously then perform the
actual save in DB but this can be checked later on.
- Removed useless popover update while it was hidden.
- Make sure that two consecutive update of the popover only updates its
UI relying on the last asked data.
- Make sure the popover correctly clean what it did once destroyed
(however, it is never actually destroyed for now... to check later).
closesodoo/odoo#68686
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
*: website_form
This commit introduces a simple & light popover/tooltip (as in Google Doc) when
editing a link.
It will be used:
1. (web_editor) On every page links.
2. (website) In the website navbar, when clicking on a menu, it will replace the
popup shown to ask the user what he wants to do (edit the menu or go to the link
or do nothing). That popup was a bit invasive and old-fashioned.
Part of https://github.com/odoo/odoo/pull/64756
task-2439860
closesodoo/odoo#64756
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Conversion of all modules to the new manifest assets declaration.
Part of task: 2352566
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
This commit changes the way assets are declared in Odoo modules.
Before: assets were declared in template files. Template bundles were
generated from primary templates, so technically any qweb template could
have been called as an asset bundle, with the 't-call-assets' directive.
Being standard qweb templates, they had access to standard HTML tags
(script, link, with or without raw scripts or style definition), qweb
directives (t-call, t-raw, etc.) and could be inherited by other
templates.
Now: assets are defined in the module's manifest and generated by the
't-call-assets' directive.
More information on the new system can be found on the updated user
documentation (see the "JavaScript Reference" section).
Task: 2352566
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
This commit handles 2 things:
- Moves snippets used to call the summernte library inside several new
dedicated files.
- Removes a raw script declaration to move it to a dedicated file.
Also the calls to the lib files have been changed from a qweb loop to an
explicit list of script tags.
This has been done to improve consistency in asset bundles declarations
by reducing them to the simplest possible templates.
Part of task: 2352566
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
Before this commit, the asset bundle "_assets_helpers" was the only
bundle using a "t-raw" directive to insert assets in between other asset
calls.
Now _assets_helpers only contains the assets called before the t-raw
directive, and the second part (1 file actually) has been added after
every call of the bundle.
This has been done to improve consistency in asset bundles declarations
by reducing them to the simplest possible templates.
Part of task: 2352566
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
Override in enterprise web_studio of _saveView on error never rejected
promises. But now it does so the XML editor interface is not blocked
after error.
But we were already showing the correct error in web_studio use case, so
we don't want another one and this change allow that by only showing an
error if we received rejection value.
opw-2460081
closesodoo/odoo#68569
X-original-commit: 43184af875f3eb52586348b383627cb0140484f5
Related: odoo/enterprise#17395
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
We only support .gif, .jpe, .jpeg, .jpg, .png, .svg
This commit won't let the code go though if we know the image format is not
suported.
Part of https://github.com/odoo/odoo/pull/65828
task-2345082
*: web, web_unsplash
Without this commit, the user had no hint to know something was actually
being performed.
It would be worst when uploading multiple image at once, eg in image
wall, as it could take some times for the images to be processed and
uploaded.
The user now has a visual hint about the upload progress through a
toaster and some progress bars.
For unsplash, note that as the actual image download is performed S2S,
the progress bar will automatically jump to 100%, then will wait for the
RPC success once the server is done to show a success progress bar.
Part of https://github.com/odoo/odoo/pull/65828
task-2345082
Only allow URL ending with extension of supported image formats.
Don't let anything else goes though, so we remove the magic behavior
that was uploading a non-image url as a document.
Part of https://github.com/odoo/odoo/pull/65828
task-2345082
A lot of tests in different QUnit modules need this delay to be
patched to 0. Some of them (e.g. the 'ActionManager > Misc' module)
didn't patch it correctly. It worked before because a patch was
done in a previous test, and wasn't unpatch. The previous commit
ensures the patch is removed, so now we have at least 2 tests of
the above mentionned module that fail. This commit ensures that
the delay is patched in every tests, and allows to specify a
custom delay if necessary.
When clicking on link in html fields, we do not wish to start quick
edition. With this change this is excluded.
closes#68023closesodoo/odoo#68212
X-original-commit: ecbdddbf0cff0964b44e7f0571d372ccbd051a72
Related: odoo/enterprise#17235
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In #67893 the image icon was removed, but it contradicts the interface
and made a feature that was working for employee less available.
Since saas-12.3, we always use the full media dialog when showing the
editor on the forum so we could not add an image with the image icon if
were not an employee.
Before saas-12.3, the original summernote image dialog was shown for
everyone but website editor that saw the full media dialog (beecause we
are using the same editor to do both things).
With this change, we always have the original dialog in the forum
message editor thanks to a new option "disableFullMediaDialog".
opw-2470720
closesodoo/odoo#68166
X-original-commit: c026c360fb77ce43f47f7645f48e37bced988b85
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
*: web_editor
All theme specific color palettes have been moved into website.
It allows to access them without having to install theme modules and
this is a preparation for our website configuration screen task.
Lists of palettes have been replaced by maps with palette names as keys.
Those names are composed of the palette's original theme name ('generic'
or 'base' for palettes not specific to a theme) and of an index
(ex: 'anelusia-2'), for compatibility.
To keep compatibility with previous version we also convert old color
palettes number to color palette name, specifically for each theme.
A side effect of this change is that we got rid of all gray palettes
which existed in some themes. Those were not fitting the new possibility
of gray customization in the third panel and were not always really a
good customization of the default grays (they still were there mainly
for historical purposes). Unfortunately, this may have some side effect
for old websites which used those grays but the new gray palettes (left
to the default one) should most of the time come as an improvement of
the old ones, and they are now customizable by the user. In the future,
we may associate a perfectly-chosen default gray palette, fitting the
customization system, for each color palette.
PR: https://github.com/odoo/odoo/pull/67488
task-2451965
closesodoo/odoo#67488
Related: odoo/design-themes#455
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Before this commit:
- Edit mode, open image dialog
- Upload an image to the media dialog
- Reclick on Upload but don't select an image, close the browser image
selector
- This will trigger the input change event, as the input was emptied
This is needed since in later commit, `_addData()` will do some code outside
of the `files` loop, which is useless if there is no files selected.
In thise case, the issue would be that it would open an empty toastr.
task-2345082
Coming from #65828Closes#68326closesodoo/odoo#68340
X-original-commit: 94c45412714c1263788b2567ce3c9581453b2cd4
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Since the image util method `image_base64()` is converting BMP images to PNG
automatically[1], there would be a mismatch between the attachment content type
and the attachment mimetype.
- Content type: retrieve with `base64_to_image(data).format` -> return PNG as
the image data was converted from BMP to PNG
- Mimetype: set on `write()` and `create()` with `_check_contents()` which
call `mimetypes.guess_type(file_name)`.
BMP image `my_file_image.bmp` would have a mimetype set to BMP
The computed field `image_src` would return `False` since the image.mimetype
would be BMP, making the dialog picker not showing the image but loading
`http://localhost:8069/false` instead.
[1] https://github.com/odoo/odoo/blame/097f29d0f6a5b295c81fd074665dbd261eaf12fb/odoo/tools/image.py#L124
task-2345082
Coming from #65828Closes#68326
X-original-commit: ef5b108b781df73342bb99342a1116fad86d3b58
Previously, when selecting certain options, especially ones which had
slow updateUI methods, the selected value was sometimes reset to its
previous value. This was caused by a race condition in which, when a
snippet option updated its value, it would wait for options on the
parent snippet editors to update all of their options' UI, but it
incorrectly only waited for *one* of the snippet editors to finish
instead of waiting for all of them.
This commit fixes that by stopping the event propagation and triggering
a new event that will let the direct parent know when all parent editors
are done updating their options' UI before signalling that the UI update
is done.
task-2487578
closesodoo/odoo#68341
X-original-commit: 7623a0c771495cd41bf40af37c0d2b6e4beb7cdc
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Arthur Detroux <ard@odoo.com>
This commit introduces a many2many as a standalone, reusable
UserValueWidget. This widget is built on top of the ListUserValueWidget
which was until now only used in website form that had to be updated to
allow more generic use of the widget.
Part of https://github.com/odoo/odoo/pull/67832
task-2274732
*: web_editor
The purpose of this commit is to control the hue and the saturation of
the gray palette.
task-2362091
closesodoo/odoo#66428
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
Add an event listener triggered on current value change of input range.
task-2362091
closesodoo/odoo#66812
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
*: web_editor
Adding the option to show/hide on mobile at snippet level + review the
UI (now a top action button).
task-2431659
closesodoo/odoo#65013
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
The current rules would allow through a selector of the form
:not(sel1, sel2)
then because the matcher thing just splits on `,` it would store the
incorrect sections
:not sel1(
and
sel2)
as separate selectors in the rules cache, raising an exception when
matching against elements.
Move all the rules to a single regex, and add a rule to exclude any
situation where a comma or an open parenthesis is inside of an open
parenthesis pair: we can't just check if there's a closing parenthesis
with no intermediate `,`, because the selector could be
:not(:nth-child(3), sel2)
in which case the selector would "pass" as the regex would match the
nth-child's closing paren to the not's opening. This means some
selectors *could* be unnecessarily blacklisted, but currently we don't
have any such nested pseudo-classes so...
If we want to resolve this, we need to actually parse the
selector (using something like Sizzle I guess) in order to properly
split the selector-list and take a real look at the selector's
structure. Maybe one day.
closesodoo/odoo#68093
X-original-commit: d50c3b07f1c0644ac8e412f099ddd7b139671060
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>