summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/rte.js14
-rw-r--r--addons/web_editor/static/src/js/rte.summernote.js2
2 files changed, 12 insertions, 4 deletions
diff --git a/addons/web_editor/static/src/js/rte.js b/addons/web_editor/static/src/js/rte.js
index 85721ba0387..becaf978d17 100644
--- a/addons/web_editor/static/src/js/rte.js
+++ b/addons/web_editor/static/src/js/rte.js
@@ -513,13 +513,21 @@ var RTE = Widget.extend({
}
if ($target.is('a')) {
+ // add contenteditable on link to improve its editing behaviour
$target.attr('contenteditable', true);
setTimeout(function () {
$editable.attr('contenteditable', false);
});
- } else if ($editable.attr('contenteditable') === 'false') {
- $target.removeAttr('contenteditable');
- $editable.attr('contenteditable', true);
+ // once clicked outside, remove contenteditable on link
+ var reactive_editable = function(e){
+ if($target.is(e.target)) {
+ return;
+ }
+ $target.removeAttr('contenteditable');
+ $editable.attr('contenteditable', true);
+ $(document).off('mousedown', reactive_editable);
+ }
+ $(document).on('mousedown', reactive_editable);
}
if (this && this.$last && (!$editable.size() || this.$last[0] != $editable[0])) {
diff --git a/addons/web_editor/static/src/js/rte.summernote.js b/addons/web_editor/static/src/js/rte.summernote.js
index 01020a84c22..094d13340dc 100644
--- a/addons/web_editor/static/src/js/rte.summernote.js
+++ b/addons/web_editor/static/src/js/rte.summernote.js
@@ -764,7 +764,7 @@ eventHandler.attach = function (oLayoutInfo, options) {
.add(oLayoutInfo.handle())
.add(oLayoutInfo.popover())
.add(custom_toolbar)
- .on('click keyup', function () {
+ .on('click content_changed', function () {
$('button[data-event="undo"]', $toolbar).attr('disabled', !oLayoutInfo.editable().data('NoteHistory').hasUndo());
$('button[data-event="redo"]', $toolbar).attr('disabled', !oLayoutInfo.editable().data('NoteHistory').hasRedo());
});