The optimize modal was adding images to the modal even when closing
without optimizing the image.
Now when we close the modal, no images is append to it, same if we
click on "Keep Original" while optimizing an already existing image.
Part of #33983
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
The wysiwyg.widgets.image.existing template was not used and
reintroduced in a refactoring. It is now gone as it should be.
Commit where the template is removed with its only usage:
(in editor.xml as web_editor.dialog.image.existing)
78a30d44cf
Commit where the template is reappearing refactored but not used:
f296992317
Part of #33983
The div that is replaced with the existing.attachments template was not
the right target and kept nesting div into each other.
The parent div of the existing.attachments now has the
o_we_existing_attachments class (the target to be replaced by itself).
Part of #33983
Under certain unknown conditions, the range cannot be applied and
triggered an error. In order to allow the user to keep editing, we need
to prevent the dialog from showing, hence the use of `console.error`.
If this error appears, the carret is moved to the beginning of the focused
node.
If this error appears, then bullet can generate an error (I managed to
have the bug once or simulate it by manually breaking the dom and range)
closesodoo/odoo#34284
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
The new editor of https://github.com/odoo/odoo/pull/29775 came with a
fullscreen option. When using the toggle when the editor is in inside
a modal, the editor stretched only to match the size of the modal
instead of the viewport.
This is because the 'position: fixed' rule which is used to achieve the
fullscreen layout cannot work if a parent of the element has a CSS
transform applied on it. Indeed in that case, that element acts like the
viewport for 'position: fixed' elements.
closesodoo/odoo#34272
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Under certain unknown conditions, the range cannot be applied and
triggered an error. In order to allow the user to keep editing, we need
to prevent the dialog from showing, hence the use of `console.error`.
If this error appears, the carret is moved to the beginning of the focused
node.
If this error appears, then bullet can generate an error (I managed to
have the bug once or simulate it by manually breaking the dom and range)
closesodoo/odoo#34188
Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
Since 72f7139f52, config.debug does not exist anymore, config.isDebug()
should be used.
Two commits merged at the same time were still using config.debug, 87a35d4263
and 88a26235caCloses#33961
In order for the map view to work properly:
- I moved scss property to a file only scoped to website module.
- moved the definiton of "partner_latitude" and "partner_longitude" from
base_geolocalise to base/res.partner
closesodoo/odoo#32487
Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
* website, mass_mailing, web_editor
This commit adds various improvements in newsletter snippets as follow:
- Improves UI for newsletter popup.
- We only had one popup for all websites. Now, we can have a different
popup for each website.
- The popup was not appearing on mobile/tablet devices. Now, in
mobile/tablet devices, the popup appears automatically after 5secs.
- Added the ability to customize the whole editor popup like any
editable area (background colors, etc).
- User needed to enable popup snippet from the settings. We removed that
setting so now popup snippet will always be available.
- Added new snippet "Newsletter block".
- Display notification after successful subscription the same way for
all newsletter snippets.
Closes https://github.com/odoo/odoo/pull/29353
task-1903256
closesodoo/odoo#29353
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
This commit removes the field `datas_fname` from `ir.attachment` as
it was unnecessary and most of the time the duplicate of `name` or
`url`.
Task #1909865closesodoo/odoo#32976
Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
Before this commit, both config and session were aliases to odoo.debug.
Now, config.isDebug() should be call, with possibility to pass a parameter to
check if we are in a specific debug mode such as 'tests' or 'assets'.
task-1934445
Coming with https://github.com/odoo/enterprise/pull/4281
Closes https://github.com/odoo/odoo/pull/33213
* = website, website_blog
The goal is to give the user an opportunity to optimize his images before using
them.
For this we introduce a preview/configuration dialog after every image upload,
where appropriate default values are filled for the quality and resolution,
based on where the image is going to be used. Since this is not going to be
perfect all the time, we still allow the user to configure them, and we display
a preview to ease this process.
Indeed it is important for SEO and for usability in general that the images are
as light as possible in size.
Technically the original image is uploaded and saved first, and then it can be
optimized. This way the upload only happens once, and the preview can be
computed from the already saved image.
task-1930726
PR: #31208
* = web_unsplash, website
Remove iframe upload and replace it with a proper RPC. The route is now only
accepting one file at a time, which makes it easier to maintain, and allows to
process the first file as soon as it is ready, instead of having to wait on
everything.
Also fix a bug where a document could not be uploaded because it would try to
parse it as an image.
Remove filter after search result from the JS and add the corresponding
conditions in the domain to avoid processing and returning unnecessary records.
If multiple attachments exist with the same URL, now display them all to avoid
confusion.
Compute all the necessary values in the python model instead of in the JS.
Allow SVG in the widget (the server already accepted them before).
Disable multiple image upload when not in multiImages mode.
task-1930726
PR: #31208
* = web_unsplash, website_blog
Rename "image" to "attachment" when appropriate in FileWidget
Improve image selection / highlight code (now based on attachment id)
Improve image grid view:
- Remove the row mechanism and replace it by a single loop over the images.
- Take advantage of row wrap for a responsive display.
- Uniformize the height (prevent tall images from moving down everything).
- Load a miniature of the images when possible, remove the loading placeholder.
This should significantly reduce the download size when opening the dialog,
at the cost of CPU usage on the server.
- Split the existing image view into one view for the loop and one view for the
image itself. This way in a following commit we can reuse the image view
when adding a new one, instead of having to render everything again.
task-1930726
PR: #31208
- End of list in image library
- Title add menu item
- Warning message in html/css/js editor
- Wording building block sections
Part of https://github.com/odoo/odoo/pull/30986
task-1939869
Issue: Can not drop an image into the modal's editor because the server
request a positional res_id arguments.
closesodoo/odoo#33232
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
When dragging a snippet in the editor, drop zones are created at the
correct locations (e.g. between columns when dragging a column). Some
code is in charge of "cleaning" the created drop zones to, for example,
remove multiples ones which are at the same position. This code is also
currently removing the drop zones which are between two "non-block"
elements. This is preventing to swap form rows thanks to the form
builder as rows are "non-block" elements as they are flex elements.
This commit solves the problem by changing the "is non-block" condition
to "is inline" condition which is what was intended.
Note 1: rows became flex elements with BS4, that is why this is fixed
in 12.0.
Note 2: this could be back-ported in previous stable versions as this
actually preventing to drop snippets between tables, list
items, etc (all non-block elements) but this can be considered
as a limitation unless a real breaking case presents itself.
See task-1874350 which discovered the bug.
closesodoo/odoo#33054
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
The link and media tooltips were not taking Summernote's `tooltip`
option into account. That option ensures that tooltips are disabled if
the option is off (which is for instance the case on mobile).
This fix ensures that these tooltips are disabled when the option is
set to `false`.
It also disables tooltips in the keyboard tests. They are not relevant
to the keyboard tests and occasionally caused the DOM to not be properly
cleaned after the tests were run (most likely due to their 2000ms
`setTimeout`).
Have a fieldHTML as:
```
<p>
Some text
<br>
<br>
More text
</p>
```
In the Html field widget, place your cursor before the "M"
press Enter to insert a newline
Before this commit "Some text" and the subsequent `<br>` were deleted
This was because the code:
- split the original `<p>` into two
( i.e. it became
```
<p>
Some text
<br>
<br>
</p>
<p>
More text
</p>
```
)
- took the last child of the first p, which is a text then fell back to the first p
- replaced the whole p with <br>
After this commit, the original p is still split, but we append the br to it instead of replacing it
closesodoo/odoo#32777
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Commit 42530b02fe was fixing a bug in reports that were using the standard
bootstrap fonts instead of the changes we made in $font-family-sans-serif
To solve this, 42530b02fe replicated the change in the file
web_editor/static/src/scss/bootstrap_overridden.scss
which is imported in report_assets_common **before** web._assets_bootstrap
This was solving the issue for the report but had also the side-effect of
changing body font-family in enterprise as the bootstrap_overridden.scss file
is also used in web_editor._assets_backend_helpers and
web_editor._assets_frontend_helpers
42530b02fe had effect only on enterprise where the desired font is Roboto/Noto
Create a new bootstrap_overridden (6th of the name) file only for report
closesodoo/odoo#32902
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Converting a checklist into an ordered list didn't remove the
o_checklist class. In consequence, converting a checklist to an
ordered list and then to an unordered list failed as the unordered list
with the o_checklist class is effectively a checklist. This fixes that
bug.
closesodoo/odoo#31432
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
For some Chome version (e.g. 74 chrome verion on Debian) the iframe
trigger 'load' event twice (one time for document and on time for body),
the widget must insert the content in the body. Before this fix, the
content are add only one time and are removed by the next iframe loading.
closesodoo/odoo#33561
Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
When trying to remove a format (bold, italic, underline), collapsed at
the start of the DOM, an error occurred because of a wrong range.
Ex.: `<p><b>Odoo</b></p>` -> when clicking before the word "Odoo", then
clicking the "bold" button, we expect to be able to start writing in
plain (not bold) text (for that, the DOM has to look like this:
`<p>\u200B<b>Odoo</b></p>`). We now have that proper behavior without
the accompanying error message and loss of selection.
Task ID: 1978515
closesodoo/odoo#33038
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
This was introduced in b26ad79a8c
and only used in `addons/web_editor/static/src/js/editor/rte.summernote.js`
at that time.
Then that file has been removed in f296992317
PR: #33509
Avoid selectors based on DOM structure, use classes whenever possible.
Register all the selectors in start to avoid searching the DOM multiple times.
No functional change.
PR: #33509
The web_editor had two different events `save` and `saved` doing more or less
the same thing but with a different signature.
In this commit we keep only the `save` event and adapt the code accordingly.
PR: #33509