diff --git a/addons/web_editor/static/lib/summernote/src/js/module/Editor.js b/addons/web_editor/static/lib/summernote/src/js/module/Editor.js index fe28f83e4b1..2472fbddee7 100644 --- a/addons/web_editor/static/lib/summernote/src/js/module/Editor.js +++ b/addons/web_editor/static/lib/summernote/src/js/module/Editor.js @@ -680,8 +680,27 @@ define([ * @return {String} [return.url=""] */ this.getLinkInfo = function ($editable) { + // ODOO MODIFICATION START + var selection; + var currentSelection = null; + if (document.getSelection) { + selection = document.getSelection(); + if (selection.getRangeAt && selection.rangeCount) { + currentSelection = selection.getRangeAt(0); + } + } + // ODOO MODIFICATION END + this.focus($editable); + // ODOO MODIFICATION START + if (currentSelection && document.getSelection) { + selection = document.getSelection(); + selection.removeAllRanges(); + selection.addRange(currentSelection); + } + // ODOO MODIFICATION END + var rng = range.create().expand(dom.isAnchor); // Get the first anchor on range(for edit).