diff --git a/addons/web_editor/static/src/js/editor/rte.js b/addons/web_editor/static/src/js/editor/rte.js index b0c0891c1b6..e0a7d6a7829 100644 --- a/addons/web_editor/static/src/js/editor/rte.js +++ b/addons/web_editor/static/src/js/editor/rte.js @@ -44,7 +44,16 @@ var History = function History($editable) { } $editable.trigger('content_will_be_destroyed'); - $editable.html(oSnap.contents).scrollTop(oSnap.scrollTop); + var $tempDiv = $('
', {html: oSnap.contents}); + _.each($tempDiv.find('.o_temp_auto_element'), function (el) { + var $el = $(el); + var originalContent = $el.attr('data-temp-auto-element-original-content'); + if (originalContent) { + $el.after(originalContent); + } + $el.remove(); + }); + $editable.html($tempDiv.html()).scrollTop(oSnap.scrollTop); $editable.trigger('content_was_recreated'); $('.oe_overlay').remove(); diff --git a/addons/website_event/static/src/js/website_geolocation.js b/addons/website_event/static/src/js/website_geolocation.js index 37535613153..dcf4f061489 100644 --- a/addons/website_event/static/src/js/website_geolocation.js +++ b/addons/website_event/static/src/js/website_geolocation.js @@ -18,6 +18,10 @@ publicWidget.registry.visitor = publicWidget.Widget.extend({ defs.push(this._rpc({route: '/event/get_country_event_list'}).then(function (data) { if (data) { self._$loadedContent = $(data); + + self._$loadedContent.addClass('o_temp_auto_element'); + self._$loadedContent.attr('data-temp-auto-element-original-content', self._originalContent); + $eventList.replaceWith(self._$loadedContent); } })); @@ -28,7 +32,9 @@ publicWidget.registry.visitor = publicWidget.Widget.extend({ */ destroy: function () { this._super.apply(this, arguments); - this._$loadedContent.replaceWith(this._originalContent); + if (this._$loadedContent) { + this._$loadedContent.replaceWith(this._originalContent); + } }, }); });