diff options
| author | Goaman <nby@odoo.com> | 2019-10-07 13:50:44 +0000 |
|---|---|---|
| committer | Goaman <nby@odoo.com> | 2019-10-07 13:50:44 +0000 |
| commit | f2c38d517b0a191c12f5e20ff83905b4a0dd057f (patch) | |
| tree | cc3dacb6eb6ce96e939ea028ec5b92fc67d76932 /addons/web_editor/static/src/js/editor/rte.summernote.js | |
| parent | 2cc2fca17ad2cbf686091c4acb3be802bc1691a9 (diff) | |
[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>
Diffstat (limited to 'addons/web_editor/static/src/js/editor/rte.summernote.js')
| -rw-r--r-- | addons/web_editor/static/src/js/editor/rte.summernote.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/web_editor/static/src/js/editor/rte.summernote.js b/addons/web_editor/static/src/js/editor/rte.summernote.js index 95ce86572ae..d8338fd622d 100644 --- a/addons/web_editor/static/src/js/editor/rte.summernote.js +++ b/addons/web_editor/static/src/js/editor/rte.summernote.js @@ -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', { |
