Commit Graph
586 Commits
Author SHA1 Message Date
Christophe Simonis 55b810dc70 [MERGE] forward port branch saas-11.1 up to 726b91b9fb 2018-01-03 14:05:48 +01:00
Christophe Simonis 362f0489d0 [MERGE] forward port branch 11.0 up to fe22a0f9ca 2018-01-03 12:28:52 +01:00
Christophe Simonis 715fda1239 [FIX] web_editor: define variable before use
Oversight of previous forward-port
2018-01-02 17:24:11 +01:00
Christophe Simonis f02ed9ab9a [MERGE] forward port branch saas-16 up to 0af13af5de 2018-01-02 16:54:38 +01:00
Christophe Simonis 0af13af5de [MERGE] forward port branch saas-15 up to ddd293065e 2018-01-02 15:36:25 +01:00
Christophe Simonis ddd293065e [MERGE] forward port branch saas-14 up to ba2a83ddfa 2018-01-02 15:02:26 +01:00
Christophe Simonis ba2a83ddfa [MERGE] forward port branch 10.0 up to e336dc38ca 2018-01-02 13:56:49 +01:00
qsm-odoo 392c91cda3 [IMP] website, *: keep top menu on one line and review alignments
* portal

When there are too many items in the top menu, the menu is broken into
multiple lines (especially on medium screen resolution). This commit
implements a system like in the enterprise backend: the extra items are
placed in a "+" dropdown menu at the end of the top menu.

Also, review the direction used to open dropdown menus. The default is
now left-to-right (while it was right-to-left before) and JS has been
added to determine the safe direction:
- If last item: to the left instead
- If would overflow the window: to the other direction instead
2017-12-21 09:52:36 +01:00
qsm-odoo 1d74ed1c55 [IMP] web_editor: make colorpicker option 'bg-'-independent
Now the colorpicker option can be defined with a `data-color-prefix`
parameter which will allow toggling classes different than "bg-*".
(e.g. if the prefix is set to be "hello-", the colorpicker option will
allow to choose between "hello-primary", "hello-danger", ...).
2017-12-20 17:15:08 +01:00
qsm-odoo 8ca92330b3 [IMP] web_editor: allow to define multiple select-class groups
Before this commit, when defining two sets of classes to be chosen
independently on a same element you had to define two options:

```
<div data-selector=".myElement">
    <li class="dropdown-submenu">
        <a tabindex="-1" href="#">Classes set 1</a>
        <ul class="dropdown-menu">
            <li data-select-class="a"><a href="#">A</a></li>
            <li data-select-class="b"><a href="#">B</a></li>
            <li data-select-class="c"><a href="#">C</a></li>
        </ul>
    </li>
</div>
<div data-selector=".myElement">
    <li class="dropdown-submenu">
        <a tabindex="-1" href="#">Classes set 2</a>
        <ul class="dropdown-menu">
            <li data-select-class="x"><a href="#">X</a></li>
            <li data-select-class="y"><a href="#">Y</a></li>
            <li data-select-class="z"><a href="#">Z</a></li>
        </ul>
    </li>
</div>
```

Now, an unique option can be used for this, allowing to not duplicate
the `data-selector` and not creating two JS options:

```
<div data-selector=".myElement">
    <li class="dropdown-submenu">
        <a tabindex="-1" href="#">Classes set 1</a>
        <ul class="dropdown-menu">
            <li data-select-class="a"><a href="#">A</a></li>
            <li data-select-class="b"><a href="#">B</a></li>
            <li data-select-class="c"><a href="#">C</a></li>
        </ul>
    </li>
    <li class="dropdown-submenu">
        <a tabindex="-1" href="#">Classes set 2</a>
        <ul class="dropdown-menu">
            <li data-select-class="x"><a href="#">X</a></li>
            <li data-select-class="y"><a href="#">Y</a></li>
            <li data-select-class="z"><a href="#">Z</a></li>
        </ul>
    </li>
</div>
```
2017-12-20 17:15:08 +01:00
qsm-odoo 374fa10272 [IMP] web_editor: allow to define options' target in XML data
Before this commit, defining a snippet option began by choosing an XML
`data-selector` attribute to put on the option's <div/>. This selector
would then be used to find DOM elements on which to attach the option.

A recent refactoring added the `data-exclude` attribute, allowing to
define a selector that a DOM element must not match to receive the
option.

