Commit Graph
191 Commits
Author SHA1 Message Date
Nicolas Bayet 013f0da147 [FIX] web_editor: properly save history step when pasting text
Before this commit, when trying to paste an url, the editor was
properly creating a link but did not create a step in the history.
So when the user hit enter just after the paste, the last link
insertion was reverted.

Task-2720366

closes odoo/odoo#83396

X-original-commit: 0e37742d3caba1c6544e5b466503f155626375eb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-26 13:11:14 +00:00
Benoit Socias 9943931c6f [FIX] web_editor: remove gradient background image when removing format
Before this commit the removeFormat command was only doing its default
native implementation, which did not clean the background-image CSS
property. Because of this, text-gradients became highlight gradients.

After this commit in addition to the default native implementation, the
removeFormat also clears the background-image CSS property.

Steps to reproduce:
- edit the website homepage
- drop a text snippet
- enter a new line of text
- set a text gradient on the new line
- switch the new line to Heading 1
=> new line has the gradient used as background

task-2741684 (was part of task-2666200)

closes odoo/odoo#83306

X-original-commit: 97da1c2106d2a0e76dff1353e56b74d70db55eb2
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-25 12:19:22 +00:00
Antoine Guenet 93151fb73b [FIX] web_editor: properly apply color in nested inline contexts
The colorpicker failed in cases like:
```xml
<font>a<span>b</span>c</font>
```
where we select the letter "b".
This was because `applyColor` only considered direct children of the
`font` element. This extends it to deal with further descendants of it.

task-2623347

closes odoo/odoo#83254

X-original-commit: 5d8d98812a4f351abd27389c4992bf9e753833b7
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-24 14:13:45 +00:00
Antoine Guenet c616f38f77 [FIX] web_editor: display current text color in text color button
The editor toolbar button to trigger the colorpicker is supposed to show
the color of the currently selected text. This was failing in iframes
because the code was called on the wrong document.

task-2623347

X-original-commit: 7ad6536dd98f9749d63bfc7292e490f6ac629b9c
Part-of: odoo/odoo#83254
2022-01-24 14:13:45 +00:00
Nicolas Bayet a565e73574 [FIX] web_editor: properly position the toolbar
In some undetermined circumstance in chrome, the selection rect is
wrongly defined.

Task-2728792

closes odoo/odoo#83248

X-original-commit: e9ee8175538e1201acb2ae108b2283f55217ca5f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-24 13:19:49 +00:00
Antoine Guenet 2093aefbe8 [FIX] web_editor: remove check ids in tests
The random ids of checklists and stars are preserved in the dom, which
is needed for their readonly check features to work. However, it
complicates testing. This systematically removes these ids in tests.
It also removes the ids when they are not needed anymore (the node is
not a checklist anymore for instance).

closes odoo/odoo#83137

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-21 15:04:09 +00:00
David Monjoie 5474c8b1df [REV] web_editor: revert prevent editor powerbox hint duplication
This reverts bfed1edd26312488dc0f45e8982b51ea4d98db76.

That commit had issues which were hidden by the fact that tests had an
only in them due to a prior mistaken commit. Therefore, it must be
reverted as a proper fix needs to be found.

X-original-commit: 22c2a9dca29adcad84072e3f053ab78b7834f4f3
Part-of: odoo/odoo#83137
2022-01-21 15:04:09 +00:00
David Monjoie d2d763f30e [FIX] web_editor: fix lingering only in tests
X-original-commit: 47dc1639ab18ae9080fc4a7a3c2822c4cce2175a
Part-of: odoo/odoo#83137
2022-01-21 15:04:08 +00:00
Nicolas Bayet b467e4df8c [FIX] web_editor: remove image toolbar when removing image
Task-2728793

closes odoo/odoo#82881

X-original-commit: 0ff6f919e10388f7fd6d8efbfb0c8f9644b2505e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-17 12:17:31 +00:00
Nicolas Bayet 48045a069b [FIX] web_editor: change fix for scrolling powerbox
The fix to add an `overflow: hidden` in order to prevent the browser
from chaning the scroll create a glitch where the scrollbar dissapear
when it is overflow: hidden.
A new css property exists to specify exactly this behavior
(`overscroll-behavior: contain;`).

