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'); diff --git a/addons/web_editor/static/tests/wysiwyg_keyboard_tests.js b/addons/web_editor/static/tests/wysiwyg_keyboard_tests.js index 37727c691bd..14f06ec2e9d 100644 --- a/addons/web_editor/static/tests/wysiwyg_keyboard_tests.js +++ b/addons/web_editor/static/tests/wysiwyg_keyboard_tests.js @@ -1665,9 +1665,9 @@ var keyboardTestsEnter = [{ key: 'a', }], test: { - content: "
​a​dom to edit
", + content: "
Label​adom to edit​
", // split button has no text so the placeholder text is selected then replaced by 'a' - start: "a:contents()[0]->2", + start: "a:eq(1):contents()[0]->2", }, }, { @@ -1680,9 +1680,9 @@ var keyboardTestsEnter = [{ key: 'a', }], test: { - content: "
​a​dom to edit
", + content: "
Label​adom to edit​
", // split button has no text so the placeholder text is selected then replaced by 'a' - start: "a:contents()[0]->2", + start: "a:eq(1):contents()[0]->2", }, }, { @@ -1767,9 +1767,9 @@ var keyboardTestsEnter = [{ key: 'a', }], test: { - content: "
​a​Label
", + content: "
Label​a​
", // Removing all text in a link replaces that text with "Label" - start: "a:contents()[0]->2", + start: "a:eq(1):contents()[0]->2", }, }, { @@ -1781,9 +1781,8 @@ var keyboardTestsEnter = [{ key: 'ENTER', }], test: { - content: "
​Label​ot to edit
", - start: "a:contents()[0]->1", - end: "a:contents()[0]->6", + content: "
Label​ot to edit​
", + start: "a:eq(1):contents()[0]->1", }, }, ];