A new kind of need has arrived: allowing an option to be attached on a
DOMElement but making the option's effects be applied on a specific
child of this DOMElement. This can allow to regroup children options on
a main DOMElement.
To that effect, this commit introduces the optional `data-target`
attribute. If defined, its value is used as a selector to find the
option's `$target` inside the element found with previous rules. Note
that the system has been made smart enough to only add the option on
elements which indeed contain such a $target.

E.g. I want an option to appear in the customize menu of my custom
snippet's <section/> but will in fact control the toggling of a class
'super-row' on the `.row` (I don't want the option to be on the `.row`
otherwise it would not be in the main customize menu). All I have to
do is defining a
```
<div data-selector="section" data-target="> .container > .row">
    <li data-toggle-class="super-row"><a href="#">Super Row</a></li>
</div>
```
(no JS required)

Note: a similar behavior was already present on the JS side of the
"colorpicker" option.
2017-12-20 17:15:08 +01:00
Christophe Matthieu fdf0f014bf [FIX] web: avoid race condition in the website
Depending on the speed of the runbot, errors may appear if one tries to
use a template that is not yet loaded. Templates are being
loaded and we add new template to read, the ready function does not
take into account new additions.
2017-12-19 13:35:36 +01:00
Christophe Matthieu 7dfdfa0103 [FIX] web_editor: Avoid twice translated for static xml
Avoid texts to be translated twice if some modules have the translated
value corresponding to the English source term.

To reproduce: create a translation for static xml (comment 'openerp-web')
with 'Modifier' translated by 'Tadaaa'. In french context, the 'Edit'
button in forms is translated by 'Tadaaa'.

Don't translate template in web_editor if we are in the backend because
the translations of all the modules have already been loaded and applied.
2017-12-19 13:35:36 +01:00
Christophe Monniez 231c4d5fd8 [FIX] web_editor: rte_inline tour succeed on chrome
The rte_inline tour was failing on chrome because jquery selector in
chrome does not like a space in the style selector.
On the other hand, other browsers and phantomjs need the space.
This commit change the selector to find the element on chrome and
friends.
2017-12-18 22:44:44 +01:00
qsm-odoo b1b13dbeed [FIX] web_editor: revert copy/paste feature of the editor
The feature was introduced and fixed by following commits:
- https://github.com/odoo/odoo/commit/906875fc78cb80f6c3d5f1f14f997008cd406473
- https://github.com/odoo/odoo/commit/76be5eed449c78eaf0b4208c381169132492ab4a
- https://github.com/odoo/odoo/commit/7401807510a103374fa8eb524ae5a5698ae21a39

The feature is however still buggy in lots of cases as it is a bad
heuristic that cannot handle simple pasting cases. The feature was
initially introduced to allow pasting PDF content without having to
remove all the unwanted line breaks this induces. As this feature is
not that important and introduced more bugs than it solved, the feature
is deleted by this commit. If we want that feature again, maybe it is
worth considering an "Import from PDF" button or something like that.

See https://github.com/odoo/odoo/issues/15665
2017-12-18 16:10:33 +01:00
Alexandre Kühn 6632822d14 [FIX] web_editor: html field commitchanges fully loaded
Fix over this one: https://github.com/odoo/odoo/commit/cae188514fa8b0a7c785a630ac4aff677b2071fa

The intent was to disable buttons in form views until html fields are fully loaded,
but it was not disabling the buttons for the following reasons:

   1. It is looking for buttons in the DOM, although they
      are not already attached into the body at this moment.
   2. It was disabling the buttons only at widget start(),
      so only once after "Empty Cache and Hard Reload".

We propose a better solution than disabling the buttons in the control panel:
when we click on "Save", the html field ensures that it is fully loaded while commiting the changes.
2017-12-18 11:27:11 +01:00
qdp-odoo 78ae6f470b [MERGE] forward port branch 9.0 up to 9bba7fea42 2017-12-15 16:58:40 +01:00
qsm-odoo 69d4383d7b [FIX] web_editor: browser-unify alignment editor option
Summernote uses `document.execCommand` to apply most styles when
editing, leveraging the implementation to the browser.

Summernote is configured to use HTML styling (`'styleWithSpan': false`),
and in this case, browsers such as Firefox use HTML attributes for
styling text align, while Chrome still uses CSS for that. In fact,
`document.execCommand` is browser-inconsistent... but so is the
`styleWithSpan` option. Indeed, setting the option to `true` will make
Firefox use CSS property for alignment too... but not Internet Explorer.
So we might consider changing this option's value but this would not
solve the current problem.

