浏览代码

Update image widget plugins.

Afshin Darian 8 年之前
父节点
当前提交
98dd3dbdca
共有 2 个文件被更改,包括 15 次插入10 次删除
  1. 10 5
      src/imagewidget/index.ts
  2. 5 5
      src/imagewidget/plugin.ts

+ 10 - 5
src/imagewidget/index.ts

@@ -5,11 +5,16 @@ export * from './widget';
 
 
 /**
- * The map of command ids used by the imagewidget plugin.
+ * The command IDs used by the image widget plugin.
  */
 export
-const cmdIds = {
-  zoomIn: 'imagewidget:zoom-in',
-  zoomOut: 'imagewidget:zoom-out',
-  resetZoom: 'imagewidget:reset-zoom'
+namespace CommandIDs {
+  export
+  const zoomIn = 'imagewidget:zoom-in';
+
+  export
+  const zoomOut = 'imagewidget:zoom-out';
+
+  export
+  const resetZoom = 'imagewidget:reset-zoom';
 };

+ 5 - 5
src/imagewidget/plugin.ts

@@ -26,7 +26,7 @@ import {
 } from '../instancerestorer';
 
 import {
-  ImageWidget, ImageWidgetFactory, cmdIds
+  CommandIDs, ImageWidget, ImageWidgetFactory
 } from './';
 
 
@@ -86,24 +86,24 @@ function activate(app: JupyterLab, registry: IDocumentRegistry, palette: IComman
     tracker.add(widget);
   });
 
-  app.commands.addCommand(cmdIds.zoomIn, {
+  app.commands.addCommand(CommandIDs.zoomIn, {
     execute: zoomIn,
     label: 'Zoom In'
   });
 
-  app.commands.addCommand(cmdIds.zoomOut, {
+  app.commands.addCommand(CommandIDs.zoomOut, {
     execute: zoomOut,
     label: 'Zoom Out'
   });
 
-  app.commands.addCommand(cmdIds.resetZoom, {
+  app.commands.addCommand(CommandIDs.resetZoom, {
     execute: resetZoom,
     label: 'Reset Zoom'
   });
 
   let category = 'Image Widget';
 
-  [cmdIds.zoomIn, cmdIds.zoomOut, cmdIds.resetZoom]
+  [CommandIDs.zoomIn, CommandIDs.zoomOut, CommandIDs.resetZoom]
     .forEach(command => palette.addItem({ command, category }));
 
   function zoomIn(): void {