From 25edf0e2129195f9d8e59bbdd3ca5dc56d67f9a4 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 6 Jul 2024 18:08:13 +0100 Subject: [PATCH] Initial Commit --- core/modules/storyviews/classic.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/core/modules/storyviews/classic.js b/core/modules/storyviews/classic.js index c2848c435..de3ef11a0 100644 --- a/core/modules/storyviews/classic.js +++ b/core/modules/storyviews/classic.js @@ -84,26 +84,33 @@ ClassicStoryView.prototype.remove = function(widget) { }; // Abandon if the list entry isn't a DOM element (it might be a text node) if(!targetElement || targetElement.nodeType === Node.TEXT_NODE) { - removeElement(); + widget.removeChildDomNodes(); return; } + // Clone the target element + var cloneElement = targetElement.cloneNode(true); + targetElement.parentNode.insertBefore(cloneElement,targetElement); + // Remove the original element + widget.removeChildDomNodes(); // Get the current height of the tiddler - var currWidth = targetElement.offsetWidth, - computedStyle = window.getComputedStyle(targetElement), + var currWidth = cloneElement.offsetWidth, + computedStyle = window.getComputedStyle(cloneElement), currMarginBottom = parseInt(computedStyle.marginBottom,10), currMarginTop = parseInt(computedStyle.marginTop,10), - currHeight = targetElement.offsetHeight + currMarginTop; + currHeight = cloneElement.offsetHeight + currMarginTop; // Remove the dom nodes of the widget at the end of the transition - setTimeout(removeElement,duration); + setTimeout(function() { + cloneElement.parentNode.removeChild(cloneElement); + },duration); // Animate the closure - $tw.utils.setStyle(targetElement,[ + $tw.utils.setStyle(cloneElement,[ {transition: "none"}, {transform: "translateX(0px)"}, {marginBottom: currMarginBottom + "px"}, {opacity: "1.0"} ]); - $tw.utils.forceLayout(targetElement); - $tw.utils.setStyle(targetElement,[ + $tw.utils.forceLayout(cloneElement); + $tw.utils.setStyle(cloneElement,[ {transition: $tw.utils.roundTripPropertyName("transform") + " " + duration + "ms " + easing + ", " + "opacity " + duration + "ms " + easing + ", " + "margin-bottom " + duration + "ms " + easing},