Task-2728791

closes odoo/odoo#82880

X-original-commit: 4cfa9e786d41a27d1bc850eff4fc89e1c4b32974
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-17 12:17:28 +00:00
Nicolas Bayet d3b328358f [FIX] web_editor: prevent editor powerbox hint duplication
Whenever the browser is lagging between multiple enter,
the command hints were not being updated until the browser
main thread process the event queue.

Task-2728794

closes odoo/odoo#82795

X-original-commit: bfed1edd26312488dc0f45e8982b51ea4d98db76
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-14 16:37:54 +00:00
Antoine Guenet dc17e84778 [IMP] web_editor: prevent icon and text tools in stars widget
When clicking, double clicking or triple clicking in the stars widget of
the Powerbox, we don't want to see the regular options of icons or text.
This prevents them from showing.

task-2575449

closes odoo/odoo#81920

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-14 10:21:31 +00:00
Antoine Guenet d6688ca759 [ADD] web_editor: allow rating with stars in readonly fields
Similar to checklists, this allows the user to click the powerbox stars
widget even in readonly mode, so as to change a rating without going in
edit mode.

task-2575449

Part-of: odoo/odoo#81920
2022-01-14 10:21:30 +00:00
Antoine Guenet 41e98ccbe4 [FIX] web_editor: check/uncheck checkboxes in readonly fields
When a checklist is present in an html field, there is a feature that
allows us to check/uncheck its boxes without going through edit mode.
That feature was broken due to a dead callback in wysiwyg.js, which is
hereby restored.
Meanwhile, the behaviour of checklists had changed but the python code
handling the readonly checking/unchecking hadn't so this brings it up to
date[1].
Finally, the code managing checklist ids was unnecessarily complicated
as it was trying to keep the ids consecutive for no particular reason.
This refactors it to simply use unique ids based on date stamps.

[1] It used to be that checking a box checked all the children of that
box but it was in the meantime decided not to do that anymore.

Part-of: odoo/odoo#81920
2022-01-14 10:21:30 +00:00
Antoine Guenet 8266b978e1 [ADD] web_editor: two new powerbox widgets to rate with 3 or 5 stars
This adds two new widgets to the powerbox, which allow the user to
quickly insert 3 or 5 stars, then click on them to color them gold.

task-2575449

Part-of: odoo/odoo#81920
2022-01-14 10:21:29 +00:00
Nicolas Bayet 89c215983b [REF] web_editor: remove dead code
closes odoo/odoo#82742

X-original-commit: a101ead524148825c99a4032a50138140527365a
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-01-14 09:25:50 +00:00
David Monjoie 2d295d6c1f [FIX] web_editor: fix multiple editors removing each other hints
The previous code resulted in only the last editor to trigger its
handler having hints, as all the others would be killed by the last one.

closes odoo/odoo#81743

Task-id: 2632841
X-original-commit: e24b039ea120597ff5438deca3c69c7a1d54cd31
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-12-21 15:56:00 +00:00
Antoine Guenet c53ebf8244 [FIX] web_editor: prevent line breaks at edges of anchor on press enter
When pressing enter at the edge of an anchor that is a child of an
unbreakable element, we inserted line breaks in the anchor itself, which
is unexpected. This inserts the anchors after/before it instead.

closes odoo/odoo#81662

X-original-commit: df6f8dd0c54c40ea7edbd3821ae068d79b1b7af7
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-12-20 16:04:49 +00:00
Nicolas Bayet ea5fc6933d [FIX] web_editor: fix unlink when nested tag
Whenever there was a tag inside a link
(e.g.`<a href="..."><b>link</b></a>`), it was impossible to unlink.

closes odoo/odoo#81112

X-original-commit: a7f2027c6131309b239026b4e1299a6f396171dd
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-12-09 12:55:46 +00:00
Nicolas Bayet 4bde8e8b38 [FIX] web_editor: properly call addRowBelow
The call to `addRowBelow` was not updated to the new API.

Task-2698729

closes odoo/odoo#80896

