diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-08-04 14:09:05 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2017-08-28 12:04:06 +0200 |
| commit | 9486ec33c4035fe6155e0a9d5905ee38106761fa (patch) | |
| tree | e3a940b9790ddb29405f6756de95764f7e8c7d74 /addons/web_editor/static/src/js/editor/rte.summernote.js | |
| parent | 3fb4159ad9c9b9488912292b7b339d9f1fd2ce3c (diff) | |
[FIX] web_editor: properly not allow edition of non editable parts
Before this commit, (double) clicking an image/link in a non editable
environment still opened a dialog / change the editor bar for edition.
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 | 15 |
1 files changed, 12 insertions, 3 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 01b83530e48..141fb6ea229 100644 --- a/addons/web_editor/static/src/js/editor/rte.summernote.js +++ b/addons/web_editor/static/src/js/editor/rte.summernote.js @@ -771,7 +771,7 @@ eventHandler.attach = function (oLayoutInfo, options) { }); } oLayoutInfo.editable().on('mousedown', function (e) { - if (dom.isImg(e.target)) { + if (dom.isImg(e.target) && dom.isContentEditable(e.target)) { range.createFromNode(e.target).select(); } }); @@ -836,7 +836,12 @@ eventHandler.attach = function (oLayoutInfo, options) { var show_tooltip = true; oLayoutInfo.editor().on("dblclick", selector, function (e) { - if ($(e.target).closest(".note-toolbar").length) return; // prevent icon edition of top bar for default summernote + var $target = $(e.target); + if (!dom.isContentEditable($target)) { + // Prevent edition of non editable parts + return; + } + show_tooltip = false; callback(); e.stopImmediatePropagation(); @@ -844,7 +849,11 @@ eventHandler.attach = function (oLayoutInfo, options) { oLayoutInfo.editor().on("click", selector, function (e) { var $target = $(e.target); - if ($target.closest(".note-toolbar").length) return; // prevent icon edition of top bar for default summernote + if (!dom.isContentEditable($target)) { + // Prevent edition of non editable parts + return; + } + show_tooltip = true; setTimeout(function () { if (!show_tooltip) return; |
