How to use the @jupyterlab/docregistry.Base64ModelFactory 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 / packages / application / src / lab.ts View on Github external
(acc as any)[key] = value;
          } else {
            (acc as any)[key] = (defaultDirs as any)[key];
          }
          return acc;
        },
        {}
      )
    } as JupyterFrontEnd.IPaths;

    if (this._info.devMode) {
      this.shell.addClass('jp-mod-devMode');
    }

    // Add initial model factory.
    this.docRegistry.addModelFactory(new Base64ModelFactory());

    if (options.mimeExtensions) {
      for (let plugin of createRendermimePlugins(options.mimeExtensions)) {
        this.registerPlugin(plugin);
      }
    }
  }
github jupyterlab / jupyterlab / tests / test-docregistry / src / registry.spec.ts View on Github external
it('should get a registered model factory by name', () => {
        const mFactory = new Base64ModelFactory();
        registry.addModelFactory(mFactory);
        expect(registry.getModelFactory('base64')).to.equal(mFactory);
      });
    });
github jupyterlab / jupyterlab / tests / test-docregistry / src / default.spec.ts View on Github external
it('should get the name of the model type', () => {
        const factory = new Base64ModelFactory();
        expect(factory.name).to.equal('base64');
      });
    });
github jupyterlab / jupyterlab / tests / test-docregistry / src / registry.spec.ts View on Github external
it('should get a widget factory by name', () => {
        registry.addModelFactory(new Base64ModelFactory());
        const factory = createFactory();
        registry.addWidgetFactory(factory);
        const mdFactory = new WidgetFactory({
          name: 'markdown',
          fileTypes: ['markdown']
        });
        registry.addWidgetFactory(mdFactory);
        expect(registry.getWidgetFactory(factory.name)).to.equal(factory);
        expect(registry.getWidgetFactory('markdown')).to.equal(mdFactory);
        expect(registry.getWidgetFactory('baz')).to.be.undefined;
      });
    });
github jupyterlab / jupyterlab / tests / test-docregistry / src / default.spec.ts View on Github external
it('should get the file type', () => {
        const factory = new Base64ModelFactory();
        expect(factory.contentType).to.equal('file');
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-docregistry / src / default.spec.ts View on Github external
it('should get the name of the model type', () => {
        const factory = new Base64ModelFactory();
        expect(factory.name).to.equal('base64');
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-docregistry / src / registry.spec.ts View on Github external
it('should be a no-op a factory with the given `name` is already registered', () => {
        const factory = new Base64ModelFactory();
        registry.addModelFactory(factory);
        const disposable = registry.addModelFactory(new Base64ModelFactory());
        disposable.dispose();
      });
github yuvipanda / simplest-notebook / test / src / docregistry / default.spec.ts View on Github external
it('should get the name of the model type', () => {
        let factory = new Base64ModelFactory();
        expect(factory.name).to.be('base64');
      });
github jupyterlab / jupyterlab / tests / test-docregistry / src / registry.spec.ts View on Github external
it('should be a no-op a factory with the given `name` is already registered', () => {
        let factory = new Base64ModelFactory();
        registry.addModelFactory(factory);
        let disposable = registry.addModelFactory(new Base64ModelFactory());
        disposable.dispose();
      });
github jupyterlab / jupyterlab / packages / docregistry-extension / src / index.ts View on Github external
activate: (): IDocumentRegistry => {
    let registry = new DocumentRegistry();
    registry.addModelFactory(new TextModelFactory());
    registry.addModelFactory(new Base64ModelFactory());
    registry.addFileType({
      name: 'Text',
      extension: '.txt',
      contentType: 'file',
      fileFormat: 'text'
    });
    registry.addCreator({ name: 'Text File', fileType: 'Text', });

    return registry;
  }
};