diff options
| author | Antoine Guenet <age@odoo.com> | 2019-02-07 10:20:57 +0000 |
|---|---|---|
| committer | Antoine Guenet <age@odoo.com> | 2019-02-07 10:20:57 +0000 |
| commit | eea58a3cf85b08e58c8b2f755fca933af171d1f7 (patch) | |
| tree | 9cee0765396baf11dec58d87066199f6eee14eee /addons/web_editor/static/src | |
| parent | b1fadbc6c61b9dde0ecbe1c798db7d7416091515 (diff) | |
[FIX] web_editor: on anchor split, rerange and clean data on getValue
Due to a wrong order of operations, after splitting an anchor (press
ENTER), the range was setting on the first anchor. Now it sets on the
second one (as the code - but not the tests - suggests was supposed to
happen). Tests were adapted to reflect that change.
In tests, after splitting the anchor, `Wysiwyg.getValue` didn't always
properly clean up `data-original-title`. Targetting empty
`data-original-title` attribute instead of `aria-describedby` attribute
should fix that issue.
closes odoo/odoo#30923
Diffstat (limited to 'addons/web_editor/static/src')
| -rw-r--r-- | addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js | 8 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js b/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js index ead54bb5f26..3db30752277 100644 --- a/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js +++ b/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js @@ -372,14 +372,14 @@ var KeyboardPlugin = AbstractPlugin.extend({ return $(n).hasClass('btn'); }); - // Move carret to the new button - range = this.context.invoke('editor.setRange', next.firstChild, 0); - range.select(); - // Force content in empty buttons, the carret can be moved there this.context.invoke('LinkPopover.hide'); this.context.invoke('LinkPopover.fillEmptyLink', next, true); this.context.invoke('LinkPopover.fillEmptyLink', btn, true); + + // Move carret to the new button + range = this.context.invoke('editor.setRange', next.firstChild, 0); + range.select(); } else { range = this.context.invoke('editor.setRange', point.node, point.offset); range.normalize().select(); diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index b8ff583c6fa..8cf1026158d 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -200,6 +200,7 @@ var Wysiwyg = Widget.extend({ $editable.find('[style=""]').removeAttr('style'); $editable.find('[title=""]').removeAttr('title'); $editable.find('[alt=""]').removeAttr('alt'); + $editable.find('[data-original-title=""]').removeAttr('data-original-title'); $editable.find('a.o_image, span.fa, i.fa').html(''); $editable.find('[aria-describedby]').removeAttr('aria-describedby').removeAttr('data-original-title'); |
