Files
odoo_source/addons/web_editor/static/tests
Priyanka Kakadiya 0799742d05 [FIX] web_editor: restoreRange on invalid node
In a web editor, add some text, select the text, add a link and
immediately discard the link modal. Traceback.

The traceback is a execute `setEnd` on `Range`, that error is thrown
because editable DIV doesn't save old range

Odoo wrap code does some text node split in order to attach the link
just on the selected text. If it correctly re-set the underlying
structure, it does not update the $(editable) structure used to restore
ranges.

After this commit, editable div will use newly created range for the element

for ex:
-> content: test
-> selected content "test"

when click on link dialog:
ec: test , eo: 4, sc: test, so: 0
selected content  ->  start 0, end 4 -> "test" like this

after clicking on discard:
ec: null text element, eo: 4, sc: null text element, so: 0
selected content  ->  ec and sc both are null, so it will throw an error
while setting cursor position

after applying fix when click on discard:
ec: test, eo: 4, sc: test, so: 0
selected content -> start 0,  end 4 -> "test"

task - 1955863

closes odoo/odoo#33692

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-06-03 05:36:08 +00:00
..