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
There is a logic on the front-end to escape translated text content when
saving them as ir.translation record.
This logic was in part base on html elements and if these element were
not coming from an html field other than "ir.ui.view" arch_db's field.
This logic was introduced in 8.0, and something similar was later
introduced in 9.0 with f5acea7, but in this instance, the information
[data-oe-model] on nodes was not available. Thus some html field from
other model than ui.ui.view would have their translation escaped
erroneously.
This commit adds a data-oe-model attribute on to-be-translated nodes
which will then be available to the frontend.
closes#10420
first-part-of: opw-659772
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.
The FieldTextHtmlSimple widget would focus on itself when changing its
value not by direct user interaction. But if this change was coming
from next/previous record, or an onchange that was breaking the
"autofocus" heuristic for field in Odoo.
With this commit:
- the autofocus heuristic is kept,
- if focused, selection is set at the end if it is possible on the
browser, else (old internet explorer and not visible field) the
selection is at the beginning.
opw-660486
User can't edit the first and last chars of a link (same issue for a lot of editors), and users don't want to click on edit link button in the editor bar.
When the user click (not if the user use arrow) on a link the link is activate with a content editable true and can edit the first and last chars.
opw: 654280
* add the branding in translation mode
* change javascript to add the lang in the context (automatically removed in the rte => allow to create record and edit when use an other default language of en_US)
* avoid double saved
The field `isNewWindow` is used to open a link in a new tab. In this
case, the field newWindow was used, and therefore the property was not
applied.
opw-657510
Depending of the location where the "Copying" happened, only text/plain
content could be available from the clipboard component.
So if no text/html was retrieved, we should fall back to plain text
pasting.
closes#9787
opw-657137
In the base summernote library, each event modifying the editable area
DOM trigger an 'onChange' event which update the textarea associated
with the editor.
Some widget (ImageDialog) have been entirely rewritten for Odoo without
copying this behaviour. Hence for those components, if they were the
last to be used and only in the instance of inline backend editor
(FieldTextHtmlSimple widget), before saving updating the widget value by
the current editor value is required.
closes#9784
opw-654240
Some feature of the iframe embedded editor may require csrf token
present, thus it has been added in the same way that cea29e0c0 did.
The web editor iframe template is also used to display the value without
editing it and in this instance having the csrf has no meaning.
opw-656685
Summernote sometimes doesn't take into account HTML comment could be
embedded in the edited content, this can lead to issue since this
situation can happen in Odoo.
This commit patch the "isVisiblePoint" summernote's function to take
care of this issue.
opw-656332
Issue: if the currency is before the value and we try to add a number at the begin of the value, the number is not saved (because the browser insert the number before the span).
Add a onEnableEditableArea in the rte to change the contenteditable value and the default behavior.
Currently server side there is two differents source for html content
displayed on a qweb rendered page:
1) ir.ui.view arch value
are stored as xml and are unescaped before being displayed, so we have
to escape the text nodes before saving.
e.g:
* should be stored as   since it is an HTML entity but
not a defined XML entity,
* & should be stored as & since when unescaping it, it
would become & which is invalid in HTML,
* < should be stored as &lt; since when unescaping it, it would
become `<` so HTML text node could become HTML element node.
The tag themselves can also be escaped but it often has the same result:
<em&;gt;blah</em> is the same as <em>blah</em> when unescaping
is applied to both.
But it is required is some instance, e.g <!DOCTYPE html> unescaped would
be invalid xml.
2) openerp.fields.Html value
are stored directly in HTML formatting and should, conversely, not be
escaped before being stored.
Thus when saving an ir.ui.view part modified thanks to the website
editor, an escaping of text node content is carried out to take this
into account, but the same was currently not done for the v9.0 new
translation system.
This commit apply the same logic when saving ir.ui.view as when saving
ir.translation values.