Commit Graph
172 Commits
Author SHA1 Message Date
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
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 Matthieu 6da7628b86 [FIX] web_editor: split h5,h3,...p... node to insert table
opw-686393
2016-11-08 15:48:47 +01:00
Christophe Matthieu af865c2e9e [FIX] web_editor: widget html preview doesn't match wysiwig editor (widget html iframe)
The widget html is used for plain text and html content.
Need to check if the content is a valid html code, if is not wrap with p tag every lines.

opw-692158
2016-11-07 12:02:13 +01:00
Christophe Matthieu a8e79e960a [FIX] bus,im_odoo_support, web*: fix various memory leaks
* Tip are never destroyed when change view mode
* unbind methods
* mail: memory leak with unbind methods
* web: memory leak because 'ui-autocomplete' is never destroyed
* web_editor: memory leak for wrong unbind on destroy
* web: memory leak: must remove fileupload handler
* bus: memory leak: correctly debind handlers on window in bus.Bus
* remove handlers on switch buttons and views $buttons
* remove handlers on breadcrumbs
* web: memory leak: correctly debind handlers
* im_odoo_support: memory leak: remove fileupload handler odoo_support

Note: part of this commit was actually authored by aab
2016-11-04 14:07:35 +01:00
qsm-odoo 9ea6861d7e [FIX] web_editor: allow editing t-field links
There is a hackish feature in the web_editor which forces the
contenteditable to true on links which are clicked and removes it
anywhere else in the page so that only the link is editable after
click. This allows to add text at the end of a link without adding it
outside of the link by mistake.

The feature was badly implemented because, if the link was editable
without having any parent which is editable, the contenteditable was
forced to true, then immediatly forced to false when forcing to false
every page element. This was the case for lots of t-field. By example
the product categories in eCommerce are t-field links which are in non
editable <li/> elements...
2016-09-22 09:41:39 +02:00
qsm-odoo c4784fc75b [FIX] web_editor: activate autoplay feature for videos
The checkbox was there to activate autoplay... but was not doing
anything since the web_editor/website split.
2016-09-20 13:40:53 +02:00
qsm-odoo 5e6df42800 [FIX] web_editor: use valid bootstrap for m2o editor options
The .dropdown is in a .btn-group environment while a .btn-group can
only contain .btn or .btn-group elements.

This induced problems where the m2o options covers the full overlay
environment, preventing clicks on the customize dropdown.
2016-09-15 15:43:32 +02:00
qsm-odoo 965d5a42fd [FIX] web_editor: allow to drop a snippet where its movement began
Before this commit, if we dragged a snippet and dropped it where we
began the drag, the snippet was removed.
2016-09-13 13:18:17 +02:00
qsm-odoo 5e9ebcfb01 [FIX] web_editor: properly call on_remove method of snippet options
The snippet options can define an on_remove method which was supposed
to be called when the snippet is removed. This was not the case since
the method was written so that the options were removed before the
on_remove method was called... (Un)fortunately, the on_remove callbacks
were not doing any critical job in current implementation. In saas-13
however, some elements will rely on this.
2016-09-12 15:35:16 +02:00
Damien Bouvy d7939282e9 [FIX] mass_mailing: avoid too long URIs by blacklisting fields in editor call
The call to the web_editor is made through an iframe with some get
parameters. While not really a problem in itself, this has the
disadvantage of generating long URIs. In some case, since all the
fields in the views are included as a GET parameter, URIs can be
generated that go up to several thousand characters. Most servers will
return a 414 for such URIs, preventing the edition of the mail
template in the view.

To avoid this problem, this commit extends the 'html_frame' widget and
blacklist 2 fields that can get too long once encoded.

Ideally, it would probably be better to stop sending all the fields and
simply add the *needed* fields one by one, but since it's difficult to
know exactly what fields might be needed and this is stable, I'm gonna
go with this 'workaround' but conservative fix.

opw-685646
2016-08-19 17:13:34 +02:00
Yajo 4b4bc68815 [FIX] web_editor: broken JS/jQuery helper
A jQuery element is not callable.
2016-08-01 10:02:45 +02:00
qsm-odoo f0620a9648 [FIX] web_editor,website: allow creating pages from edit menu
The code for page creation from menu edition dialog was there but
invisible to the user because of a wrong qweb template inheritance.
Indeed, the edit menu dialog relies on an extension of the link dialog
template. But this one is extended in-place in another location and
that extension is not considered when the second extension is made
because a t-extend always use the base template. The only solution to
achieve the same result is to copy the edit menu dialog qweb extension
in Javascript.

Note: the feature was still available from the link dialog in page
edition though because this was not concerned by the wrong qweb
extension.

