Commit Graph
644 Commits
Author SHA1 Message Date
Christophe Simonis e00a447e2c [MERGE] forward port branch saas-11.1 up to 7e469eb77a 2018-02-01 18:20:28 +01:00
Christophe Simonis 7e469eb77a [MERGE] forward port branch 11.0 up to f5e7b86686 2018-02-01 18:15:21 +01:00
Christophe Simonis f5e7b86686 [MERGE] forward port branch saas-16 up to 920aa6174c 2018-02-01 17:02:19 +01:00
Christophe Simonis 920aa6174c [MERGE] forward port branch saas-15 up to e0422bfd6c 2018-02-01 16:40:13 +01:00
Christophe Simonis e0422bfd6c [MERGE] forward port branch saas-14 up to 7d465aa56c 2018-02-01 15:39:39 +01:00
Aaron Bohy 02ec09cb1c [REF][IMP] *: mail js refactoring
This commit improves the JS code of the mail module,
which comes maily from the new coding guidelines
and the addition of "JS services".

JS services are important objects that do not fit
well in the component tree, such as chat_manager
or ajax.

The benefits of JS services are improved readability
of the code, reduced coupling, and more testable
modules. In particular, discuss was hard to

Summary of the changes:

- ClientAction has been renamed into Discuss
- Clear instantiation of chatManager
- New coding guidelines in most mail modules
- JS Services can interact with each other
- Chat Manager and Window Manager are services
- Window Manager renamed to Chat Window Manager
- bus.bus is now encapsulated in Bus Service (a service)
- The test infrastructure has been tweaked with JS Services
- Chat Mixin has been removed

A future improvement would be to translate some 'trigger' into 'trigger_up'.
2018-02-01 14:51:58 +01:00
Christophe Simonis 7d465aa56c [MERGE] forward port branch 10.0 up to 4c9bf7faae 2018-02-01 14:16:50 +01:00
Jeremy Kersten 8a1cb4758d [FIX] web_editor: avoid useless 404 during test
removeSrcAttribute should avoid these rpc, but for some
unknown reasons, on firefox it works but not with chrome.

Because the purpose of the test is to check the url and
not the content, that works to use an existing route.

Courtesy of @kangol for the fix
2018-02-01 14:13:32 +01:00
Nicolas Lempereur 5af1223878 [FIX] web_editor: xml editor first level not shown
There is a slight visual inconsistency since: 9af8d5e6 the xml/less
editor for first level of descendants were just prefixed by an invisible
space.

opw-807624
closes #22704
2018-02-01 14:00:06 +01:00
Christophe Simonis 4c9bf7faae [MERGE] forward port branch 9.0 up to cbaecc5cbb 2018-02-01 12:13:51 +01:00
Nicolas Lempereur 13c326caaa [FIX] web_editor: firefox editor hidden mass mail
When saving a modified mass mailing, the editor will do a number of
things to improve the mail readability accross mail client.

One of those is replacing font awesome icons by image, but firefox acts
differently than other browser. On a display:none iframe, doing
.css('color') or .height() on an element returns respectively
`undefined` and 0.

This caused an error when getting the color that we could solve by
doing a fallback for firefox like this:

 window.parent.getComputedStyle($font[0]).color

But to get the height() of an element, it seems we always need the
iframe displayed.

With this change, when the iframe is hidden and the browser is firefox,
the code try to display the iframe (with "visibility:hidden;height:1px")
when this part of the code happen.

opw-807180
closes #22639
2018-01-31 15:17:37 +01:00
Nicolas Lempereur 109ecd5205 [FIX] web_editor: firefox RTEWidget if hidden
It seems that firefox has some difference of behavior from other
browsers as said in:

- https://bugzilla.mozilla.org/show_bug.cgi?id=548397
- https://github.com/whatwg/html/issues/1813
- https://github.com/w3c/csswg-drafts/issues/571

It seems that at least in one instance (a html field hidden on the pos
configuration), firefox fails because of something similar:
window.getComputedStyle(element) returns `null` instead of the element
styles.

