Commit Graph
1063 Commits
Author SHA1 Message Date
Gorash 2e19c5e923 [FIX] web_editor: wrong focus detection in the editor
Issue detected with tests in the branch that replace deferred by native
Promise. Need to add isMedia to detect if the target is already a media
when focus the editor.

This is a manual forwardport of PR odoo/odoo#31632.

closes odoo/odoo#31633

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2019-03-06 12:41:03 +00:00
Gorash 6f97e0eea1 [FIX] web_editor: Expose focus method for activate method of html field
closes odoo/odoo#31577

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-03-06 07:50:52 +00:00
Gorash 4817c6daa3 [FIX] web_editor: Evoid the risk of deleting the summernote library
For iframes, we need to inject summernote because there are references
to "document" in it. When loading the iframe, if it is canceled, there
is a risk that the library is erased and that it breaks the field html.
We must also slightly modify the library to prevent it from making
changes to the library of the main "window".
2019-03-06 07:50:48 +00:00
qsm-odoo 3f4e760f34 [MOV] web, *: simple moves of JS files to 'public' folder
* web_editor, website, survey, im_livechat

Part of https://github.com/odoo/odoo/pull/29442
task-1932066
2019-02-26 17:02:58 +00:00
Christophe Simonis ff9c9341d6 [MERGE] forward port branch saas-12.2 up to fcb972db9d 2019-02-26 16:39:30 +01:00
Christophe Simonis 0e7675847f [MERGE] forward port branch saas-12.1 up to 0f4abc5c22 2019-02-22 16:25:02 +01:00
Christophe Simonis 1d2b6f1bef [MERGE] forward port branch 12.0 up to 84143a34b3 2019-02-21 15:37:19 +01:00
Antoine Guenet 4339101afe [IMP] web_editor: add tests for deleting all contents of format block
Implementing new behavior on delete all contents of a format block
revealed insufficient testing, which is now covered.

closes odoo/odoo#31277
2019-02-21 09:13:32 +00:00
Antoine Guenet 2a010c38f3 [FIX] web_editor: remove broken and unnecessary test
The next test was identical to the removed one, with the exception that
it inserts a character at the end, which really is the behavior we want
to test. The removed test was broken because it expected the range on
the parent, which is anyway equivalent in this case. This is confirmed
by the fact that inserting a character at either ranges indeed inserts
the character where it is expected to do so.
2019-02-21 09:13:31 +00:00
Antoine Guenet 00a78af98e [FIX] web_editor: stop removing empty block after deleting its contents
Deleting all the contents of a block node replaced it with a blank
paragraph node. To restore v12 behavior, it should only do that when
pressing backspace in an already empty block, which is now what it does.
2019-02-21 09:13:30 +00:00
Antoine Guenet 8b8d6d0a5b [FIX] web_editor: do nothing on save if no media was selected in modal
When in the media modal, if one selected no media but clicked the "ADD"
button it resulted in an error and a failed RPC instead of simply
closing the modal without doing anything. v12 behavior is now restored.

closes odoo/odoo#31308
2019-02-21 07:32:38 +00:00
Antoine Guenet 6c38ed2f8d [FIX] web_editor: open the link modal on dblclick button descendent
The link modal only opened on double-click directly on an anchor,
meaning that double-clicking text in a span node within the button (as
is the case in the call-to-action snippet for instance) wouldn't open
the modal.
Now it opens as long as we have an ancestor that is an anchor, unless
the double-click occurs on a media (eg: a pictogram), in which case it
should open the media's modal.

closes odoo/odoo#31229
2019-02-19 09:56:32 +00:00
Christophe Matthieu 859ce50903 [FIX] web_editor: clean or hide image handle data according to image size
closes odoo/odoo#31183
2019-02-19 09:37:25 +00:00
Christophe Matthieu 832357f0b7 [FIX] web_editor: use website color for popover edition 2019-02-19 08:43:51 +00:00
Antoine Guenet f5c269db12 [FIX] web_editor: properly position image handle in product configurator
The image handle (grey overlay over the image) was not properly
repositioning on scroll in the product configurator (a side effect of
not having a popover).

