[FIX] web_editor: keep the selection when opening linktool
task-2750970 closes odoo/odoo#89637 X-original-commit: 56f26a0277d72f6604dac153216385d0f5a8a34e Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user