In my tests, using the parent window (possible if current frame and
parent have the same origin which should be the case) worked in this
instance, this is examplified by this jsfiddle:
 https://jsfiddle.net/Lpv898ve/2/

This work with window.parent and not using window directly.

So this commit adds fallback on doing getComputedStyle from the parent
window (when testing on chromium this gave exactly the same result that
before).

opw-813363
fixes #22211
closes #22610
2018-01-30 10:37:53 +01:00
Christophe Simonis 9af65a7efe [MERGE] forward port branch saas-16 up to 0b188b5804 2018-01-29 13:37:12 +01:00
Christophe Simonis 0b188b5804 [MERGE] forward port branch saas-15 up to 2629029d03 2018-01-29 13:29:14 +01:00
Christophe Simonis 2629029d03 [MERGE] forward port branch saas-14 up to 8b8f04e14c 2018-01-29 13:28:18 +01:00
qsm-odoo 7c959e3fd5 [FIX] web_editor: properly show link alignment in toolbar
When clicking on a link in the editor, the "center" alignment button
was always marked as active whatever the real alignment of the link.
This was because it considered the alignment of the text inside the
link instead of the link's one inside its parent.
2018-01-26 16:17:19 +01:00
Christophe Simonis bcf6529755 [MERGE] forward port branch 10.0 up to 8e38a3d069 2018-01-26 16:06:51 +01:00
Christophe Simonis 9620989501 [MERGE] forward port branch 9.0 up to 222cadda41 2018-01-25 20:24:39 +01:00
Christophe Simonis 88a87240a6 [MERGE] forward port branch saas-11.1 up to 8613724bfc 2018-01-25 17:38:41 +01:00
Nicolas Lempereur b27abee396 [FIX] web_editor: ready when translations ready
$('web_editor.base').ready() returns a deferred that:

- wait at least for $(document).ready()
- wait at least for require('web.ajax').loadXML()
- at most once starts translations configuration

But there is an issue since there is unexpectedly no reference to the
translations, whilst it should have also been ready when ready was
resolved.

This commit keep the reference so translations can be used after
$('web_editor.base').ready() is resolved as it was before 7dfdfa0103.