Indeed, any CSS `text-align` style in Firefox takes precedence above
the element's `align` attribute, so when users were trying to align text
on stuff that was pre-aligned, they were unable to do so.

We can better explain the situation with this example:
A user tries to left-align in Firefox a `p.text-center` element, and
produces this:

```html
<p class="text-center" align="left"/>
```

(`align` attribute is ignored because of the `text-center` class)

On Chrome, this would be produced with the same steps:

```html
<p class="text-center" style="text-align:left"/>
```

With this patch, we actually make that HTML look like expected by the
user, no matter the browser he's using, by forcing the editor to use
the text-align CSS property. Note that the implementation is quite
ugly but had to take care of compatibility.

See https://github.com/odoo/odoo/pull/20900
(thanks to @Yajo for original PR)
2017-12-15 14:06:04 +01:00
Christophe Simonis 4708812b6c [MERGE] forward port branch 11.0 up to b37cc1f9b7 2017-12-12 18:50:59 +01:00
Christophe Simonis b37cc1f9b7 [MERGE] forward port branch saas-16 up to a2ea4ba095 2017-12-12 18:39:43 +01:00
Christophe Simonis 0fd602ba34 [MERGE] forward port branch saas-15 up to 791e0cf47a 2017-12-11 09:17:53 +01:00
Christophe Simonis 791e0cf47a [MERGE] forward port branch saas-14 up to 9bd8a49820 2017-12-08 16:18:44 +01:00
Christophe Simonis 0fda9fba0b [MERGE] forward port branch 10.0 up to cd31e82689 2017-12-07 17:38:40 +01:00
jat-odoo 0a90393da3 [FIX] web_editor: show proper video on existing video edition
See https://github.com/odoo/odoo/commit/5e38bef5a5ededb28707af44a19caaec2af2d682
and especially https://github.com/odoo/odoo/commit/45e0cd564afdae71e9525193250744e88076da71

Closes #19673
2017-12-06 15:16:46 +01:00
Christophe Simonis 8ef7af6afe [MERGE] forward port branch 11.0 up to f96a797fe6 2017-12-06 12:02:58 +01:00
Christophe Simonis f96a797fe6 [MERGE] forward port branch saas-16 up to b8540eefe3 2017-12-06 11:59:38 +01:00
Christophe Simonis a8d01cbf4e [MERGE] forward port branch saas-15 up to a447da75fd 2017-12-04 20:12:19 +01:00
Christophe Simonis a447da75fd [MERGE] forward port branch saas-14 up to e7d174a142 2017-12-04 19:25:51 +01:00
Christophe Simonis 426e269c22 [MERGE] forward port branch 10.0 up to 067a241ea8 2017-12-04 16:24:24 +01:00
Géry Debongnie e6146db88a [FIX] web_editor: make sure html editor does not ignore changes
For some reason, Summernote does not trigger a change event in some
cases.  It looks like it happens in 'codeview' mode, and when the change
in question is only a backspace key event.  Maybe it listen for keypress
and backspace do not trigger keypress event.

In any cases, the situation is that it is not easy to clear an html
field: going in edit mode, then selecting the content and pressing
backspace will not work before this commit.

With this commit, we specifically compare the value in the editor with
the current value to determine if the field is dirty.
2017-12-04 16:03:37 +01:00
Christophe Simonis 7b808982a0 [MERGE] forward port branch 9.0 up to 5e38bef5a5 2017-12-04 12:55:38 +01:00
Adrien Dieudonne e15e6fe32e [FIX] web_editor: support of SVG elements in snippets
Before this commit, it was not possible to save a page
containing a snippet with a SVG tag.

To support SVG elements, we need to use 'Element.getAttribute'
and 'Element.setAttribute' as mentionned in the documentation:
https://developer.mozilla.org/en-US/docs/Web/API/Element/className

