diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index f27da6f79..58a39ca12 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -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) { diff --git a/editions/dev/tiddlers/new/Hook__th-navigating.tid b/editions/dev/tiddlers/new/Hook__th-navigating.tid new file mode 100644 index 000000000..4f4350341 --- /dev/null +++ b/editions/dev/tiddlers/new/Hook__th-navigating.tid @@ -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