X-original-commit: f7fb967cd8ada702e298d097ea107fda802fa6a4
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-12-06 12:55:07 +00:00
Nicolas Bayet c911fa6395 [FIX] web_editor: remove console.log
closes odoo/odoo#80428

X-original-commit: bc6114b8efc6db10e4d26dc20aaa5481b31c3275
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-26 11:18:06 +00:00
Nicolas Bayet 10385a2aac [FIX] web_editor: keep table styling
Before this commit, the styles of the table were not kept when
copy/pasting a table generated by the Odoo editor. Now it is.

Task-2657445

closes odoo/odoo#80246

X-original-commit: 6f4eff378fc24bdd5e8a84ee485832162108a400
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-24 09:32:00 +00:00
Nicolas Bayet 57127f1721 [FIX] web_editor: prevent editor observing technical modification
Whenever the qweb plugin modified the dom for rendering purposes,
the mutations were observed but shouldn't. The reason was that the
reference to the editor was missing in the plugin and therfore it did
not call `observerUnactive` and `observerActive`.

Task-2695658

closes odoo/odoo#80182

X-original-commit: e973526ffe6deba778a613eb4053ba3017f9fb00
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-22 14:48:11 +00:00
Sébastien Geelen (sge) 953b612658 [FIX] web_editor: fix monetary fields Edition in FF
Changing value in monetary fields was not working properly in FF :

The ZeroWidthSpace inserted by the deleteRange function cannot be selected;
trying to do so loses the selection for some reason.

task-2679088

closes odoo/odoo#80071

X-original-commit: 1b36b4e8a6b319de10b6c1144c37533dab0e2f36
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-19 10:42:07 +00:00
Nicolas Bayet 12953e98b9 [FIX] web_editor: avoid scroll on undo/redo
When performing undo/redo on some page, because some unneded mutation
get recorded, the page scroll to another location (either up or down).
This commit add a mechanic that filter out thoses unnecessary mutations.

task-2667885

closes odoo/odoo#79620

X-original-commit: 125730ffd9322d34ef1c7d8d0298457de3e65f90
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-11-16 10:02:29 +00:00
Nicolas Bayet ebb4d39571 [FIX] web_editor: activate the redo button when needed
Because the `_historyStepsStates` was not fully set at the time of
calling `historyStep` in `historyUndo` or `historyRedo`, the listener
for the event "historyStep" was triggered to early and `historyCanRedo` at
that time could not possibly be accurate.

This commit call `historyStep` after setting all ids in
`_historyStepsStates`.

task-2667885

X-original-commit: 659b530516e13df77eed6254b81e72b8009a71bf
Part-of: odoo/odoo#79620
2021-11-16 10:02:28 +00:00
Nicolas Bayet b6ea6d14d2 [FIX] web_editor: enable selection under toolbar triangle
In the editor, there was a little spot where it was impossible to
click in order to select a text.

Task-2684378

closes odoo/odoo#79642

X-original-commit: 02c0cce926b1252596f10299597a9c984a8341ac
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-15 11:22:26 +00:00
Sébastien Geelen (sge) 90f0df32ac [FIX] web_editor: stop passing variables to _t function
Some variables were used in _t function instead of raw strings.
One string was not translated properly.

task-2686066

closes odoo/odoo#79505

X-original-commit: 7c5b475532dca1efea5599fb5a3f61ea646d8267
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-08 13:24:33 +00:00
Nicolas Bayet d5a031a9a3 [FIX] web_editor, website: only save dirty element
Before this commit, when inserting a new snippet or moving a snippet
that was already in the page would temporarily create hooks (`we-hook`)
in the page. The insertion of thoses hooks would trigger mutation
in the dirty observer (observer defined in edit.js) and mark all
oe_structure for which a hook was temporarily inserted.
Thus, creating unnecessary views in the backend.

Now, the code skip the mutations of the drag and drop hooks.

Task-2567752

closes odoo/odoo#79394

X-original-commit: 1b80fe9b56acea09a6784691561df65fe6349f50
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-08 10:15:56 +00:00
Hubert Van de Walle (huvw) 5f2c143623 [FIX] web_editor: don't show the active style entry if absent
Steps to follow

  - Edit a report with studio
  - Add an inline text element
  - Select it
  - Select the text in the sidebar
  -> An error is raised

