diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-12-04 17:11:57 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-12-04 17:11:57 +0100 |
| commit | d4c65a7edee8ebe3c5b27d6eea42ebc119fbe085 (patch) | |
| tree | 3e000dd98e9784b5eebca38019379fa167a0d49b /addons/web_editor/static/src/js/editor | |
| parent | c0eef4271110ebcab07811328a7b3f4309fb4d06 (diff) | |
| parent | 2156af480fddc09b5897b349c04c4c9a2d67c802 (diff) | |
[MERGE] forward port branch 11.0 up to 2156af480fd
Diffstat (limited to 'addons/web_editor/static/src/js/editor')
| -rw-r--r-- | addons/web_editor/static/src/js/editor/rte.js | 17 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/editor/snippets.editor.js | 1 |
2 files changed, 18 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 () { diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 999131020bf..2ec8506321c 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -340,6 +340,7 @@ var SnippetEditor = Widget.extend({ } }, }); + this.trigger_up('snippet_cloned', {$target: $clone}); }, /** * Called when the overlay dimensions/positions should be recomputed. |