note: in 11.0 it should be solved with 29729769 (so fix is for [10,11[)

opw-804148
closes #22522
2018-01-25 15:58:32 +01:00
Christophe Simonis cb50970f3f [MERGE] forward port branch 11.0 up to eefe879a37 2018-01-25 15:41:45 +01:00
qsm-odoo 25849e9186 [FIX] web_editor: properly allow formatting text (normal/header 1/...)
Sometimes the formatting buttons had no effect or formatted more than
they should (like a whole column when triple clicking on a paragraph
only). This was because of the `listBetween` function implementation.
This is supposed to return all the nodes between one element and another
one... but the logic is wrong without saying from which *point* to start
and which *point* to end. For example, when asking the list between an
element and its parent, the result is very wrong as there is no way to
go from the beginning of an element to the beginning of its parent using
the `walkPoint` function as the `listBetween` function is doing.

Ideally, the function should be entirely fixed but this can be tricky.
For now, the function is just extended to allow to specify points
instead of nodes, and those are used by the `formatBlock` function to
solve the current problem.
2018-01-25 14:36:47 +01:00
qsm-odoo fb81c331f8 [FIX] web_editor: fix double Shift + Enter
Pressing Shift + Enter twice was buggy because of small refactoring
made by https://github.com/odoo/odoo/commit/c227b8fd88e0ed635a8e807501b559b46fee7786#diff-cc5180b5ec2395c1df5c4e475aff43fbL416

opw-806003
2018-01-25 13:58:59 +01:00
qsm-odoo f79b00c3b7 [FIX] portal, web_editor: responsive images but with inline display
Commit https://github.com/odoo/odoo/commit/abde8bddf8ec45cf12aab59e95c330321158cfba
made a small change to make all images responsive when they are added
with the editor. This had however the side effect of making them go to
a new line which may not be what we want.
2018-01-25 13:56:29 +01:00
qsm-odoo 2fad2e43b8 [FIX] web_editor: solve all triple-click issues
... hopefully.

This *must* be forward-ported.

Depending on the browser, the triple-click behavior is different. This
is especially problematic on Chrome, where blank characters at the start
of the neighbor of the clicked element are selected.

A weak attempt to solve that was made by commit https://github.com/odoo/odoo/commit/b85bd358234684974f9af63bc5f28cfabb527767

This commit hopes to solve all the issues once and for all by fully
reimplementing the triple-click for all browsers. The concept is simple:
when a triple-click occurs, select the whole *inner* content of the
deepest DOM *element* that was clicked.
2018-01-25 12:44:36 +01:00
Christophe Simonis c6b2fa47ed Revert "[FIX] base: bad back-port"
This reverts commit 0ac6043ec7.
2018-01-25 12:43:02 +01:00
Christophe Simonis da9baf2331 [MERGE] forward port branch saas-15 up to 0c97be858c 2018-01-25 11:14:56 +01:00
qsm-odoo 78a556601e [FIX] web_editor: prevent crash when dropping snippets
For some unknown reasons, the editor sometimes crashes when dropping a
snippet. As a temporary fix, the non-critical line that causes the
problem is try/catch protected by this commit.
2018-01-25 11:11:34 +01:00
Christophe Simonis 0c97be858c [MERGE] forward port branch saas-14 up to 4ea4f99df9 2018-01-24 18:12:53 +01:00
qsm-odoo bf5c90d0be [FIX] web_editor: strange horizontal scroll on mousedown
Before this commit, when pressing the mouse button on the end of the
ace editor, it scrolled to the right, selecting the whole sentence
end. This strange behavior was due to some initialization mistake
made by commit https://github.com/odoo/odoo/commit/5a030db3eb77b6d80187f8ae1a64303b2f50391d
2018-01-24 14:01:06 +01:00
Christophe Simonis a98b46b8f5 [MERGE] forward port branch saas-11.1 up to fa1f2132e7 2018-01-22 18:44:05 +01:00
Christophe Simonis fa1f2132e7 [MERGE] forward port branch 11.0 up to 950d9b2369 2018-01-22 17:47:32 +01:00
Christophe Simonis 950d9b2369 [MERGE] forward port branch saas-16 up to dfe7f00e78 2018-01-22 16:38:01 +01:00
Christophe Simonis a3d3e5e7fe [MERGE] forward port branch saas-15 up to 50d87ae81b 2018-01-22 14:42:09 +01:00
Christophe Simonis 50d87ae81b [MERGE] forward port branch saas-14 up to 3d673b5900 2018-01-22 13:33:58 +01:00
Christophe Simonis 3d673b5900 [MERGE] forward port branch 10.0 up to aac9cd4ca8 2018-01-22 12:32:40 +01:00
Christophe Simonis aac9cd4ca8 [MERGE] forward port branch 9.0 up to 216edc206c 2018-01-22 11:18:14 +01:00
qsm-odoo 216edc206c [FIX] web_editor: properly evaluate if a range is an image
The previous implementation apparently came from an old version
of summernote (see https://github.com/odoo/odoo/commit/d33086c03fc1a0882be38ae62989b7f72df20d3b).

This commits should improve it to handle all known cases.

See https://github.com/odoo/odoo/issues/20877
2018-01-19 14:02:24 +01:00
qsm-odoo f314cf0bb3 [FIX] web_editor: deleteContents when no selection
Changing the `deleteContents` method of the editor is tricky. This
commit however dares to add a behavior: if the range does not
represent a selection but only the cursor position and is then asked
to delete its content... it should not do anything as nothing is
selected.
2018-01-18 15:19:16 +01:00
qsm-odoo cdb2cf744f [FIX] web_editor: DOMElement used as jQuery element
The function receives a jQuery element most of the time but it
may receive a DOMElement in some cases.
2018-01-18 15:17:48 +01:00
qsm-odoo 59e1bdff22 [FIX] web_editor, website: properly clean snippets before saving
/!\ Partial backport of https://github.com/odoo/odoo/commit/0a31cb9b4ae461119ecafdd05c5b979621ffb039
/!\ Should not be forward-ported

Before the websitepocalypse introduced in 11.0 (saas-17), when saving a
page in the editor, every `cleanForSave` method of snippet options were
called, even for snippet options which were not initialized (so if a
snippet was left unchanged before saving, the related `cleanForSave`
methods were called anyway). This behavior was bad code and did not make
much sense and was so removed with the websitepocalypse
(see https://github.com/odoo/odoo/commit/2972976962617d4b8a0113bae58c640ab41cdff8#diff-4c580abda3220e45c6b3f6bdcf77c733L415)

Unfortunatly, the behavior was necessary given the states of our snippet
options. Indeed, for the "latest posts" snippet, the `cleanForSave`
method removes the entire snippet content (as it is dynamically loaded).
The dynamic loading is performed by the snippet *animation*... and
removing the dynamic content should logically be done by the animation
too... which is the case. The problem is that animations are not stopped
before the editor is saved. This behavior was only implemented in
saas-11.1 (for future version 12.0) with commit https://github.com/odoo/odoo/commit/0a31cb9b4ae461119ecafdd05c5b979621ffb039

As a stable fix for 11.0, part of the mentioned commit is backported
here and some specific `cleanForSave` will be reviewed as animations if
necessary. Note: `cleanForSave` made useless by this commit are left
anyway as this is a stable fix.

See https://github.com/odoo/odoo/issues/22089
2018-01-17 15:55:36 +01:00
qsm-odoo 285d95e946 [IMP] website: more intuitive image and link edition
- Remove useless snippet background suggestions (only one button to
  open the media dialog directly)
- Show meaningful-only tabs in the media dialog (no document as
  background, ...)
- When editing a background shows the background suggestions first and
  show the background suggestions last for standard images. Technically,
  this is done by filtering on the name/fname of the attachments and
  adding magic name parts to the fname on image upload (e.g. when
  uploading an image from the media dialog when customizing a bg, the
  uploaded image will automatically be marked as a background). Note:
  there were discussions to implement this feature with a tag system for
  ir.attachment/s but the implementation's cost was too great in regards
  to the feature.
- When editing an existing link or creating one from selected text, do
  not show the "Link Label" field in the dialog; it was confusing. Only
  show that field when adding a link at the cursor location with no
  selected text.
2018-01-16 17:03:16 +01:00
qsm-odoo abde8bddf8 [REF] web_editor, website(_*): refactore media & link dialogs
* blog, gengo, sale
2018-01-16 17:03:15 +01:00
qsm-odoo 0dd41128ff [FIX] web_editor: fix 8ca92330b3
The existence of $li is not sure, especially in themes override.
2018-01-16 17:03:10 +01:00
Christophe Simonis 03a36a9bba [MERGE] forward port branch saas-11.1 up to 56974322f8 2018-01-12 19:13:10 +01:00
Christophe Simonis 56974322f8 [MERGE] forward port branch 11.0 up to 3b80a059ff 2018-01-12 19:03:00 +01:00
Christophe Simonis b42b9c936b [MERGE] forward port branch saas-16 up to 3b7bf3a4b8 2018-01-12 18:15:23 +01:00
Christophe Simonis 3b7bf3a4b8 [MERGE] forward port branch saas-15 up to 8962b8ecc2 2018-01-12 17:23:10 +01:00
Christophe Simonis 8962b8ecc2 [MERGE] forward port branch saas-14 up to d35a76ee17 2018-01-12 16:47:12 +01:00
Christophe Simonis d35a76ee17 [MERGE] forward port branch 10.0 up to d76237e038 2018-01-12 16:16:51 +01:00