瀏覽代碼

Get both widget from main app for printing

Saul Shanabrook 6 年之前
父節點
當前提交
208aa833d7
共有 1 個文件被更改,包括 4 次插入6 次删除
  1. 4 6
      packages/apputils-extension/src/index.ts

+ 4 - 6
packages/apputils-extension/src/index.ts

@@ -7,8 +7,7 @@ import {
   ILayoutRestorer,
   IRouter,
   JupyterFrontEnd,
-  JupyterFrontEndPlugin,
-  ILabShell
+  JupyterFrontEndPlugin
 } from '@jupyterlab/application';
 
 import {
@@ -305,13 +304,12 @@ const splash: JupyterFrontEndPlugin<ISplashScreen> = {
 const print: JupyterFrontEndPlugin<void> = {
   id: '@jupyterlab/apputils-extension:print',
   autoStart: true,
-  requires: [ILabShell],
-  activate: (app: JupyterFrontEnd, labShell: ILabShell) => {
+  activate: (app: JupyterFrontEnd) => {
     app.commands.addCommand(CommandIDs.print, {
       label: 'Print...',
       isEnabled: () => {
-        const { currentWidget } = labShell;
-        return Printing.getPrintFunction(currentWidget) !== null;
+        const widget = app.shell.currentWidget;
+        return Printing.getPrintFunction(widget) !== null;
       },
       execute: async () => {
         const widget = app.shell.currentWidget;