closes odoo/odoo#31226
2019-02-19 09:06:49 +00:00
Antoine Guenet d9a77bd846 [FIX] web_editor: stop wrapping text in p on delete in anchor
This notably fixes a bug with the accordion snippet (website) where
selecting a title and typing seemed to add a newline.

closes odoo/odoo#31222
2019-02-19 09:46:28 +00:00
Antoine Guenet 1f4b606ad0 [FIX] web_editor: remove invisible space on insert media where forbidden
The web editor inserts zero-width characters (unicode 200B) around media
when inserting them in the DOM so as to be able to edit before and after
said media (contenteditable caveat). It should however not do so in fake
not-editable nodes - such as the navbar - given that we do not expect to
edit in them but only to replace the media. This ensures that behaviour.

closes odoo/odoo#31200
2019-02-18 13:06:17 +00:00
Xavier Morel 7065ea520c [FIX] *: various docstring formatting issues
Would yield block quotes instead of code blocks or lists or whatnot.
2019-02-18 08:56:07 +00:00
Xavier Morel 3f8d20b778 [FIX] web_editor: various levels of broken in docstrings 2019-02-18 08:55:57 +00:00
Siddarth Gajjar 23dcaf4836 [FIX] mass_mailing: fix send email issue.
- while clicking on send now button in mass mailing app it throws error due to wysiwyg undefined.

closes odoo/odoo#30533
2019-02-25 12:22:34 +00:00
Christophe Matthieu b49745e52d [IMP] web_editor: lazy load the wysiwyg
Issue: wysiwyg asset slow down the loading of the website, error
inadvertently introduced: https://github.com/odoo/odoo/pull/29775

The assets are now loaded assynchroneously, when the editor is needed,
its assets will be loaded.

closes odoo/odoo#30700
2019-02-14 15:11:19 +00:00
Christophe Simonis 93d736e905 [MERGE] forward port branch 12.0 up to 6e8dff1952 2019-02-11 16:17:02 +01:00
Christophe Simonis 75eec26da3 [MERGE] forward port branch saas-11.3 up to 728bb2a28e 2019-02-11 12:47:52 +01:00
Christophe Simonis 8c29df10e0 [MERGE] forward port branch saas-12.1 up to 93d736e905 2019-02-11 17:00:35 +01:00
Christophe Simonis 728bb2a28e [MERGE] forward port branch 11.0 up to 9553240adc 2019-02-08 19:19:57 +01:00
Christophe Simonis 9553240adc [MERGE] forward port branch saas-15 up to 9773be345e 2019-02-08 16:53:11 +01:00
qsm-odoo 10384c689a [IMP] website, *: optimize scss customizations
* web_editor

This commit's goal is to optimize the delay to make a scss customization
thanks to the website customize dialog. Before this commit, the JS code
took advantage of existing web_editor routes but this was far from
efficient as this was done:

1) PY: Load all scss files used in the page
2) JS: Find the one we want to customize and adapt the scss content
3) PY: Create the scss customization with the new content

(So two RPC (including one very slow) and content building in
javascript)

After this commit, this is done:

1) PY: Load the scss file being customized, adapt its content according
   to the new values and save the customization

(So the whole logic is in python, requiring only one small RPC)

This commit also take the opportunity to review the web_editor ace
editor loading code (the logic is shared with website customizations).

PR https://github.com/odoo/odoo/pull/29624
task-1904244
2019-02-08 14:38:51 +00:00
Christophe Simonis 9773be345e [MERGE] forward port branch saas-14 up to 18228f9c4e 2019-02-08 13:28:46 +01:00
Christophe Simonis 18228f9c4e [MERGE] forward port branch 10.0 up to be689c53c1 2019-02-08 11:40:01 +01:00
qsm-odoo be689c53c1 [FIX] web_editor: review drag and drop in the editor
When dropping a snippet into a page, it is dropped in the drop-zone
which is the nearest of the user cursor. When moving a snippet, that
condition did not apply and the user was required to put the cursor at
the exact location of the drop-zone.

