Commit Graph
363 Commits
Author SHA1 Message Date
Christophe Simonis 9e159ef204 [MERGE] forward port branch saas-11 up to f830c7c3e3 2017-04-12 18:51:16 +02:00
qsm-odoo 4aab300070 [FIX] web_editor: allow to save unchanged icons with media dialog
There was a bug with the icon edition when following these steps:
- Open the Media dialog to edit an existing icon
- Hit the "save" button in the dialog without choosing the icon
- The edited icon disappears

This happenned for icons whose original values were aliases of the
related icon. Indeed, following these steps to edit an "fa-facebook-f"
was leaving the icon unchanged as expected but doing it for a
"fa-facebook" icon made the icon disappeared. This is because the
last one is an alias of the first one and that the media dialog was
ignoring aliasies when saving the original value.

opw-725813
2017-04-07 17:46:07 +02:00
Christophe Simonis aea68e4730 [MERGE] forward port branch 9.0 up to 51fe54dd8d 2017-04-07 17:34:51 +02:00
Nicolas Lempereur 105243afa6 [FIX] web_editor: fix select and modify video
There was an issue when selecting a video tag:

- a tag inside the video tag would be selected instead of the video tag
  so video could not be removed or modified (modifying it would add a
  video or image inside the video itself and so on).

- the selection was not conveyed to the editor so it would be lost
  consequently due to some code who restored it to what was saved on
  the editor.

This fix solves this by changing how the video tag was selected and
saving the selected range on the editor.

opw-724701
2017-03-29 16:35:39 +02:00
Christophe Simonis 27496730d8 [MERGE] forward port branch saas-11 up to c2569b9df1 2017-03-28 14:51:14 +02:00
Christophe Simonis 70b770d62e [MERGE] forward port branch 9.0 up to 8376f538b5 2017-03-24 17:57:29 +01:00
qsm-odoo 1505fee0e3 [FIX] web_editor: properly transcode fa alias icons
When adding a font-awesome icon to a mail template, the icon is
converted to an image once the template is saved. To do that, the
code checks all the `.fa-XXX` definitions in the stylesheets to know
which content the image have to use. The problem is that this was
not considering the font-awesome aliases. Indeed, the `fa-facebook-f`
icon was able to be used while its alias `fa-facebook` was not working.
2017-03-22 13:12:33 +01:00
Christophe Simonis 31ebb07773 [MERGE] forward port branch saas-11 up to aefdf96c25 2017-03-17 17:55:30 +01:00
Christophe Simonis aefdf96c25 [MERGE] forward port branch 9.0 up to af64780a2d 2017-03-17 17:06:32 +01:00
qsm-odoo 7401807510 [FIX] web_editor: copy/paste in the editor
Commit 906875fc78 (followed by commit
76be5eed44) tried to tweak to copy/paste
functionality of the editor.
Indeed, in PDF file, when copying a paragraph, a line feed is added at
each forced line break (page width end). This forced a line feed and
a new paragraph in the pasted text. The goal was to get rid of those
useless linebreaks when pasting.

The ideal solution would be to detect that the text was copied from
a PDF but it is not possible. However, this commit improves the
heuristic: if this is not plain text, then nothing is done, the content
is pasted normally. If it is plain text (like when copying from pdf),
then each line break which is surrounded by letters or numbers is
considered an useless line break and replaced by a space. This is
obviously not perfect but the previous implementation was really wrong
(it was removing line breaks which were not preceeded by punctuation in
all cases, which was removing lots of useful line breaks).

Note: this commit also fixes a bug -> text was not able to be pasted
with Internet Explorer.

opw-715920
2017-03-17 11:44:28 +01:00
Nicolas Lempereur 508a002e69 [FIX] web_editor: glitch english several times
When using the iframed editor with multilang selector (present if there
is another lang installed than en_US) an "English" language was present
before each translation language.

opw-696891
2017-03-17 08:10:52 +01:00
Nicolas Lempereur f50ba68be7 [FIX] web_editor: handle margin:initial correctly
The transcoder (which transforms stylesheet rules to inline style) did
some compression of the padding and margin css properties to not always
have margin-top + margin-right + margin-bottom + margin-left.