However, adding a page by this way would create multiple pages because
one was created each time a page name was entered (and not only on
save !). So typing "test", then changing its mind and typing "hello",
then rechanging to "test", then hitting the save button created the
"test, "test-1", "test-2" and "hello" pages.
This fix takes advantage of an already present parameter which can
determine if a new page should be created or not. However, a code
refactoring should be done in master for these classes.
2016-07-20 15:59:53 +02:00
Christophe Matthieu 025263d3bf Revert "[FIX] web_editor: test jinja content to load editor in codeview"
This reverts commit f38f8930f0.

Revert for internal choice. Odoo want to use qweb in template and remove jinja support on next version.
If users want to use jinja they can change the view to use text widget instead of html widget.
2016-06-23 11:45:17 +02:00
Christophe Matthieu f38f8930f0 [FIX] web_editor: test jinja content to load editor in codeview
The preview change the content because the browser try to fix the dom.
If a user use jinja and activate the preview, the jinja code is (re)moved by the browser and broke the template.
2016-06-22 14:26:42 +02:00
Jeremy Kersten 613ee31f9c [FIX] web_editor: video - allow to add video from unknown source
There are not cat... but you cannot know all the existing website in the world...
So, have faith in the user !

To do: allow to customize size or get it from iframe provided
2016-05-13 12:37:51 +02:00
Nicolas Lempereur 38e35cc442 [FIX] web_editor: scroll and editing menu modal
The class modal-open on body tag allow to scroll on the modal content
which is useful if the content is taller than the window viewport.

When closing the modal, this class is removed but there may be another
modal open on which we will not be able to scroll to view
buttons/content if too big.

This commit check if a modal is still opened after closing an editor
modal and in the affirmative add back the modal-open class.

opw-674475

note : was already present in 8.0 with ec47493, it is also present for
web.Dialog (but the modal of the editor do not inherit from web.Dialog)
2016-05-12 15:56:14 +02:00
Adrien Dieudonne 68ba897ce9 [FIX] web_editor: fix svg issue
className should return a string but svg node returns an object
2016-04-25 10:34:18 +02:00
Raphael Collet 9fba75bd54 [FIX] web_editor: save translation values as HTML or XML fragment
The translation value is given as an HTML fragment.  It is converted to a valid
XML fragment if the translation's field requires it.
2016-04-21 16:14:34 +02:00
Nicolas Lempereur b21382bdd1 [FIX] web_editor: Cannot read property 'left' of undefined
This issue happen for example on a full runbot when clicking with
shift + key pressed on a sale order not in an editable.

We can see that initial_data.rect is only defined in mousedown when the
click target is inside an editable block, hence it could lead to an
issue otherwise.

closes #11527
2016-03-30 09:56:23 +02:00
Nicolas Lempereur 109c529c49 [IMP] web_editor: inline buttons shown over topbar
Before 9.0 web_editor separation in 8c55904, some style would make
inline button be visible over topbar.

This commit reintroduce that and also make the margin over the inline
editor content a little bigger (so the inline buttons on the top of a
content will cover a little less the topbar).

closes #11526
opw-671649
2016-03-30 09:54:05 +02:00
Nicolas Lempereur 85eda0c55f [FIX] web_editor: two editor and image bar buttons
Some image functionalities of the inline summernote would only take the
first of multiple editor into account when selecting the targeted image
of an image button action (image size, image padding, ...).

This commit select the appropriate editor given the current editable.

closes #11474
opw-668861
2016-03-25 11:39:57 +01:00
Christophe Matthieu feeac2a4f1 [FIX] web: various small issues in form view onchange/one2many
- Issue: Edit sale.order form view, add new line, change product who have
  taxes and click quickly on save (with slow network) => error message.
  Because some deferreds are lost.
