From c9a9b7ae42af3f9bebe37245efd800b9d788af91 Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 23 Apr 2020 15:38:01 +0000 Subject: [PATCH] pad.js: in switchToPad() remove the first iframe before loading the pad This is an old bug: after an import there were always two iframes with duplicated content, and the last one was simply on top of the old one. This bug was there since forever, and became evident when the layout was migrated to Flexbox. --- src/static/js/pad.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/static/js/pad.js b/src/static/js/pad.js index 1ba6f52ad..622b57f3e 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -422,6 +422,11 @@ var pad = { }, switchToPad: function(padId) { + // destroy old pad from DOM + // See https://github.com/ether/etherpad-lite/pull/3915 + // TODO: Check if Destroying is enough and doesn't leave negative stuff + // See ace.js "editor.destroy" for a reference of how it was done before + $('#editorcontainer').find("iframe")[0].remove(); var options = document.location.href.split('?')[1]; var newHref = padId; if (typeof options != "undefined" && options != null){