From 2b911ac11fb245703a59fb7a34f8265bf6041e47 Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Fri, 4 Jun 2021 17:59:45 +0200 Subject: [PATCH] Make the insert- and remove-animations of storyviews work in new windows (#5755) * Make classic storyview work in new windows, too * Make pop storyview work in new windows, too * Make zoomin storyview insert and remove animation work in new windows, too --- core/modules/storyviews/classic.js | 6 +++--- core/modules/storyviews/pop.js | 4 ++-- core/modules/storyviews/zoomin.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/modules/storyviews/classic.js b/core/modules/storyviews/classic.js index fe6925b99..f33641cab 100644 --- a/core/modules/storyviews/classic.js +++ b/core/modules/storyviews/classic.js @@ -43,7 +43,7 @@ ClassicStoryView.prototype.insert = function(widget) { if(duration) { var targetElement = widget.findFirstDomNode(); // Abandon if the list entry isn't a DOM element (it might be a text node) - if(!(targetElement instanceof Element)) { + if(targetElement.nodeType === Node.TEXT_NODE) { return; } // Get the current height of the tiddler @@ -83,7 +83,7 @@ ClassicStoryView.prototype.remove = function(widget) { widget.removeChildDomNodes(); }; // Abandon if the list entry isn't a DOM element (it might be a text node) - if(!(targetElement instanceof Element)) { + if(targetElement.nodeType === Node.TEXT_NODE) { removeElement(); return; } @@ -118,4 +118,4 @@ ClassicStoryView.prototype.remove = function(widget) { exports.classic = ClassicStoryView; -})(); \ No newline at end of file +})(); diff --git a/core/modules/storyviews/pop.js b/core/modules/storyviews/pop.js index d0592cf18..6e4c54874 100644 --- a/core/modules/storyviews/pop.js +++ b/core/modules/storyviews/pop.js @@ -35,7 +35,7 @@ PopStoryView.prototype.insert = function(widget) { var targetElement = widget.findFirstDomNode(), duration = $tw.utils.getAnimationDuration(); // Abandon if the list entry isn't a DOM element (it might be a text node) - if(!(targetElement instanceof Element)) { + if(targetElement.nodeType === Node.TEXT_NODE) { return; } // Reset once the transition is over @@ -77,7 +77,7 @@ PopStoryView.prototype.remove = function(widget) { } }; // Abandon if the list entry isn't a DOM element (it might be a text node) - if(!(targetElement instanceof Element)) { + if(targetElement.nodeType === Node.TEXT_NODE) { removeElement(); return; } diff --git a/core/modules/storyviews/zoomin.js b/core/modules/storyviews/zoomin.js index be65b8e3a..a1b2e79e2 100644 --- a/core/modules/storyviews/zoomin.js +++ b/core/modules/storyviews/zoomin.js @@ -130,7 +130,7 @@ function findTitleDomNode(widget,targetClass) { ZoominListView.prototype.insert = function(widget) { var targetElement = widget.findFirstDomNode(); // Abandon if the list entry isn't a DOM element (it might be a text node) - if(!(targetElement instanceof Element)) { + if(targetElement.nodeType === Node.TEXT_NODE) { return; } // Make the newly inserted node position absolute and hidden @@ -147,7 +147,7 @@ ZoominListView.prototype.remove = function(widget) { widget.removeChildDomNodes(); }; // Abandon if the list entry isn't a DOM element (it might be a text node) - if(!(targetElement instanceof Element)) { + if(targetElement.nodeType === Node.TEXT_NODE) { removeElement(); return; }