This could cause an issue when the value of margin or padding contained
an initial or inherit value because browsers (at least firefox and
google chrome) doesn't allow it. Thus the preview could for example have
bigger veritcal spaces arround `<p />` tag than what was seen when
editing.

With this fix instead of invalid:

    margin:initial initial initial initial

we have:

    margin:initial

And instead of invalid:

    margin:initial 5px 6px 7px

we have:

    margin-top: initial; margin-right: 5px; margin-bottom: 6px; margin-left: 7px;

opw-706535
2017-03-16 18:26:32 +01:00
Christophe Simonis 6b3a80862c [MERGE] forward port branch saas-11 up to 503227838d 2017-03-06 13:23:38 +01:00
Christophe Simonis be0c9596c8 [MERGE] forward port branch 9.0 up to 8092ee8c6a 2017-03-06 12:21:27 +01:00
Denis Ledoux 95d3263338 [FIX] web_editor: change of iframe URL on record loaded
When changing of record, through the pager or the breadcrumb, the URL of the iframe
must change, as the model and id of the record is included in the URL

This wasn't done before this revision, and it could
lead to an INTERNAL SERVER ERROR in case of a deletion
followed by the loading of another record: the URL
of the iframe was still set to the former record,
and this URL crashed as the record no longer existed.

e.g.
- Create a new mass mailing, subject 1, add a random block in the content then save
- From this newly created mass mailing, Create a new mass mailing
  (directly with the create button)
  Subject 2, add a random black in the content and save
- Delete the second mass mailing
- Return in the mass mailing kanban view through the breadcrumb
- Open the mass mailing 1
- You had an internel server error, due to the fact the URL of the iframe
  was still the one of the second mass mailing.

opw-710239
2017-03-02 17:59:22 +01:00
Christophe Simonis 5c4744cd1f [MERGE] forward port branch 9.0 up to 5f9f4f4d9d 2017-03-01 14:07:15 +01:00
Nicolas Lempereur 65c1926a37 [FIX] web: html_frame field and lang vs onchange
In mass mailing there is several possibilities of states when rendering
the widget with a possibly new value:

1. we are not in edition
  a. we are in same language than user language => the editor content
     can be updated
  b. we are in a different language => the content cannot be updated

2. we are in edition
  a. we are editing translation : the editor content cannot be updated
  b. we are not editing translation (editor language == en_US)
    i.   we are requesting editor update (by having magic value
         `on_change_model_and_list`) => the editor can be updated
    ii.  we are in same language than user language => the editor content
         can be updated
    iii. we are in a different language => the editor content cannot be
         updated

In summary:

- if language is the same than the user, we can update the value
- if value is magic `on_change_model_and_list` and we are not translating,
  we can update the editor

Before this commit, this worked as expected but for 2.a.ii. which if the
user language was not en_US would for example prevent editor updating.

closes #15583
closes #15414
opw-708032

inspired by a27e24c6d1

note: the fix is a fix for 9.0 and saas-11 only.
2017-02-23 16:52:45 +01:00
Christophe Simonis b7c7591bfb [MERGE] forward port branch saas-11 up to 71773e1f1c 2017-02-01 19:08:14 +01:00
Christophe Simonis 71773e1f1c [MERGE] forward port branch 9.0 up to a53063606a 2017-02-01 18:16:15 +01:00
qsm-odoo b836e00d70 [FIX] web_editor: allow to copy paste when editing translations
When editing translations, you were not able to copy/paste texts before
this commit. Indeed, in some contexts, in some browsers, copy/pasting
text was creating a new paragraph inside the translation, preventing it
to be saved.

This commit simply adds code to remove these paragraphs each time text
is changed.

A more elegant solution will be found for master with website and
editor improvements.
2017-02-01 13:09:16 +01:00
Christophe Simonis 44276dfdc3 [MERGE] forward port branch saas-11 up to a0aca47fef 2017-01-17 19:12:20 +01:00
Christophe Simonis 70f86ce4e8 [MERGE] forward port branch 9.0 up to 16fa61b34f 2017-01-17 18:04:57 +01:00
Christophe Matthieu 72fbe860e8 [FIX] web_editor: debug mode is not apply in editor iframe 2017-01-16 11:11:04 +01:00
Nicolas Lempereur 2c66f7bc7f [FIX] web_editor: italic odd behavior because typo
An italic node would be taken as a basic node containing text and thus
would be merged unexpectedly.

