summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/editor/rte.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-12-04 17:11:57 +0100
committerChristophe Simonis <chs@odoo.com>2018-12-04 17:11:57 +0100
commitd4c65a7edee8ebe3c5b27d6eea42ebc119fbe085 (patch)
tree3e000dd98e9784b5eebca38019379fa167a0d49b /addons/web_editor/static/src/js/editor/rte.js
parentc0eef4271110ebcab07811328a7b3f4309fb4d06 (diff)
parent2156af480fddc09b5897b349c04c4c9a2d67c802 (diff)
[MERGE] forward port branch 11.0 up to 2156af480fd
Diffstat (limited to 'addons/web_editor/static/src/js/editor/rte.js')
-rw-r--r--addons/web_editor/static/src/js/editor/rte.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/editor/rte.js b/addons/web_editor/static/src/js/editor/rte.js
index 1e745d7cceb..485edaad13c 100644
--- a/addons/web_editor/static/src/js/editor/rte.js
+++ b/addons/web_editor/static/src/js/editor/rte.js
@@ -42,7 +42,10 @@ var History = function History($editable) {
$editable.removeAttr('contentEditable').removeProp('contentEditable');
}
+ $editable.trigger('content_will_be_destroyed');
$editable.html(oSnap.contents).scrollTop(oSnap.scrollTop);
+ $editable.trigger('content_was_recreated');
+
$('.oe_overlay').remove();
$('.note-control-selection').hide();
@@ -290,6 +293,20 @@ var RTEWidget = Widget.extend({
var $editable = this.editable();
+ // When a undo/redo is performed, the whole DOM is changed so we have
+ // to prepare for it (website will restart animations for example)
+ // TODO should be better handled
+ $editable.on('content_will_be_destroyed', function (ev) {
+ self.trigger_up('content_will_be_destroyed', {
+ $target: $(ev.currentTarget),
+ });
+ });
+ $editable.on('content_was_recreated', function (ev) {
+ self.trigger_up('content_was_recreated', {
+ $target: $(ev.currentTarget),
+ });
+ });
+
$editable.addClass('o_editable')
.data('rte', this)
.each(function () {