1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 02:19:55 +00:00

Add support for th-navigating event

This commit is contained in:
Jermolene 2017-02-19 15:47:37 +00:00
parent 0d0ece6377
commit daf703b67f
2 changed files with 20 additions and 0 deletions

View File

@ -174,6 +174,7 @@ NavigatorWidget.prototype.addToHistory = function(title,fromPageRect) {
Handle a tm-navigate event
*/
NavigatorWidget.prototype.handleNavigateEvent = function(event) {
event = $tw.hooks.invokeHook("th-navigating",event);
if(event.navigateTo) {
this.addToStory(event.navigateTo,event.navigateFromTitle);
if(!event.navigateSuppressNavigation) {

View File

@ -0,0 +1,19 @@
created: 20170219130829546
modified: 20170219145518777
tags: HookMechanism
title: Hook: th-navigating
type: text/vnd.tiddlywiki
This hook allows plugins to monitor and modify navigation events.
Hook function parameters:
* ''event'': object describing the navigation event:
** ''event.navigateTo'': title of target tiddler
** ''event.navigateFromTitle'': title of tiddler containing the
** ''event.navigateSuppressNavigation'': boolean; when true the target tiddler opens without the usual scrolling
** ''event.navigateFromClientRect'': rectange in client coordinates of the DOM node triggering the navigation
Return value:
* possibly modified event object