For example with the following content : "<i>hello</i> world" removing a
letter of 'world' would merge the text node with hello making it italic.

opw-703722
2017-01-11 10:38:29 +01:00
Christophe Simonis 482fd04167 [MERGE] forward port branch saas-11 up to f1583504ce 2017-01-10 13:46:17 +01:00
Christophe Simonis f1583504ce [MERGE] forward port branch 9.0 up to 3f7b1f6083 2017-01-10 12:07:44 +01:00
Nicolas Lempereur 3f7b1f6083 [FIX] web_editor: ignore read only + debug + write
In some case (for example the one solved with b51d21c5) we can have
write done on a field text in read only mode.

With 98ed53ce if :

- such a case happened (in b51d21c5 the fix only worked after the given
  field was written one time) or a similar instance,
- and the user was in debug mode,
- and the widget used was TextFieldHtmlSimple

this could lead to an issue with the code trying to toggle the code view
mode whilst the editor is closed.
2017-01-10 08:31:38 +01:00
Nicolas Lempereur f27e69eced [FIX] web_editor: harmless ; missing in 98ed53ce 2017-01-09 16:26:15 +01:00
Nicolas Lempereur 81b668c3e3 [IMP] web_editor: tour testing inline editor saving (up to s11)
With 98ed53ce when a form view is saved when a html field is in code
view mode, the change is not lost.

This new backend tour check that when saving in or not in code view, the
content is saved effectively.

The test not in code view would ensure issues like #14381 #14351 #14394
are detected on runbot.

closes #14475
opw-693052

note: the old test system is used so this test is only for up to saas-11
2017-01-09 16:06:46 +01:00
Nicolas Lempereur 98ed53ce3a [FIX] web_editor: don't lose modified code view content
The intended scenario when using the code view is the following:

1) click on code view button to use code view
2) make changes
3) click on code view button to get back to wysiwyg view
4) save from the wysiwyg view

If the 3rd step was not done:

- for the inline editor, we lose the changes that have been done in
  code view,
- for the iframe editor, we lose the entirety of the content.

At one time the user was forced to go back to wysiwyg before being able
to save, but this have been removed hence the present usability issue.

With this fix, when the editor content is saved, if the user is in code
view he is automatically set back to wysiwyg view.

fixes #14648
closes #14475
opw-678677
opw-693052
2017-01-09 16:04:42 +01:00
Christophe Simonis 81f59cee2c [MERGE] forward port branch saas-11 up to b844d93889 2017-01-02 14:38:59 +01:00
Christophe Simonis b844d93889 [MERGE] forward port branch 9.0 up to 3805eb620a 2017-01-02 12:49:55 +01:00
Denis Ledoux f616b2d20d [FIX] web_editor: do not focus or set an empty image
When editing the website, adding a gallery, choosing the grid mode
and then adding images, an extra, empty, image was
added to the grid, in the first position, making it looking weird
or at least not aligned.

This was due to the `start` method of the widget, which
is trying to focus the image in the images browser when
you double click on an image (in the big image building block
for instance) and set an image without url in the case
where `o.url` was undefined, and the url of one of the records
was also undefined.

