Enhance links so that control/command clicking suppresses navigation

Control- or Command-clicking on a link will now open the target tiddler
but suppress navigating to it. Kind of like opening in a background tab.
print-window-tiddler
Jermolene 2014-02-12 22:00:12 +00:00
rodzic 523eae83ff
commit 470beabf17
2 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -94,7 +94,8 @@ LinkWidget.prototype.handleClickEvent = function (event) {
navigateFromTitle: this.getVariable("storyTiddler"),
navigateFromNode: this,
navigateFromClientRect: { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height
}
},
navigateSuppressNavigation: event.metaKey || event.ctrlKey
});
event.preventDefault();
event.stopPropagation();

Wyświetl plik

@ -149,7 +149,9 @@ Handle a tw-navigate event
*/
NavigatorWidget.prototype.handleNavigateEvent = function(event) {
this.addToStory(event.navigateTo,event.navigateFromTitle);
this.addToHistory(event.navigateTo,event.navigateFromClientRect);
if(!event.navigateSuppressNavigation) {
this.addToHistory(event.navigateTo,event.navigateFromClientRect);
}
return false;
};