How to use the @jupyterlab/docregistry.DocumentRegistry function in @jupyterlab/docregistry

To help you get started, we’ve selected a few @jupyterlab/docregistry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab-data-explorer / tests / test-filebrowser / src / model.spec.ts View on Github external
before(() => {
    const opener: DocumentManager.IWidgetOpener = {
      open: widget => {
        /* no op */
      }
    };

    registry = new DocumentRegistry({
      textModelFactory: new TextModelFactory()
    });
    serviceManager = new ServiceManager({ standby: 'never' });
    manager = new DocumentManager({
      registry,
      opener,
      manager: serviceManager
    });
    state = new StateDB();
  });
github jupyterlab / jupyterlab / tests / test-filebrowser / src / openfiledialog.spec.ts View on Github external
before(async () => {
    const opener: DocumentManager.IWidgetOpener = {
      open: widget => {
        /* no op */
      }
    };

    registry = new DocumentRegistry({
      textModelFactory: new TextModelFactory()
    });
    serviceManager = new ServiceManager({ standby: 'never' });
    iconRegistry = defaultIconRegistry;
    manager = new DocumentManager({
      registry,
      opener,
      manager: serviceManager
    });

    const contents = serviceManager.contents;
    await contents.newUntitled({ type: 'directory' });
    await contents.newUntitled({ type: 'file' });
    await contents.newUntitled({ type: 'notebook' });
  });
github jupyterlab / jupyterlab / examples / notebook / src / index.ts View on Github external
// Setup the keydown listener for the document.
  document.addEventListener('keydown', event => {
    commands.processKeydownEvent(event);
  }, useCapture);

  let rendermime = new RenderMime({
    initialFactories: defaultRendererFactories
  });

  let opener = {
    open: (widget: Widget) => {
      // Do nothing for sibling widgets for now.
    }
  };

  let docRegistry = new DocumentRegistry();
  let docManager = new DocumentManager({
    registry: docRegistry,
    manager,
    opener
  });
  let mFactory = new NotebookModelFactory({});
  let editorFactory = editorServices.factoryService.newInlineEditor.bind(
    editorServices.factoryService);
  let contentFactory = new NotebookPanel.ContentFactory({ editorFactory });

  let wFactory = new NotebookWidgetFactory({
    name: 'Notebook',
    modelName: 'notebook',
    fileExtensions: ['.ipynb'],
    defaultFor: ['.ipynb'],
    preferKernel: true,
github spyder-ide / spyder-notebook / spyder_notebook / server / src / index.ts View on Github external
let rendermime = new RenderMimeRegistry({
    initialFactories: initialFactories,
    latexTypesetter: new MathJaxTypesetter({
      url: PageConfig.getOption('mathjaxUrl'),
      config: PageConfig.getOption('mathjaxConfig')
    })
  });

  let opener = {
    open: (widget: Widget) => {
      // Do nothing for sibling widgets for now.
    }
  };

  let docRegistry = new DocumentRegistry();
  let docManager = new DocumentManager({
    registry: docRegistry,
    manager,
    opener
  });
  let mFactory = new NotebookModelFactory({});
  let editorFactory = editorServices.factoryService.newInlineEditor;
  let contentFactory = new NotebookPanel.ContentFactory({ editorFactory });

  let wFactory = new NotebookWidgetFactory({
    name: 'Notebook',
    modelName: 'notebook',
    fileTypes: ['notebook'],
    defaultFor: ['notebook'],
    preferKernel: true,
    canStartKernel: true,
github yuvipanda / simplest-notebook / examples / notebook / src / index.ts View on Github external
let rendermime = new RenderMimeRegistry({
    initialFactories: initialFactories,
    latexTypesetter: new MathJaxTypesetter({
      url: PageConfig.getOption('mathjaxUrl'),
      config: PageConfig.getOption('mathjaxConfig')
    })
  });

  let opener = {
    open: (widget: Widget) => {
      // Do nothing for sibling widgets for now.
    }
  };

  let docRegistry = new DocumentRegistry();
  let docManager = new DocumentManager({
    registry: docRegistry,
    manager,
    opener
  });
  let mFactory = new NotebookModelFactory({});
  let editorFactory = editorServices.factoryService.newInlineEditor;
  let contentFactory = new NotebookPanel.ContentFactory({ editorFactory });

  let wFactory = new NotebookWidgetFactory({
    name: 'Notebook',
    modelName: 'notebook',
    fileTypes: ['notebook'],
    defaultFor: ['notebook'],
    preferKernel: true,
    canStartKernel: true,
github jupyterlab / jupyterlab / tests / test-docregistry / src / registry.spec.ts View on Github external
it('should add a file type to the document registry', () => {
        registry = new DocumentRegistry({ initialFileTypes: [] });
        let fileType = { name: 'notebook', extensions: ['.ipynb'] };
        registry.addFileType(fileType);
        expect(registry.fileTypes().next().name).to.be(fileType.name);
      });
github jupyterlab / jupyterlab / tests / test-docregistry / src / registry.spec.ts View on Github external
it('should get the registered file types', () => {
        registry = new DocumentRegistry({ initialFileTypes: [] });
        expect(toArray(registry.fileTypes()).length).to.be(0);
        let fileTypes = [
          { name: 'notebook', extensions: ['.ipynb'] },
          { name: 'python', extensions: ['.py'] },
          { name: 'table', extensions: ['.table.json'] }
        ];
        registry.addFileType(fileTypes[0]);
        registry.addFileType(fileTypes[1]);
        registry.addFileType(fileTypes[2]);
        let values = registry.fileTypes();
        expect(values.next().name).to.be(fileTypes[0].name);
        expect(values.next().name).to.be(fileTypes[1].name);
        expect(values.next().name).to.be(fileTypes[2].name);
      });
github jupyterlab / jupyterlab / tests / test-docregistry / src / registry.spec.ts View on Github external
beforeEach(() => {
      registry = new DocumentRegistry();
      registry.addFileType({
        name: 'foobar',
        extensions: ['.foo.bar']
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-docregistry / src / registry.spec.ts View on Github external
beforeEach(() => {
      registry = new DocumentRegistry();
      registry.addFileType({
        name: 'foobar',
        extensions: ['.foo.bar']
      });
      registry.addFileType({
        name: 'baz',
        extensions: ['.baz']
      });
    });
github jupyterlab / jupyterlab / examples / filebrowser / src / index.ts View on Github external
let opener = {
    open: (widget: Widget) => {
      if (widgets.indexOf(widget) === -1) {
        dock.addWidget(widget, { mode: 'tab-after' });
        widgets.push(widget);
      }
      dock.activateWidget(widget);
      activeWidget = widget;
      widget.disposed.connect((w: Widget) => {
        let index = widgets.indexOf(w);
        widgets.splice(index, 1);
      });
    }
  };

  let docRegistry = new DocumentRegistry();
  let docManager = new DocumentManager({
    registry: docRegistry,
    manager,
    opener
  });
  let editorServices = {
    factoryService: new CodeMirrorEditorFactory(),
    mimeTypeService: new CodeMirrorMimeTypeService()
  };
  let wFactory = new FileEditorFactory({
    editorServices,
    factoryOptions: {
      name: 'Editor',
      modelName: 'text',
      fileTypes: ['*'],
      defaultFor: ['*'],