diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index a4a99138d7c..89b300464f4 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -1216,7 +1216,8 @@ const Wysiwyg = Widget.extend({ if (!this.options.snippets) { $toolbar.find('#justify, #table, #media-insert').remove(); } - $toolbar.find('#create-link, #media-insert, #media-replace, #media-description').click(openTools); + $toolbar.find('#media-insert, #media-replace, #media-description').click(openTools); + $toolbar.find('#create-link').mousedown(openTools); $toolbar.find('#image-shape div, #fa-spin').click(e => { if (!this.lastMediaClicked) { return; diff --git a/addons/web_editor/static/tests/field_html_tests.js b/addons/web_editor/static/tests/field_html_tests.js index 3efbeda9b1d..4f0272bc467 100644 --- a/addons/web_editor/static/tests/field_html_tests.js +++ b/addons/web_editor/static/tests/field_html_tests.js @@ -466,7 +466,7 @@ QUnit.module('web_editor', {}, function () { let pText = $field.find('.note-editable p').first().contents()[0]; Wysiwyg.setRange(pText.firstChild, 0, pText.firstChild, pText.firstChild.length); - await testUtils.dom.click($('#toolbar #create-link')); + await testUtils.dom.triggerEvent($('#toolbar #create-link'), 'mousedown'); // load static xml file (dialog, link dialog) await defLinkDialog; $('.modal .tab-content .tab-pane').removeClass('fade'); // to be sync in test @@ -515,7 +515,7 @@ QUnit.module('web_editor', {}, function () { let pText = $field.find('.note-editable p').first().contents()[0]; Wysiwyg.setRange(pText.firstChild, 0, pText.firstChild, pText.firstChild.length); - await testUtils.dom.click($('#toolbar #create-link')); + await testUtils.dom.triggerEvent($('#toolbar #create-link'), 'mousedown'); // load static xml file (dialog, link dialog) await defLinkDialog; $('.modal .tab-content .tab-pane').removeClass('fade'); // to be sync in test @@ -564,7 +564,7 @@ QUnit.module('web_editor', {}, function () { let pText = $field.find('.note-editable p').first().contents()[0]; Wysiwyg.setRange(pText, 0, pText, pText.length); - await testUtils.dom.click($('#toolbar #create-link')); + await testUtils.dom.triggerEvent($('#toolbar #create-link'), 'mousedown'); // load static xml file (dialog, link dialog) await defLinkDialog; $('.modal .tab-content .tab-pane').removeClass('fade'); // to be sync in test @@ -614,7 +614,7 @@ QUnit.module('web_editor', {}, function () { let pText = $field.find('.note-editable p').first().contents()[0]; Wysiwyg.setRange(pText, 0, pText, pText.length); - await testUtils.dom.click($('#toolbar #create-link')); + await testUtils.dom.triggerEvent($('#toolbar #create-link'), 'mousedown'); // load static xml file (dialog, link dialog) await defLinkDialog; $('.modal .tab-content .tab-pane').removeClass('fade'); // to be sync in test @@ -637,7 +637,7 @@ QUnit.module('web_editor', {}, function () { $field = form.$('.oe_form_field[name="body"]'); pText = $field.find('.note-editable a').eq(0).contents()[0]; Wysiwyg.setRange(pText, 0, pText, pText.length); - await testUtils.dom.click($('#toolbar #create-link')); + await testUtils.dom.triggerEvent($('#toolbar #create-link'), 'mousedown'); // load static xml file (dialog, link dialog) await defLinkDialog; $('.modal .tab-content .tab-pane').removeClass('fade'); // to be sync in test