- reduce number of reads and onchange for x2m widgets
- remove before_save method and use commit_value (the issue was that if the
  before_save and the change trigger an onchange, the onchange deferred is not
  checked before saving the content.
2016-03-14 10:14:16 +01:00
Christophe Matthieu 7ca31fdcde [FIX] web_editor: don't display the html content field
issue: message, click on a record, return to the list view, click on an other record => nothing desplayed.

opw-671047
2016-03-10 16:31:56 +01:00
Nicolas Lempereur 51641d2634 [FIX] web_editor: leave block after two enter
Before 3959afc the `node` tested would be the selection containing node,
but since then it may have been a `<br/>` which has some damaging
effects: now entering double enter at the end of a list, quote or code
block doesn't end this block.

Testing the use case corrected by 3959afc, the said change seems to have
no effect so this commit reverts it.

opw-667618
2016-03-09 16:01:49 +01:00
Christophe Matthieu bc4561b26b [FIX] web_editor: can't use mako/jija if remove space to prettify html
Addapt html method to prettify the html code and keep mako structures.

opw-668409
2016-03-03 15:41:02 +01:00
Nicolas Martinelli fad4788272 [FIX] web_editor: image size
Make sure to create an image of a size larger than zero. A size of zero
will generate a traceback.
2016-03-03 13:24:40 +01:00
Christophe Matthieu 55c7d2d5b0 [FIX] web_editor: don't convert style into class by default. Only if use style-inline (because very poor performance for sale.order form view because contains very crappy dom in website_description field) 2016-02-08 12:20:10 +01:00
Nicolas Lempereur 7c11d4e70f [FIX] web_editor: minor tweaks IE11
In IE11 the values can be not string (for example a number and so not
have .indexOf method), but then there will no be !important bits and we
can just ignore this feature (which check if an overriding rule has an
!important flag).

There was another edge case when getting a "" set style, we get undefined.

opw-667917
2016-02-04 16:50:22 +01:00
Christophe Matthieu d958cf541a [FIX] web_editor: enter keydown create new td only if the caret is on the last char of the last line of the td 2016-01-28 14:57:21 +01:00
Christophe Matthieu 2b4fb7e195 [FIX] web_editor: remove style attribute if empty 2016-01-28 14:57:21 +01:00
Christophe Matthieu 51a1926353 [FIX] computed html field should not have "note-editable" class
opw-660810
2016-01-28 09:28:33 +01:00
Christophe Matthieu 3de1b4a4ac [FIX] web_editor: reduce the min-size of the html preview
opw-660810
2016-01-20 13:23:24 +01:00
Christophe Matthieu f93e03c4c7 [FIX] web_editor: can indent table cell (with button and tab)
issue: the user select some line and keypress tab without indent, and the button indent doesn't work in table cell
2016-01-20 13:23:24 +01:00
Christophe Matthieu 6e47472486 [FIX] web_editor: firefox can have undefined value for style and broke inliner feature 2016-01-20 13:23:23 +01:00
Christophe Matthieu 2ef6e249d0 [FIX] web_editor: merge span when paste, only if no content between tags
opw-667263
2016-01-20 13:23:23 +01:00
Christophe Matthieu 86b80689d7 [FIX] web_editor: remove empty table ligne when paste content 2016-01-20 13:23:23 +01:00
Christophe Matthieu e5112ee00b [FIX] web_editor: use iframe only for html widget with style-inline mode 2016-01-20 00:15:10 +01:00
Christophe Matthieu 365e298fb1 [FIX] web_editor: inliner don't apply color when background-color 2016-01-18 17:09:02 +01:00
Christophe Matthieu 57fe8147f3 [FIX] web_editor: don't add double p tag at the begin of the document 2016-01-18 17:09:02 +01:00
Christophe Matthieu 958656d7e6 [FIX] web_editor: inliner take in care the '!important' attributes 2016-01-18 17:09:01 +01:00
Christophe Matthieu b27d24bfe9 [FIX] web_editor: don't limit the css inliner to the class but for all tag
(can reduce the performances)
2016-01-18 17:09:01 +01:00
Christophe Matthieu 4e0e376b0a [FIX] web_editor: use iframe instead of direct content for preview
The preview is not equal to the real email rendering because the backend css is present.
2016-01-18 17:09:01 +01:00
Christophe Matthieu 6e1ed6c8bb [FIX] web_editor: paste simple text must wrap first line by p and remove unless font 2016-01-14 15:21:39 +01:00
Christophe Matthieu faa7c750b2 [FIX] web_editor: change height for html field in readonly mode
issue: breaks the preview form views
opw-660810
2016-01-14 14:39:00 +01:00
Nicolas Lempereur 5c50ba322f [FIX] web_editor: title tag with translation
b24d759 changed the wrapping translation span tags, this commit take it
into account for the "translation" title tag.
2016-01-14 11:20:00 +01:00
Nicolas Lempereur 060cff9be3 [FIX] web_editor: get unlink button working
f3f7bd9 improved some link editing behaviour by adding contenteditable
attribute on it.

But if contenteditable is set on a link, using command "unlink" on the
element for `document.execCommand` does not work.

Hence this commit adds a code so the first click outside the link remove
contenteditable.

closes #10436

second-part-of: opw-659772
2016-01-13 16:28:29 +01:00
Christophe Matthieu 10efb0621f [FIX] website: editor: enable/disable save/undo/redo button when resize snippet 2016-01-13 16:05:22 +01:00
qsm-odoo cb79297a41 [FIX] web_editor: links edition (only website links)
Commit f3f7bd9f24 adds an improvement which allows the user to edit links in
an easier way. The problem is that it also allowed to edit... the edit
buttons (example: the discard button).

This commit moves the mentionned commit code below the code that checks
if the target can be edited or not.
2016-01-12 15:03:23 +01:00
Christophe Matthieu 0b2728d8b2 [FIX] web_editor: error when long delete keypress in mass_mailing html
issue: event does not a global var in firefox, and event is already prevented
2016-01-11 15:23:36 +01:00