Cause of the issue

  firstButtonEl is undefined because the style section is not always
  present in the toolbar

opw-2674302

closes odoo/odoo#79335

X-original-commit: 45b590d8961d56f8d207c22efbf1ba7188a3b1fa
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2021-11-03 16:02:11 +00:00
Nicolas Bayet 0f668e28bf [FIX] web_editor: allow non editable to be unbreakable
When starting the editor in a web page, if there is no content, the
oe_structure is not editable. Adding snippet at that moment will
trigger `idSet` on the node with isUnbreakable returning `false` for
the node that is unbreakable because of the check
`!node.isContentEditable` in `isUnbreakable`.

When setting the ouid for the first time with `idSet`, `getOuid` is
called with `optimize` to `true`. So all the ancestor of a node that
should be unbreakable will have the wrong ouid.

Performing any command to a node with a wrong ouid is suceptible to
wrongly be reverted.

By removing `!node.isContentEditable`, the node will have the proper
ouid in case an ancestor is not editable.

task-2633368

closes odoo/odoo#79108

X-original-commit: 13804df7740317b8198e7c1de418ff019c05862b
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-28 07:49:29 +00:00
Nicolas Bayet 3c80860110 [FIX] web_editor: properly remove hint on mass_mailing
Before this commit, the editor hint were not properly
removed because the queryselector was made on
the wrong document.

Task-2678410

closes odoo/odoo#79104

X-original-commit: d582f43d81cb570017ef6ff90159cdb6a7ff2874
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-28 07:49:25 +00:00
Nicolas Bayet e2763e0f8b [FIX] web_editor: use wrapper around video
When pasting an youtube url in the website builder, the iframe
was inserted without the wrapper used by the website builder.
Now we use the same wrapper as by adding a video through the
video modal.

task-2668224

closes odoo/odoo#79095

X-original-commit: 0cffd7fcdc631b95795d9d819197e5f91ed8195c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-28 07:49:21 +00:00
Nicolas Bayet 85b0845c65 [FIX] web_editor: poperly add youtube on website builder
In the website builder, when pasting a youtube url,
we can transform it to an iframe in the editor through the
Powerbox.
Adding the iframe did not remove the text in the website builder.
Now it properly remove the text in note and the website builder.

X-original-commit: a9c363cb2c6a88f7f4b1ef09b8a8f9caf39d8f32
Part-of: odoo/odoo#79095
2021-10-28 07:49:21 +00:00
Nicolas Bayet e795186dec [FIX] web_editor: delete unicode character
Before this commit, when trying to delete one
unicode character (e.g. 😍), only one javascript character was delete
but one unicode character (e.g. 😍) could be two javascript characters
as the javascript string is coded in utf-16.

This commit fixes that by calculating the size of one unicode character
from the javascript string.

Task-2658890

closes odoo/odoo#79071

X-original-commit: fea5b87615077f5f41dec8c4d1480f157bbd26ae
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-27 14:01:43 +00:00
Antoine Guenet 218e9bb2aa [FIX] web_editor: prevent pasting blocks into paragraph-related elements
When pasting HTML, we have to be careful not to introduce invalid HTML.
The editor corrected for blocks within inlines but failed to prevent the
invalid pasting of blocks within paragraph-related elements
(eg., `<p><h1>text</h1></p>`). This fixes that issue by unwrapping all
blocks from the copied content when trying to paste within an element
that doesn't accept paragraph-related elements as children.

Notably, this fixes an issue that was caused by that problem, in which
pasted HTML content could not be saved because it was invalid.

task-2632676

closes odoo/odoo#79070

X-original-commit: 9c77834e03516f831a9600f0ba4131c957b3ba74
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-27 14:01:39 +00:00
David Monjoie 30c53a4370 [FIX] web_editor: fix traceback when clicking outside any snippet
This bug was introduced by
https://github.com/odoo/odoo/commit/2a7436d83abe178bd21c0694edc9825f5d70d65f.

