Steven Silvester 9 лет назад
Родитель
Сommit
d70a70cfdf
1 измененных файлов с 6 добавлено и 4 удалено
  1. 6 4
      src/notebook/output-area/widget.ts

+ 6 - 4
src/notebook/output-area/widget.ts

@@ -141,11 +141,9 @@ class OutputAreaWidget extends Widget {
     }
     let oldValue = this._model;
     this._model = newValue;
-    if (oldValue) {
-      oldValue.changed.disconnect(this._onModelStateChanged, this);
-    }
-    newValue.changed.connect(this._onModelStateChanged, this);
+    // Trigger private, protected, and public updates.
     this._onModelChanged(oldValue, newValue);
+    this.onModelChanged(oldValue, newValue);
     this.modelChanged.emit(void 0);
   }
 
@@ -274,6 +272,10 @@ class OutputAreaWidget extends Widget {
    */
   private _onModelChanged(oldValue: OutputAreaModel, newValue: OutputAreaModel): void {
     let layout = this.layout as PanelLayout;
+    if (oldValue) {
+      oldValue.changed.disconnect(this._onModelStateChanged, this);
+    }
+    newValue.changed.connect(this._onModelStateChanged, this);
     let start = newValue ? newValue.length : 0;
     // Clear unnecessary child widgets.
     for (let i = start; i < layout.childCount(); i++) {