1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Make navigation in new windows work for storyviews (#5759)

This commit is contained in:
Simon Huber 2021-06-06 11:47:19 +02:00 committed by GitHub
parent 2b911ac11f
commit afa4ea3d03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -27,7 +27,7 @@ ClassicStoryView.prototype.navigateTo = function(historyInfo) {
var listItemWidget = this.listWidget.children[listElementIndex],
targetElement = listItemWidget.findFirstDomNode();
// Abandon if the list entry isn't a DOM element (it might be a text node)
if(!(targetElement instanceof Element)) {
if(targetElement === undefined || targetElement.nodeType === Node.TEXT_NODE) {
return;
}
if(duration) {
@ -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.nodeType === Node.TEXT_NODE) {
if(targetElement === undefined || 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.nodeType === Node.TEXT_NODE) {
if(targetElement === undefined || targetElement.nodeType === Node.TEXT_NODE) {
removeElement();
return;
}

View File

@ -24,7 +24,7 @@ PopStoryView.prototype.navigateTo = function(historyInfo) {
var listItemWidget = this.listWidget.children[listElementIndex],
targetElement = listItemWidget.findFirstDomNode();
// Abandon if the list entry isn't a DOM element (it might be a text node)
if(!(targetElement instanceof Element)) {
if(targetElement === undefined || targetElement.nodeType === Node.TEXT_NODE) {
return;
}
// Scroll the node into view
@ -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.nodeType === Node.TEXT_NODE) {
if(targetElement === undefined || 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.nodeType === Node.TEXT_NODE) {
if(targetElement === undefined || targetElement.nodeType === Node.TEXT_NODE) {
removeElement();
return;
}

View File

@ -48,7 +48,7 @@ ZoominListView.prototype.navigateTo = function(historyInfo) {
var listItemWidget = this.listWidget.children[listElementIndex],
targetElement = listItemWidget.findFirstDomNode();
// Abandon if the list entry isn't a DOM element (it might be a text node)
if(!(targetElement instanceof Element)) {
if(targetElement === undefined || targetElement.nodeType === Node.TEXT_NODE) {
return;
}
// Make the new tiddler be position absolute and visible so that we can measure it
@ -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.nodeType === Node.TEXT_NODE) {
if(targetElement === undefined || 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.nodeType === Node.TEXT_NODE) {
if(targetElement === undefined || targetElement.nodeType === Node.TEXT_NODE) {
removeElement();
return;
}