Also, for both drag and drop features, the drop zones which appeared
were not displayed correctly for full width columns, which made dropping
sometimes impossible when multiple col-*-12 were below each other.

task-1937758

closes odoo/odoo#30899
2019-02-07 11:12:36 +00:00
qsm-odoo 473c954aa8 [FIX] web_editor: fix switch design (website publish btn)
Using chrome, the design was not pixel perfect (letting a white bar
appear around the switch). Replacing the linear gradient color by a
simple color fixes that particular problem. The design is still not
pixel perfect but those are meant to be replaced in master anyway.

Part of https://github.com/odoo/odoo/pull/31117
task-1941156
2019-02-14 16:24:34 +00:00
qsm-odoo bbc24e3f76 [FIX] website, *: restore and enforce Odoo UI design
* web_editor

BS conflicts with our UI again: btn sizes and form controls are
more difficult to force with BS4, this commit adapts the controls to
use less problematic sizes, and adds/adapts some more forcing rules.

Part of https://github.com/odoo/odoo/pull/31117
task-1941156
2019-02-14 16:24:35 +00:00
Antoine Guenet eea58a3cf8 [FIX] web_editor: on anchor split, rerange and clean data on getValue
Due to a wrong order of operations, after splitting an anchor (press
ENTER), the range was setting on the first anchor. Now it sets on the
second one (as the code - but not the tests - suggests was supposed to
happen). Tests were adapted to reflect that change.

In tests, after splitting the anchor, `Wysiwyg.getValue` didn't always
properly clean up `data-original-title`. Targetting empty
`data-original-title` attribute instead of `aria-describedby` attribute
should fix that issue.

closes odoo/odoo#30923
2019-02-07 10:20:57 +00:00
Christophe Simonis f927c68ddb [MERGE] forward port branch 12.0 up to cb8fefa899 2019-01-31 16:59:58 +01:00
Andrea Ulliana 515e7bc50f [IMP] website, *: improve CSS edition usability + add JS edition
* web_editor

Currently, when an user wants to edit the css of its website, he has
access to lots of files and, in debug mode, to even more files. While
the feature is nice for people who know what they are doing, a lambda
person can easily break its website by changing the wrong files. Also,
nothing warns the user that the files that are edited will never receive
updates anymore (unless if they are reset). The goal is to prevent
those behavior while still allowing the add custom css. Another goal
is to be able to *add* custom javascript.

Custom files created for the user:
SCSS: user_custom_rules.scss, user_custom_bootstrap_overridden.scss
JS: user_custom_javascript.js

See https://github.com/odoo/odoo/pull/29999
task-1919350
2019-02-05 14:28:29 +00:00
Antoine Guenet 275af90b38 [FIX] web_editor: update displayed media in dialog on remove media
closes odoo/odoo#30809
2019-02-04 12:52:15 +00:00
Antoine Guenet f834204af3 [FIX] web_editor: reapply the classes of ANY type of media on replace
closes odoo/odoo#30801
2019-02-04 11:29:40 +00:00
Antoine Guenet 48cb3c71d1 [IMP] web_editor: handle CTRL+A (and then DELETE) locally
This fixes issues with CTRL+A then delete.
Now CTRL+A selects all the contents of the unbreakable node in
which the range is contained. Deleting it all will replace the contents
with `<p><br></p>` so the user can start editing afresh.

Note: Only CTRL+A is handled: ``select all`` in contextual and edit
menus are still handled by the browser.

