summaryrefslogtreecommitdiff
path: root/addons/web_editor/static
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2018-01-17 18:45:35 +0100
committerqsm-odoo <qsm@odoo.com>2018-01-18 15:19:16 +0100
commitf314cf0bb3dd715773e5ab1a5fcacd42bd3bd7fd (patch)
tree2f9116251465c8f2273ad739d4f8d351b9e61c47 /addons/web_editor/static
parentcdb2cf744f4c9be7d2d498e28563a36aff1e0ae3 (diff)
[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.
Diffstat (limited to 'addons/web_editor/static')
-rw-r--r--addons/web_editor/static/src/js/summernote.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js
index 8385a79fb39..9760ef8c2a2 100644
--- a/addons/web_editor/static/src/js/summernote.js
+++ b/addons/web_editor/static/src/js/summernote.js
@@ -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