plugin.ts 1008 B

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