Pārlūkot izejas kodu

Do not associate a widget name with a sibling widget

Steven Silvester 9 gadi atpakaļ
vecāks
revīzija
a599cc0d6f
1 mainītis faili ar 5 papildinājumiem un 2 dzēšanām
  1. 5 2
      src/docmanager/index.ts

+ 5 - 2
src/docmanager/index.ts

@@ -355,8 +355,6 @@ class DocumentManager implements IDisposable {
     this._contextManager = new ContextManager(contentsManager, sessionManager, kernelSpecs, (id: string, widget: Widget) => {
       let parent = new Widget();
       this._attachChild(parent, widget);
-      let sibling = this._widgets[id][0];
-      let name = Private.nameProperty.get(sibling);
       Private.nameProperty.set(parent, name);
       Private.contextProperty.set(parent, id);
       this._widgets[id].push(parent);
@@ -647,6 +645,11 @@ class DocumentManager implements IDisposable {
     let context = this._contextManager.getContext(id);
     let child = (widget.layout as PanelLayout).childAt(0);
     let name = Private.nameProperty.get(widget);
+    // Check for a sibling widget.
+    if (!name) {
+      this._closeGuard = true;
+      widget.close();
+    }
     let factory = this._widgetFactories[name].factory;
     this._maybeClose(widget, model.dirty).then(result => {
       if (!result) {