plugin.ts 983 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright (c) Jupyter Development Team.
  2. // Distributed under the terms of the Modified BSD License.
  3. import {
  4. Application
  5. } from 'phosphide/lib/core/application';
  6. import {
  7. DocumentRegistry
  8. } from '../docregistry';
  9. import {
  10. MapWidget, MapWidgetFactory
  11. } from './widget';
  12. import 'leaflet/dist/leaflet.css';
  13. /**
  14. * The list of file extensions for maps.
  15. */
  16. const EXTENSIONS = ['.geojson'];
  17. /**
  18. * The geojson file handler extension.
  19. */
  20. export
  21. const mapHandlerExtension = {
  22. id: 'jupyter.extensions.mapHandler',
  23. requires: [DocumentRegistry],
  24. activate: activateMapWidget
  25. };
  26. /**
  27. * Activate the map widget extension.
  28. */
  29. function activateMapWidget(app: Application, registry: DocumentRegistry): void {
  30. let options = {
  31. fileExtensions: EXTENSIONS,
  32. displayName: 'Map',
  33. modelName: 'text',
  34. defaultFor: EXTENSIONS,
  35. preferKernel: false,
  36. canStartKernel: false
  37. };
  38. registry.addWidgetFactory(new MapWidgetFactory(), options);
  39. }