瀏覽代碼

Expose context getter on image widget.

Afshin Darian 8 年之前
父節點
當前提交
d32248546c
共有 1 個文件被更改,包括 10 次插入3 次删除
  1. 10 3
      src/imagewidget/widget.ts

+ 10 - 3
src/imagewidget/widget.ts

@@ -40,9 +40,16 @@ class ImageWidget extends Widget {
     if (context.model.toString()) {
       this.update();
     }
-    context.pathChanged.connect(() => this.update());
-    context.model.contentChanged.connect(() => this.update());
-    context.fileChanged.connect(() => this.update());
+    context.pathChanged.connect(() => { this.update(); });
+    context.model.contentChanged.connect(() => { this.update(); });
+    context.fileChanged.connect(() => { this.update(); });
+  }
+
+  /**
+   * The image widget's context.
+   */
+  get context(): DocumentRegistry.IContext<DocumentRegistry.IModel> {
+    return this._context;
   }
 
   /**