1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 00:50:28 +00:00

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.
This commit is contained in:
Jermolene 2014-02-12 22:00:12 +00:00
parent 523eae83ff
commit 470beabf17
2 changed files with 5 additions and 2 deletions

View File

@ -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();

View File

@ -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;
};