plugin.ts 898 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (c) Jupyter Development Team.
  2. // Distributed under the terms of the Modified BSD License.
  3. import {
  4. JupyterLabPlugin
  5. } from '../application';
  6. import {
  7. DocumentRegistry, IDocumentRegistry, TextModelFactory, Base64ModelFactory
  8. } from './index';
  9. /**
  10. * The default document registry provider.
  11. */
  12. export
  13. const docRegistryProvider: JupyterLabPlugin<IDocumentRegistry> = {
  14. id: 'jupyter.services.document-registry',
  15. provides: IDocumentRegistry,
  16. activate: (): IDocumentRegistry => {
  17. let registry = new DocumentRegistry();
  18. registry.addModelFactory(new TextModelFactory());
  19. registry.addModelFactory(new Base64ModelFactory());
  20. registry.addFileType({
  21. name: 'Text',
  22. extension: '.txt',
  23. contentType: 'file',
  24. fileFormat: 'text'
  25. });
  26. registry.addCreator({
  27. name: 'Text File',
  28. fileType: 'Text',
  29. });
  30. return registry;
  31. }
  32. };