[FIX] web_editor: deleteContents when no selection

Changing the `deleteContents` method of the editor is tricky. This
commit however dares to add a behavior: if the range does not
represent a selection but only the cursor position and is then asked
to delete its content... it should not do anything as nothing is
selected.
This commit is contained in:
qsm-odoo
2018-01-18 15:19:16 +01:00
parent cdb2cf744f
commit f314cf0bb3
@@ -917,6 +917,10 @@ range.WrappedRange.prototype.isOnImg = function () {
return nb === 1 && image;
};
range.WrappedRange.prototype.deleteContents = function (towrite) {
if (this.sc === this.ec && this.so === this.eo) {
return this;
}
var prevBP = dom.removeBetween(this.sc, this.so, this.ec, this.eo, towrite);
$(dom.node(prevBP.sc)).trigger("click"); // trigger click to disable and reanable editor and image handler