feat: Allow configurable context menus (#2894)
* feat: Context menu feat: Custom context menu Adding documentation PR updates * fix: Capture tool exception * PR updates * Add fully worked out examples in the basic test mode/extension * Fix the menu display * fix: Make the commands on clicks much more configurable * Wait for load before double clicking * docs * PR changes - nothing functional, just moving things endlessly * PR comments * PR changes - rename the default context menu * Renamed the cornerstoneContextMenu to measurementsContextMenu * Add chevron right to the sub-menus
This commit is contained in:
1 parent
4e94b588a7
commit
bc642fd2b6
40 files changed
+1472
-280
No files matched your search
@@ -36,7 +36,10 @@ export interface ExtensionParams extends ExtensionConstructor {
|
||||
*/
|
||||
export interface Extension {
|
||||
id: string;
|
||||
preRegistration?: (p: ExtensionParams) => void;
|
||||
preRegistration?: (p: ExtensionParams) => Promise<void> | void;
|
||||
onModeExit?: () => void;
|
||||
getHangingProtocolModule?: (p: ExtensionParams) => unknown;
|
||||
getCommandsModule?: (p: ExtensionParams) => CommandsModule;
|
||||
}
|
||||
|
||||
export type ExtensionRegister = {
|
||||
@@ -44,6 +47,12 @@ export type ExtensionRegister = {
|
||||
create: (p: ExtensionParams) => Extension;
|
||||
};
|
||||
|
||||
export type CommandsModule = {
|
||||
actions: Record<string, unknown>;
|
||||
definitions: Record<string, unknown>;
|
||||
defaultContext?: string;
|
||||
};
|
||||
|
||||
export default class ExtensionManager {
|
||||
private _commandsManager: CommandsManager;
|
||||
private _servicesManager: ServicesManager;
|
||||
@@ -331,7 +340,7 @@ export default class ExtensionManager {
|
||||
}
|
||||
|
||||
try {
|
||||
const extensionModule = getModuleFn({
|
||||
const extensionModule = extension[getModuleFnName]({
|
||||
appConfig: this._appConfig,
|
||||
commandsManager: this._commandsManager,
|
||||
servicesManager: this._servicesManager,
|
||||
@@ -348,6 +357,7 @@ export default class ExtensionManager {
|
||||
|
||||
return extensionModule;
|
||||
} catch (ex) {
|
||||
console.log(ex);
|
||||
throw new Error(
|
||||
`Exception thrown while trying to call ${getModuleFnName} for the ${extensionId} extension`
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user