plugin.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (c) Jupyter Development Team.
  2. // Distributed under the terms of the Modified BSD License.
  3. 'use strict';
  4. import {
  5. FileBrowserWidget
  6. } from 'jupyter-js-filebrowser';
  7. import {
  8. IAppShell, ICommandPalette, ICommandRegistry
  9. } from 'phosphide';
  10. import {
  11. CodeMirrorWidget
  12. } from 'phosphor-codemirror';
  13. import {
  14. Container, Token
  15. } from 'phosphor-di';
  16. import {
  17. Widget
  18. } from 'phosphor-widget';
  19. import {
  20. IFileBrowserWidget
  21. } from '../../lib';
  22. /**
  23. * Register the plugin contributions.
  24. *
  25. * @param container - The di container for type registration.
  26. *
  27. * #### Notes
  28. * This is called automatically when the plugin is loaded.
  29. */
  30. export
  31. function resolve(container: Container): Promise<void> {
  32. return container.resolve({
  33. requires: [IAppShell, ICommandPalette, IFileBrowserWidget],
  34. create: (shell: IAppShell, palette: ICommandPalette, browser: IFileBrowserWidget) => {
  35. palette.title.text = 'Commands';
  36. shell.addToLeftArea(palette, { rank: 40 });
  37. shell.attach(document.body);
  38. window.addEventListener('resize', () => { shell.update(); });
  39. browser.title.text = 'Files';
  40. shell.addToLeftArea(browser, { rank: 40 });
  41. }
  42. });
  43. }