Jelajahi Sumber

Fixing close and close all.

Brian E. Granger 8 tahun lalu
induk
melakukan
96552eb69a
2 mengubah file dengan 13 tambahan dan 14 penghapusan
  1. 11 12
      packages/application/src/shell.ts
  2. 2 2
      packages/shortcuts-extension/src/index.ts

+ 11 - 12
packages/application/src/shell.ts

@@ -10,7 +10,7 @@ import {
 } from '@phosphor/coreutils';
 
 import {
-  Message, MessageLoop, IMessageHook, IMessageHandler, MessageHook
+  Message, MessageLoop, IMessageHandler
 } from '@phosphor/messaging';
 
 import {
@@ -72,7 +72,7 @@ class ApplicationShell extends Widget {
     let topPanel = this._topPanel = new Panel();
     let hboxPanel = this._hboxPanel = new BoxPanel();
     let dockPanel = this._dockPanel = new DockPanel();
-    MessageLoop.installMessageHook(dockPanel, Private.ActivityClassHook as MessageHook);
+    MessageLoop.installMessageHook(dockPanel, Private.activityClassHook);
 
     let hsplitPanel = this._hsplitPanel = new SplitPanel();
     let leftHandler = this._leftHandler = new Private.SideBarHandler('left');
@@ -964,18 +964,17 @@ namespace Private {
     private _stackedPanel: StackedPanel;
   }
 
+  /**
+   * A message hook that adds and removes the .jp-Activity class to widgets in the dock panel.
+   */
   export
-  class ActivityClassHook implements IMessageHook {
-
-    messageHook(handler: IMessageHandler, msg: Message): boolean {
-      
-      if (msg.type === 'child-added') {
-        (handler as Widget).addClass(ACTIVITY_CLASS)
-      } else if (msg.type === 'child-removed') {
-        (handler as Widget).removeClass(ACTIVITY_CLASS)
-      }
-      return true;
+  var activityClassHook = (handler: IMessageHandler, msg: Message): boolean => {      
+    if (msg.type === 'child-added') {
+      (msg as Widget.ChildMessage).child.addClass(ACTIVITY_CLASS)
+    } else if (msg.type === 'child-removed') {
+      (msg as Widget.ChildMessage).child.removeClass(ACTIVITY_CLASS)
     }
+    return true;
   }
 
 }

+ 2 - 2
packages/shortcuts-extension/src/index.ts

@@ -114,12 +114,12 @@ const SHORTCUTS = [
   },
   {
     command: 'file-operations:close',
-    selector: '.jp-Document',
+    selector: '.jp-Activity',
     keys: ['Ctrl Q']
   },
   {
     command: 'file-operations:close-all-files',
-    selector: '.jp-Document',
+    selector: 'body',
     keys: ['Ctrl Shift Q']
   },
   {