For more information, see GH-14485
2017-12-04 09:24:35 +01:00
Sagar Ahirrao 2b575e97b0 [IMP] web_editor: Reduce interline in web editor html lists 2017-12-01 15:00:25 +01:00
Christophe Simonis 2f99470458 [MERGE] forward port branch 11.0 up to c201cf2b77 2017-12-01 12:55:02 +01:00
Christophe Simonis 42264d8dcb [MERGE] forward port branch saas-16 up to 5d7ad2b16c 2017-11-30 18:43:08 +01:00
Christophe Simonis ab084d580f [MERGE] forward port branch saas-15 up to 98539336a5 2017-11-30 15:27:59 +01:00
Christophe Simonis 98539336a5 [MERGE] forward port branch saas-14 up to b780e4a0e4 2017-11-30 14:44:49 +01:00
Christophe Simonis 299a5e058b [MERGE] forward port branch 10.0 up to 7754538750 2017-11-28 12:25:16 +01:00
Christophe Simonis 7754538750 [MERGE] forward port branch 9.0 up to cae188514f 2017-11-28 12:08:34 +01:00
Lucas Perais (lpe) cae188514f [FIX] web_editor: Fieldtexthtml wait until iframe loaded to save
In the case where:
- you are too fast editing a mass mailing, trigger an onchange (e.g. mailing_model) and then save
You can use the edit/save shortcuts to make yourself believe you are Flash Gordon
- your internet is too slow (Down: 4Mb/s, Up: 500kb/s, Latency: 20ms)

Before ths commit, the onchange will return *before* the field (the iframe actually) is loaded.
This onchange contains a signal *in* the body_html of the field to allow communication with the iframe.
If you save before the iframe is loaded, this body_html keyword will be saved.

After this commit we deactivate the save button until the iframe is loaded.
We could have gone for a python user error on the value of the body_html too.
But it would have added a supplementary click and potential reloading

OPW 783616
2017-11-28 11:22:30 +01:00
Christophe Simonis f0a1bc81eb [MERGE] forward port branch 10.0 up to f4a54d7f66 2017-11-20 18:56:01 +01:00
qsm-odoo dc679308d6 [FIX] web_editor: highlight selected fa icon on media dialog start
When editing a fa icon in the editor, the current fa icon was not
properly selected anymore.

Note: the code is still to be improved to handle all cases but this
will be done in master.
2017-11-20 10:38:45 +01:00
Christophe Simonis 21dd24c071 [MERGE] forward port branch 11.0 up to ca3390fd05 2017-11-17 14:22:46 +01:00
Nicolas Lempereur ca3390fd05 [FIX] web_editor: forward-port typo on click
event variable has been renamed to ev in 11.0 and the code was
duplicated.
2017-11-17 14:13:58 +01:00
Christophe Simonis c703a2a0c3 [MERGE] forward port branch 11.0 up to d279a3e6d5 2017-11-16 17:55:37 +01:00
Christophe Simonis a094f6318b [MERGE] forward port branch saas-16 up to 745d00362a 2017-11-16 12:40:36 +01:00
qsm-odoo 4e32a23d96 [FIX] web_editor: restore selected images display
In the media dialog, when an image is selected, it has a colored border
to indicate it. Commit https://github.com/odoo/odoo/commit/e011d58bee140411ccfb1ef9115dddc090d573c3
made changes, part of them designed to "Improve the image dialog to be
able to select/unselect". While this commit was indeed doing that, it
was also breaking stuff: when selecting image(s) then performing a
search, the colored border disappeared while the images were in fact
still selected.

Fortunately, this stuff breaking is only due to code modification that
was made for no reason (so reverting part of the commit is enough to
restore the features while keeping the commit's improvements).
2017-11-15 10:59:49 +01:00
Christophe Simonis ebb6d1e740 [MERGE] forward port branch 11.0 up to 350973ff36 2017-11-10 14:15:02 +01:00
Lucas Perais (lpe) 1a253d3ae2 [FIX] web_editor: mediaDialog should trigger change
before this event, when editing an email template from the chatter
by adding an image through the mediaDialog, the message was always empty
if nothing more than the image was present.
this was because the html field was not marked as dirty,
the event responsible for the marking was not triggered.

After this commit, when sending solely an image from the media dialog,
the email sent does contain the image

opw 779167

closes #20817
2017-11-10 10:30:34 +01:00
qsm-odoo 0a31cb9b4a [IMP] website, *: improve 'animation' API
* web_editor, website_twitter

- There can now be multiple animation widget on the same element
- Animation are destroyed before saving the editor (allows to not be
  forced to do that destruction / code duplication in many cleanForSave)
- .data('snippet-view') is definitely dead
2017-11-09 09:49:36 +01:00