fix(hot-keys): Set the correct context name to enable hot keys based on the current page (#308)
This commit is contained in:
parent
99041bebde
commit
5017fd13af
@ -1,2 +1 @@
|
||||
import './components';
|
||||
import './lib';
|
||||
|
||||
@ -1 +0,0 @@
|
||||
import './routes';
|
||||
@ -1,14 +0,0 @@
|
||||
import { Router } from 'meteor/clinical:router';
|
||||
import { Session } from 'meteor/session';
|
||||
import { hotkeys } from 'meteor/ohif:hotkeys';
|
||||
|
||||
Router.onBeforeAction(function() {
|
||||
const lastRoute = Session.get('lastRoute');
|
||||
const currentRoute = this.router.current().route.getName();
|
||||
if (currentRoute !== lastRoute) {
|
||||
hotkeys.switchToContext(null);
|
||||
Session.set('lastRoute', currentRoute);
|
||||
}
|
||||
|
||||
this.next();
|
||||
});
|
||||
@ -1,4 +1,5 @@
|
||||
import './studylist.html';
|
||||
import './studylist.js';
|
||||
import './studylist.styl';
|
||||
|
||||
import './studylistStudy/studylistStudy.html';
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Template.studylist.onCreated(() => {
|
||||
// Set the current context
|
||||
OHIF.context.set('studylist');
|
||||
});
|
||||
|
||||
Template.studylist.onDestroyed(() => {
|
||||
// Reset the current context
|
||||
OHIF.context.set(null);
|
||||
});
|
||||
@ -28,6 +28,9 @@ Template.viewerMain.onCreated(() => {
|
||||
|
||||
// Add beforeUnload event handler to check for unsaved changes
|
||||
window.addEventListener('beforeunload', unloadHandlers.beforeUnload);
|
||||
|
||||
// Set the current context
|
||||
OHIF.context.set('viewer');
|
||||
});
|
||||
|
||||
Template.viewerMain.onRendered(() => {
|
||||
@ -82,4 +85,7 @@ Template.viewerMain.onDestroyed(() => {
|
||||
// @TypeSafeStudies
|
||||
// Clears OHIF.viewer.StudyMetadataList collection
|
||||
OHIF.viewer.StudyMetadataList.removeAll();
|
||||
|
||||
// Reset the current context
|
||||
OHIF.context.set(null);
|
||||
});
|
||||
|
||||
@ -18,6 +18,9 @@ Template.standaloneViewerMain.onCreated(() => {
|
||||
// Metadata configuration
|
||||
const metadataProvider = OHIF.viewer.metadataProvider;
|
||||
cornerstone.metaData.addProvider(metadataProvider.provider.bind(metadataProvider));
|
||||
|
||||
// Set the current context
|
||||
OHIF.context.set('viewer');
|
||||
});
|
||||
|
||||
Template.standaloneViewerMain.onRendered(() => {
|
||||
@ -58,4 +61,7 @@ Template.standaloneViewerMain.onDestroyed(() => {
|
||||
|
||||
// Clear references to all stacks in the StackManager
|
||||
OHIF.viewerbase.stackManager.clearStacks();
|
||||
|
||||
// Reset the current context
|
||||
OHIF.context.set(null);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user