[FIX] web_editor: link from the web editor
Before this commit, the feature for selecting a link and then clicking on the "link" button or hitting the CTRL+K was partially broken. The method "commonAncestor" was not returing the expected value. This commit add a check in the method "showLinkDialog" to prevent this error to happen. closes odoo/odoo#38103 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
@@ -452,8 +452,11 @@ eventHandler.modules.linkDialog.showLinkDialog = function ($editable, $dialog, l
|
||||
$editable.data('range').select();
|
||||
$editable.data('NoteHistory').recordUndo();
|
||||
|
||||
var link = linkInfo.range.commonAncestor().closest('a');
|
||||
linkInfo.className = link && link.className;
|
||||
var commonAncestor = linkInfo.range.commonAncestor();
|
||||
if (commonAncestor && commonAncestor.closest) {
|
||||
var link = commonAncestor.closest('a');
|
||||
linkInfo.className = link && link.className;
|
||||
}
|
||||
|
||||
var def = new $.Deferred();
|
||||
core.bus.trigger('link_dialog_demand', {
|
||||
|
||||
Reference in New Issue
Block a user