opw-692205
2016-12-19 13:56:38 +01:00
Christophe Simonis 18456b9d42 [MERGE] forward port branch saas-11 up to 321b7dc 2016-12-09 15:44:01 +01:00
qsm-odoo 3fd74146c2 [FIX] web_editor: let whole backend know when leaving fullscreen editor
An enterprise feature was in conflict with the fullscreen mode of the
editor (see commit https://github.com/odoo/enterprise/commit/125414b73e4d839fc44c445bb83591e84f4c855d which fixes it).
This commit forces this feature to be retriggered when the fullscreen
mode is left (as the feature is now put asleep during the
fullscreen mode).

This should obviously be improved to handle fullscreen mode with a more
robust way.
2016-12-07 11:07:14 +01:00
Christophe Simonis 457a705bf0 [MERGE] forward port branch saas-12 up to d1fddd2 2016-11-22 14:02:03 +01:00
Christophe Simonis d1fddd24dd [MERGE] forward port branch saas-11 up to 659fb5d 2016-11-22 13:28:15 +01:00
Christophe Simonis 64e73b8352 [MERGE] forward port branch 9.0 up to 290601e 2016-11-22 12:39:02 +01:00
Nicolas Lempereur a6e3ae6b8c Revert "[IMP] web_editor: don't lose modified code view content"
This reverts commit 897290dd3f.

It seems it breaks other use case, since this was fixing more a
usability thing (need to click back on code view to save code view
changes) it is better to revert than to add drawback.

A better fix should be introduced, or the solution would be to not fix
it and have a warning indicating what needs to be done.

opw-693052
2016-11-21 14:22:14 +01:00
Christophe Simonis 13dc7041a6 [MERGE] forward port branch saas-12 up to 1ef4061 2016-11-17 15:24:36 +01:00
Christophe Simonis 1ef4061e68 [MERGE] forward port branch saas-11 up to 3b2f4e2 2016-11-17 14:48:43 +01:00
Christophe Simonis 3b2f4e244f [MERGE] forward port branch 9.0 up to 7ee09ed 2016-11-17 14:37:19 +01:00
Nicolas Lempereur 897290dd3f [IMP] web_editor: don't lose modified code view content
The scenario when using the code view is the following :

- click on code view button to use code view
- make changes
- click on code view button to get back to wysiwyg view
- save from the wysiwyg view

If the 3rd step is not done:

- for the inline editor, we lose the changes that have been done in code
  view,
- for the iframe editor, we lose the entirety of the content.

At one time the user was forced to go back to wysiwyg before being able
to save, but this have been removed hence the present usability issue.

With this fix, when the editor content is saved, if the user is in code
view he is automatically set back to wysiwyg view.

closes #14339
opw-693052
2016-11-16 14:06:01 +01:00
Christophe Simonis dece72d010 [MERGE] forward port branch saas-12 up to ca20038 2016-11-15 13:58:55 +01:00
Christophe Simonis ca2003839a [MERGE] forward port branch saas-11 up to 58f68cc 2016-11-15 13:19:55 +01:00
qsm-odoo 2757775ed3 [FIX] web_editor: allow vimeo, youku and undefined video sources again
The refactoring made with https://github.com/odoo/odoo/commit/62fb1bb92493b00bd45ed3f4eced5ca8b23f81d6#diff-2b3acc31ced2b1e9f7522a3e29f33c22L825
broke the possibility to add vimeo, youku or other undefined video
sources.

This is because of jQuery. With jQuery you can create elements thanks to
multiple methods. From least efficient to most efficient:

- All in a string:
$("<tag attr1='value1' attr2='value2'/>");

- Tag in a string, attrs thanks to methods:
$("<tag/>").attr("attr1", "value1").attr("attr2", "value2");

- Tag in a string, attrs in second arg:
$("<tag/>", {attr1: "value1", attr2: "value2"});

The mentionned refactoring transformed the use of the second method
into the use of the last one. But there is a bug in jQuery: you cannot
use the first method and the last one all together. So:

$("<tag attr1='value1'/>", {attr2: "value2"});

will create a tag with attr1 but will totally ignore the attr2 part.

It happens that the allowfullscreen attr was left directly in the
creation string for vimeo and youku, preventing the src to be added.

This commit removes the use of allowfullscreen attr as fullscreen
is already handled by source players anyway.
2016-11-14 17:32:23 +01:00
Christophe Simonis f93bada93e [MERGE] forward port branch 9.0 up to fb763f3 2016-11-14 14:56:14 +01:00
Christophe Matthieu 6da7628b86 [FIX] web_editor: split h5,h3,...p... node to insert table
opw-686393
2016-11-08 15:48:47 +01:00
Christophe Simonis 3d085f632d [MERGE] forward port branch saas-12 up to 6386037 2016-11-08 15:01:20 +01:00
Christophe Simonis 63860373ac [MERGE] forward port branch saas-11 up to c19f546 2016-11-08 14:43:28 +01:00