closes odoo/odoo#79057

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-27 11:56:15 +00:00
Antoine Guenet 7dd6698bd4 [FIX] web_editor: properly display the state of list in the toolbar
When selecting text in a list, the toolbar should show that a list is
selected, and which type. It however failed to do that, which is fixed
with this commit.

task-2638422

closes odoo/odoo#77738

X-original-commit: 2a7436d83abe178bd21c0694edc9825f5d70d65f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
Part-of: odoo/odoo#79057
2021-10-27 11:56:15 +00:00
Nicolas Bayet 4c1c38bb85 [FIX] web_editor: allow iframe on website builder
On website, if an iframe was in the page, the iframe was removed
when calling the redo command of the insertion of the iframe (and
also other cases).
 The reason is because of a sanitization process that is usefull only
 in a collaborative context.

 This commit disable the sanitization when the collaboration is not
 active.

task-2670597

closes odoo/odoo#79056

X-original-commit: 2b9595a1f2d8ee1c019751d4cb080fe9b9f4c05c
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-27 11:56:10 +00:00
Sébastien Geelen (sge) fa92642d5c [FIX] web_editor: traceback when tab in table layout
When the editor was inside a table in the odoo view HTML,
The KeyDown detected that the selection was inside a table
and was trying to add a row bellow the table outside the editor.

task-2601451

closes odoo/odoo#78396

X-original-commit: d1ced1b5a6ad0099fbdcca2530e1e06034108755
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Sébastien Geelen <sebgeelen@users.noreply.github.com>
2021-10-14 16:16:09 +00:00
David Monjoie ce639f28a9 [FIX] web_editor: fix img being removed on copy/paste
The img nodes where being wrongly considered empty by isShrunkNode
because the image was not loaded yet.

closes odoo/odoo#77646

X-original-commit: d18d51191bca8f063effd4a216c3963c187a8767
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-04 14:12:15 +00:00
b63ee52552 [FIX] *: remove scss 'extend' from dropdown components
This commit removes all the 'extend' initially introduced to avoid code
repetition and ensure visual consistency across Bootstrap and Owl dropdowns.

Despite achieving the desired results, using 'extend' in this context
was seriously impacting the bundle generation time, probably due to an
underestimated amount of Apps' legacy-code applied on these elements.

In order to achieve the same results, the chosen strategy is to add
Bootstrap default classes directly into Owl dropdowns.
Also, it moves code related to bootstrap dropdown in 'webclient.scss',
leaving 'core/dropdown/dropdown.scss' for Owl code only.

Due to the discrepancies between Bootstrap and Owl html
structure, the '.dropdown-item' class could not have been added
directly to Owl's '.o_dropdown_item' itself, without refactoring
the Dropdown component structure.

// ==== Bootstrap 4.6 default Structure ================================
<div class="dropdown-menu">
  <button class="dropdown-item" type="button">Action</button>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== OWL default Structure before this commit =======================
<ul class="o_dropdown_menu">
  <li class="o_dropdown_item">
     <span>Action</span>
  </li>
  <li class="o_dropdown_item">
     <a href="#">Another action</a>
  </li>
</ul>

// ==== OWL Structure after this commit ================================
<div class="o-dropdown--menu dropdown-menu">
  <span class="dropdown-item">Action</span>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== web.assets_backend.css Bundle Generation Comparison ============
With all modules installed (enterprise edition over runbot):
Before this commit, bundle took ~2.5s and ~4s to generate and weighted ~322kB (~2.5MB uncompressed)
After this commit, it takes between ~1.2s and ~1.6s and weights ~257kB (~1.6MB uncompressed)

closes odoo/odoo#77649

X-original-commit: 84715436d87bb05b421bc9ccaacda67d07571690
Related: odoo/enterprise#21370
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Stefano Rigano <sri@odoo.com>
Co-authored-by: François Georis <fge@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
2021-10-04 07:57:00 +00:00
Benoit Socias 2e35193b94 [FIX] web_editor: compute deepest position offset according to used node
Before this commit when computing the deepest position for a non-visible
node, if that node had no next visible sibling it used the previous
siblings, but it still marked the offset within that sibling as 0.
Because of this, the selection sometimes got lost.
E.g. in Firefox, drop an "Image - Text" block and triple click on the
header text: upon changing its color the range got set to the text node
but ending at offset 0.

