diff options
| author | Olivier Dony <odo@openerp.com> | 2016-01-13 17:13:05 +0100 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2016-01-13 17:13:05 +0100 |
| commit | 39bd21fc479a85532e1f6368d3fc9d04c8fb2c68 (patch) | |
| tree | a7dcb9a067e9ba07de11bd5db8c0801019ef96fc /addons/web_editor/static/src | |
| parent | 9ad5c66a44d9a0bf67089e3f5e530d8d9fb57491 (diff) | |
| parent | 3be9d911c0d50cbe6e4e5768d40011849cc43972 (diff) | |
[MERGE] Forward-port 9.0 up to rev. 3be9d911c0d50cbe6e4e5768d40011849cc43972
Diffstat (limited to 'addons/web_editor/static/src')
| -rw-r--r-- | addons/web_editor/static/src/js/rte.js | 14 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/rte.summernote.js | 2 |
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()); }); |
