Commit Graph
747 Commits
Author SHA1 Message Date
len-odoo 264f89f63f [FIX] web_editor: remove video option when composing email
Embedding a video can't work because it embeds an iframe, which is not supported
by most email clients for security reasons.
(What happens when Gmail shows embedded videos in displayed emails, is that you
send a link in the email body, and it is at rendering that Gmail adds the iframe
into the page.)
So the bugfix solution is to hide the button.

Since there is an option "res_model" that allows us to know when we are in that
case, we remove the video option.

opw 1905497

closes odoo/odoo#28911
2018-11-23 10:32:45 +00:00
Christophe Simonis 263b388c50 [MERGE] forward port branch saas-15 up to e44c35f407 2018-11-22 17:06:31 +01:00
Christophe Simonis e44c35f407 [MERGE] forward port branch saas-14 up to a9752d3ad3 2018-11-22 15:03:01 +01:00
Christophe Simonis a9752d3ad3 [MERGE] forward port branch 10.0 up to af476c6949 2018-11-22 14:39:08 +01:00
Nicolas Lempereur 258eaa7a3c [FIX] web_editor: firefox `´ accent no break position
On firefox if we do for example:

ALT+GR + [ALT+GRable ´ key]

Firefox may send keys "AltGr" and "Dead" instead of just "AltGr".

This was possibly causing caret to go a position too low when writing
speedily with diacritical marks.

opw-1903865
closes #28739
2018-11-15 16:52:31 +01:00
Nicolas Lempereur bba78c7fe1 [FIX] web_editor: can't unquote on firefox
Firefox when asked to block format (formatting over a block with
blockquote, h1, ...) has a special case for blockquote (it is documented
in https://developer.mozilla.org/docs/Web/API/Document/execCommand at
formatBlock command) and will wrap any element instead of replacing
existing block formatting.

Thus the code not expecting it was not able to remove a blockquote in
firefox once introduced.

opw-1903735
closes #28587
2018-11-12 14:48:20 +00:00
Nicolas Lempereur e0b906d74d [FIX] web_editor: firefox ctrl+a and un/format
When we for example do ctrl+a in firefox, the selection is over the
container and not the content.

This is an issue when we apply a format, since the container could be
removed.

  eg:

  we have selection over `<pre>hello</pre>`, on firefox the selected
  node is `pre`, on chromium it is `TextNode "hello"`.
  if we remove the style, `pre` is deleted so firefox selection is
  broken, whilst chrome has no issue since "hello" still exist.

There was also an issue when the selection was over the blockquote,
there was no error but the style could not be removed.

opw-1903738
opw-1903735
closes #28369
2018-11-12 11:22:43 +00:00
Nicolas Lempereur 726bc301cf [FIX] web_editor: don't prepend http to ${..} link
In mail template a link with reference such as:

  ${object.user_id.signup_url}

are often used.

These are template directives that are replaced when the mail is saved,
so when editing in the editor and they are prefixed by "http://" this
breaks the link which is not wanted.

Now link beginning with `${` are not prefixed anymore to prevent
shooting oneself in the foot.

opw-1906695
closes #28522
2018-11-09 10:45:17 +00:00
Christophe Simonis 416ed10b7b [MERGE] forward port branch saas-14 up to ce2eb8464b 2018-10-23 18:04:26 +02:00
Christophe Simonis ce2eb8464b [MERGE] forward port branch 10.0 up to d5cc05c994 2018-10-23 18:02:45 +02:00
qsm-odoo 3a2939d494 [FIX] web_editor: disable strange resize handles on Firefox
See comments in the code for details...

Closes https://github.com/odoo/odoo/pull/27964
2018-10-19 14:48:51 +02:00
Christophe Simonis 93c22558f3 [MERGE] forward port branch saas-14 up to 77286e4296 2018-10-11 12:15:02 +02:00
Christophe Simonis 77286e4296 [MERGE] forward port branch 10.0 up to c2688e45f3 2018-10-11 10:34:48 +02:00
Kishan Gajjar 227fc6408d [FIX] web_editor: properly allow to reset bg color
If resetting a background color was the only edition that was done on a
page and that this page was saved, the change was not properly saved
as the page was not marked as dirty.

Closes https://github.com/odoo/odoo/pull/27625
task-1879524
2018-10-10 17:22:37 +02:00
Goffin Simon 782e437061 [FIX] web_editor: Not possible to edit a link on safari
On Safari, when editing the template of a mail.mass_mailing,
clicking the "Read more" button (or any button that can
have a link to the website) didn't open pop up to set
the URL of the website.

PS: inspired from https://github.com/textAngular/textAngular/issues/762

opw:1889643
2018-10-10 09:48:34 +02:00
qsm-odoo cd580dd605 [FIX] web_editor: fix forward-port
Forward-port of https://github.com/odoo/odoo/commit/227fc6408ddc998529bb1c38222ddba50f40868b
made with https://github.com/odoo/odoo/commit/717f4583949219c346c87c390fbc336b4f31571c
introduced a JS error.

closes odoo/odoo#28187
2018-10-26 09:44:13 +00:00
Christophe Simonis 58525e29d8 [MERGE] forward port branch saas-15 up to bff43f0aa1 2018-10-24 16:14:52 +02:00
qsm-odoo 4150dd5849 [FIX] web_editor: fix background reset system for carousel items
When the user previews a background color, the background image of the
snippet is removed and re-added if the user chooses not to pick the
color. The background-image was not correctly added for carousel items.
2018-10-19 09:07:33 +00:00
qsm-odoo c2b8d2a301 [FIX] web_editor: review _setActive system for select-class
- Handle the case where one select-class is a subset of another
  select-class of the same group e.g.

  <... data-select-class="hello"/>
  <... data-select-class="hello world"/>

- Handle empty values <... data-select-class=""/>

Note: both cases worked but were not displaying the active checkbox
correctly in the editor UI.
2018-10-19 09:06:16 +00:00
Christophe Simonis 717f458394 [MERGE] forward port branch saas-15 up to 93c22558f3 2018-10-11 14:48:49 +02:00
Christophe Simonis e1e27aa009 [MERGE] forward port branch saas-14 up to 6773d3644e 2018-09-05 17:27:46 +02:00
Christophe Simonis 6773d3644e [MERGE] forward port branch 10.0 up to 1d0940d96f 2018-09-05 17:27:13 +02:00
Nicolas Martinelli e673484b35 [FIX] web_editor: image name
Add the image name in the website for SEO purpose. This is a backport
of:
88a5d9a000
886c07dabb
152e3f8686

opw-1880472
2018-09-05 09:42:10 +02:00
Christophe Simonis 653bbbc733 [MERGE] forward port branch saas-14 up to 14f8ef59b8 2018-09-04 16:48:31 +02:00
Christophe Simonis 14f8ef59b8 [MERGE] forward port branch 10.0 up to 0f0e43ae55 2018-09-04 16:11:09 +02:00
Christophe Simonis 0f0e43ae55 [MERGE] forward port branch 9.0 up to 61b771256c 2018-09-04 15:23:54 +02:00
Nicolas Lempereur 61b771256c [FIX] web_editor: back to first -> history stay ok
If we do:

- one change that will be saved in history
- go back to the document before any change
- do other change

we can easily get in a state were the history is no longer recorded.

The history is kept like this:

- pos: our position in the history
- aUndo: the snapshots of history
- toSnap: the last history snapshop that is to be saved

so for example if we start without change (at originalState):

  {pos: 0, aUndo=[], toSnap=null}

Then we do two changes (change1, change2):

  {pos: 2, aUndo=[originalState, change1], toSnap=change2}

If we make an undo, we will get to:

  {pos: 1, aUndo=[originalState,change1,change2], toSnap=null)

If we make another change (change3):

  {pos: 2, aUndo=[originalState, change1], toSnap=change3}

So the history after the position is removed.

But when we get back to the original, the state would forever be:

  {pos: 0, aUndo=[originalState], toSnap=change85}

because when doing a change, the code only removed history from the
max(pos, 1) index.

opw-1870119
closes #26701
2018-09-03 16:30:03 +02:00
Nicolas Lempereur 793988c7ed [FIX] web_editor: normal up/down in content in cell
In the editor in a table cell, when we press UP/DOWN keys:

- we have default editor/browser behavior if there is content before
  (UP) or after (DOWN) the element we are currently on
- else we go to the previous (UP) or next (DOWN) row if available
- else we go to the next content if available
- else we have the default editor/browser behavior

But when checking if there is an element before/after the content, we
did not take into account if there was an ancestor node inside the cell
that had content after, so for example with this structure:

```
<table>
<tr><td>
  <p>hello <b>world</b></p>
  <p>cruel</p>
</td></tr>
<tr><td>
  <p>bingo</p>
</td></tr>
</table>
```

if the current range was on 'world' text node, we would just check if
there is content after this text node, not if there is content after its
`<p/>` ancestor.

Before the fix we would get on the next row, after we would have default
editor/browser behavior: ie. if cruel is on another line, going to this
line.

opw-1870119
closes #26701
2018-09-03 16:30:03 +02:00
Nicolas Martinelli 88a5d9a000 [FIX] web_editor: image name
Add the image name when the image is uploaded.

Complement of commits 886c07dabb and 152e3f8686

opw-1880472
2018-09-05 09:10:37 +02:00
Christophe Simonis 2a13863f43 [MERGE] forward port branch saas-15 up to 653bbbc733 2018-09-04 17:02:36 +02:00
Nicolas Lempereur 7a453b0b7a [FIX] web_editor: focus lost with inline editor
When an inline editor is eg. in a form view, the focus is always stolen
by it.

This is because we trigger a mouseup on the editor to update its
toolbars values and informations.

In 10.0 this was not necessary since the default values were sanely set
when the editor was inside the DOM. In 11.0 the editor is not in the DOM
when this is being done and the info was wrong (eg. NaN for text size).

With this commit, we don't steal the focus and get the default like it
was done in 10.0 instead.

fixes #26366
opw-1874880
closes #26582
2018-09-03 16:51:20 +02:00
len-odoo 47c7d123da [FIX] web_editor: remove related videos at the end of youtube embeds
If a user embeds a youtube video on his website, he has no option to remove the
suggestion of related videos at the end of playback.
Since there is no good reason to have it, we disable the related videos in all
cases.

opw 1868380
2018-08-10 09:30:41 +02:00
Deep Patel 1369272f1a [FIX] base: inline buttons was breaking into multiple lines (outlook hack)
Because we converted buttons into tables so inline buttons was
breaking into multiple lines so we need to add display inline and vertical align
properties in tables.

We allowed display property from mail sensitizer whitelist.

Because in this commit https://github.com/odoo/odoo/commit/cf15030ed09f7479f5b2701ba101a5bed71f7409
we use display property for align items
2018-08-06 16:17:48 +02:00
Deep Patel c76c21d607 [FIX] mass_mailing: fixed multiple buttons transcoding issues (outlook hack fix)
Because of outlook hack node was not find next sibling of current element.
Due to this only first button is transcoded into inline css.
2018-08-06 16:17:48 +02:00
len-odoo 79ee0e2584 [FIX] web_editor: display a dialog if posting a translation fails
When editing a translation on the website, if the user copy/pastes directly in
the web editor, then the html formatting is also copied.
Since the translation matching takes the html code into account when matching
the translations, this breaks the pairing.
When trying to save, the backend function validating the new translation thus
fails and return a server error.
However nothing was done with this error, and the user just witnesses that
saving doesn't work (unless he opens the console to notice the rpc failure).

We now display an alert dialog that notifies which tranlation causes the error.

opw 1862784
2018-07-18 16:35:38 +02:00
qsm-odoo 7d63434680 [FIX] website, *: make datepicker properly behave in page property modal
* web_editor

Note: the <body/> element had to be explicitely 'position: relative;'
for the library to work.
2018-07-12 17:15:13 +02:00
Christophe Matthieu 6a5dc8bcd1 [FIX] mail: remove attachment feature in add followers modal
Before this fix, the attachments are don't save to the record and are
remove with the wizard. We can't add the attachments to mail.message
(like 'mail.compose.message') because it's auto_delete/unlink and the
attachments are removed before the recipient can read it.
2018-07-11 15:38:59 +02:00
Christophe Matthieu 0cf5987610 [FIX] web_editor: display record linked to the record when add followers 2018-07-11 15:38:59 +02:00
Christophe Matthieu f83f532237 [FIX] web_editor: send an image thumbnail for attachment link in mail
Before this fix attachmentThumbnailToLinkImg is not called for
style-inline options. The mail received does not have thumbnail and the
user can't click on the invisible link.

opw-1863659
2018-07-11 15:38:59 +02:00
Nicolas Lempereur cb047ae69d [FIX] web_editor: keep border when side style differ
Since e94702d8 when transcoding an element for the purpose of sending it
by mail, if the element had:

 border-bottom-style: solid;

in the CSS resulting from classes, it would be simplified to:

 border-style: 0 0 solid 0;

which is wrong since 0 is invalid for border-style, the default being:

 none

opw-1852839
closes #25423
2018-06-22 14:25:36 +02:00
Christophe Matthieu cf15030ed0 [FIX] web_editor: convert link to send by email
Don't convert in table btn-link, and center the button
2018-06-19 16:57:04 +02:00
Christophe Simonis b05e4d5f95 [MERGE] forward port branch saas-15 up to a53bea49fe 2018-06-14 21:28:39 +02:00
Christophe Simonis 803df909b1 [MERGE] forward port branch saas-14 up to 804d68efe5 2018-06-14 18:05:38 +02:00
Christophe Simonis 804d68efe5 [MERGE] forward port branch 10.0 up to 23a1bce2a9 2018-06-14 18:03:26 +02:00
Christophe Simonis 23a1bce2a9 [MERGE] forward port branch 9.0 up to 90165e2d96 2018-06-14 17:29:56 +02:00
qsm-odoo 50418c4811 [FIX] web_editor: properly save media dialog without any image
When saving the media dialog without any selected image, a crash
occurred. Now, it properly closes the dialog.

opw-1858614
2018-06-14 10:47:38 +02:00
Nicolas Lempereur c4ddf55880 [FIX] web_editor: link don't duplicate child text
If we applied a link eg. on:

```
<span>hello <b>world</b></span>
```

The system actually gets the "label": hello worldworld because there is
3 nodes:

 text node: hello
 element node: `<b>world</b>`
 text node: world

Also since "hello worldworld" is different than "hello world",
instead of just keeping existing nodes and adding the link, the system
would replace the selected range by:

 `<span><a>hello worldworld</a></span>'

instead of:

 `<span><a>hello </a><b><a>world</a></b></span>`

This commit ignores element nodes when creating a new link, since when
getting the label of the link from the selection, only the text nodes
insides the element nodes have any interest.

There was a second issue because if we had:

```
<i><a href="hello">world</a></i>!
```

and tried to put a link over "world!", the code would decide: "world" is
inside a link so we will just update that link.

Thus we would get:

```
<i><a href="hello">world!</a></i>!
```

instead of:

```
<i><a href="hello">world</a></i><a href="hello">!</a>
```

opw-1848351
closes #25187
2018-06-13 16:20:40 +02:00
Xavier Brochard b10e34ed1a [FIX] web_editor: add <em> as inline tag and remove duplicate strong
This commit closes #24818
2018-06-13 14:56:16 +02:00
Tomas Alvarez 1db6c8d0ad [FIX] mail, web_editor: allow tel links in email templates (#24926)
Before this commit: links like `tel:+1-555-555-5555` were being replaced
both in javascript (prefixing `http`, when using the summernote editor)
and python (prefixing the base url, when they were added directly to the template).

After this commit: the replacement is avoided on links with `tel` scheme.

This is related to commit: 8b97a39
2018-06-06 09:57:53 +02:00
Lucas Perais (lpe) 0046bf7292 [FIX] web_editor: disable button when html field loading
Backporting bed33e1 and 472c5a4f9f from v10.0

OPW 1853150
closes #25043
2018-06-05 09:52:09 +02:00