After this commit if the used node in the "previous sibling" from the
evaluated element, the offset is set to the length of that node.

task-2655176

closes odoo/odoo#77567

X-original-commit: 3c4426c71ebe080bcbd285e271c61bf1580c3afa
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
Signed-off-by: Benoit Socias (bso) <bso-odoo@users.noreply.github.com>
2021-10-01 07:41:00 +00:00
Sébastien Mottet (oms) fe8f8eacf0 [FIX] web_editor: fix black line problem for odd width images
When adding an odd width images on website, a thin black line is
drawn on its right side. The problem comes from the getSourceCanvas
of the cropperjs library. A translation is applied followed by an other
translation in the opposite direction. However the second translation
was not the exact reverse of the first due to a rounding problem.

The fix proposed here comes from: https://github.com/fengyuanchen/cropperjs/pull/300/commits/a6481c052cfc93ef14dd95a3bd00142215dda36e

task-2652904

closes odoo/odoo#77562

X-original-commit: 53f13979cc363c74a8f4e2cec0d24ca10c6ac11c
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-09-30 18:28:04 +00:00
Nicolas Bayet e52bde906f [IMP] web_editor: allow qweb edition
Add a plugin for the Odoo editor that includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching
- style t-tags to make them stand out

Task-27033

X-original-commit: odoo/odoo@300da82eb4
Part-of: odoo/odoo#77377
2021-09-28 23:42:55 +00:00
Nicolas Bayet 810f832703 [FIX] web_editor: allow to delete backward a contenteditable
Deleting a node content-editable false did not work.

X-original-commit: odoo/odoo@de42d0f965
Part-of: odoo/odoo#77377
2021-09-28 23:42:54 +00:00
Nicolas Bayet 4813f42997 [IMP] mail,*: replace jinja with qweb
Jinja as a templating engine was problematic in differents respect:
- introduce external dependency to Odoo (less controll)
- add another templating mechanism in the stack
- specific feature in qweb cannot be reused
- difficulty in rendering easily editable templates
- more knowledge required with no betterment

By replacing jinja with qweb we can now build tools to edit a qweb
that will work with the previously jinja encoded document
(essentially `mail.template` records).

There is a catch however. Some email fields (eg. email_to) used jinja
syntax for rendering dynamic variables (ie. ${object.something} and
${object.something_that_should_not_be_escaped | safe}).

We still want user to use dynamic variables for some char fields (eg.
subject, from, to, ...). We made a new rendering engine called
"inline_template" that will render an expression enclosed by `{{` and
`}}`.

To be able to edit the templates from the backend interface, a
plugin to the Odoo editor has been made for seamlessly edit the
document.

This qweb plugin includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif, and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching

Task-27033

X-original-commit: odoo/odoo@68182baff4
Part-of: odoo/odoo#77377
2021-09-28 23:42:54 +00:00
David Monjoie f50f880655 [FIX] web_editor: fix traceback when no command is selected
closes odoo/odoo#77150

X-original-commit: 4b15136799ec3e394b61f2ef2a7949e1bd0f2340
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-09-24 12:35:29 +00:00
David Monjoie 17b864ce0e [FIX] web_editor: split list on enter in empty li
This matches the behavior of GDocs and CKEditor.

closes odoo/odoo#77115

X-original-commit: a84a6c869b815bf372d81db538b458cd23c99b07
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-09-24 11:09:13 +00:00
Sébastien Geelen (sge) 02b7bf524a [FIX] web_editor: toolbar outside of editable zone
On very small editors the restriction on the toolbar size
and position could generate issue (blocking text visibility).

So we changed the rules to allow the toolbar to overflow
outsize of the editable zone.

task-2648156

closes odoo/odoo#76710

X-original-commit: 6390a4225ea8a97fd0bc0b267d0d016846d27e46
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
Signed-off-by: Sébastien Geelen <sebgeelen@users.noreply.github.com>
2021-09-17 05:59:10 +00:00