closes odoo/odoo#30648
2019-02-04 09:44:18 +00:00
Christophe Simonis 4400cce820 [MERGE] forward port branch saas-12.1 up to 4524ad06a8 2019-02-04 13:27:22 +01:00
Romain Derie 326a44c3f7 [FIX] web_editor, website: consider COW view when loading view
Before this commit:
1. If we were editing a template with no xml_id, typically the case when
   editing a specific view (COW'd), the 'Template ID' label would be left empty
   as the view does not have an xml_id but only a key.
2. If we were editing a generic view, the template would be COW'd and replaced
   by the specific one created during the save.
   After the save, the page would be reload and will try to reopen the edited
   template (stored in url `res=123`). But as this template would be replaced
   by the COW'd view, the JS would crash trying to access an inexisting view.
   The HTML editor would then open in a very thin modal, barely editable.

Now:
1. Display the template's key instead of its xml_id. The key is basically a
   duplicate of the xml_id, mainly used in website.
2. If we are saving a generic view, we search for its newly created specific
   view to upload the URL hash before reloading.

task-1934279
Fix #30447
2019-01-29 16:06:23 +00:00
Romain Derie 6bd579bd6b [FIX] web_editor: send the html editor writes one after another
With the following view hierarchy:
   A
   |
   B' (oe_structure_ID view)

Before this fix, when saving multiple templates at once from the same hierarchy
the COW views (website) would not be saved correctly as the first call to
`write` would COW the parent view, then the second concurent call to `write`
would create the child specific view under the generic parent view.
Instead, the generic parent should have been cloned to a specific parent view
and then the child view should be COW under the specific parent.

  A    A'
  |    |
  B'   B*' (This one is the old B', without B' changes in the html editor)

Instead of

  A   A'
      |
      B'

Calling the `write` one after another will do the trick. Indeed, when the
second call is fired, the first call has already triggered the COW behavior.
Thus, the second call correctly retrieves the COW view.

Another issue might still appear, if the parent view write is sent first.
Indeed, the parent view will be COW, thus the specific child view (second write
waiting to be fired) will be deleted to be added on the new specific hierarchy.
Thus, that write will then raise an error since the view does not exist anymore.

task-1934279
Fix #30447
2019-01-29 16:06:23 +00:00
Lucas Perais (lpe) b87879c1f6 [FIX] web_editor: icon widget complies to api
the search method should return a Deferred as explicit in MediaDialog

OPW 1919549

closes odoo/odoo#30077
2019-01-09 14:32:04 +00:00
Christophe Simonis b50883d17b [MERGE] forward port branch 11.0 up to c07b7200b2 2019-01-08 11:52:15 +01:00
Julien (juc) Castiaux fce729e65a [FIX] web_editor: banner not horizontaly centered
When creating a banner using the web editor, the targeted image
appears centered in the editor but is aligned on the left in the
email.

The issue also happened with other alignment (left in a centered
widget, right, ...) for example on outlook 2007 and should be solved
with this changeset.

opw-1904827
Co-authored-by: Nicolas Lempereur <nle@odoo.com>
closes #29985

closes odoo/odoo#29214
2019-01-07 13:49:33 +00:00
Jeremy Kersten 8f2267b512 [FIX] web_editor: hack o_switch input style
On Chrome, there are a rounding pixel that make the button ugly since several month.
Meanwhile to have a clean way to fix it, bypass the rounding pixel.

https://odoocdn.com/web/image/10933003/Selection_181.png

closes odoo/odoo#30452
2019-01-22 16:38:48 +00:00
Christophe Simonis 6a0675d36d [MERGE] forward port branch saas-11.3 up to e033114879 2019-01-11 18:56:24 +01:00
Jorge Pinna Puissant 171d1e7bc3 [FIX] web_editor: Media dialog next btn reload page
opw-1910505

Before this commit, the next button in the media dialog widget reloaded
the page and opened only the iframe of the widget.

Now, the button only update the media dialog widget.

closes odoo/odoo#29981
2019-01-09 07:29:22 +00:00
Julien (juc) Castiaux e02a05a724 [FIX] web_editor: left/right/center image for mail
When creating a banner using the web editor, the targeted image
appears centered in the editor but is aligned on the left in the
email.

The issue also happened with other alignment (left in a centered
widget, right, ...) for example on outlook 2007 and should be solved
with this changeset.

note: 12.0 version of #29214

opw-1904827
Co-authored-by: Nicolas Lempereur <nle@odoo.com>
closes #29954
2019-01-08 11:53:32 +00:00
Christophe Simonis b28788a8be [FIX] web_editor: remove wrongly inserted line during previous forward-port 2019-01-14 11:17:31 +01:00
Christophe Simonis 3cbc9dd6c0 [MERGE] forward port branch 12.0 up to 6a0675d36d 2019-01-14 10:34:50 +01:00