How to use the @jupyterlab/docregistry.DocumentRegistry.defaultTextFileType 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-docregistry / src / mimedocument.spec.ts View on Github external
it('should require a context parameter', () => {
        const widgetFactory = new MimeDocumentFactory({
          name: 'markdown',
          fileTypes: ['markdown'],
          rendermime: RENDERMIME,
          primaryFileType: DocumentRegistry.defaultTextFileType
        });
        expect(widgetFactory.createNew(dContext)).to.be.an.instanceof(
          MimeDocument
        );
      });
    });
github jupyterlab / jupyterlab / tests / test-docregistry / src / mimedocument.spec.ts View on Github external
it('should require a context parameter', () => {
        const widgetFactory = new MimeDocumentFactory({
          name: 'markdown',
          fileTypes: ['markdown'],
          rendermime: RENDERMIME,
          primaryFileType: DocumentRegistry.defaultTextFileType
        });
        expect(widgetFactory.createNew(dContext)).to.be.an.instanceof(
          MimeDocument
        );
      });
    });
github jupyterlab / jupyterlab-google-drive / src / contents.ts View on Github external
if (contentType === 'notebook') {
      fileType = DocumentRegistry.defaultNotebookFileType;
      ext = ext || fileType.extensions[0];
      baseName = 'Untitled';
      const modelFactory = this._docRegistry.getModelFactory('Notebook');
      if (!modelFactory) {
        throw Error('No model factory is registered with the DocRegistry');
      }
      model = {
        type: fileType.contentType,
        content: modelFactory.createNew().toJSON(),
        mimetype: fileType.mimeTypes[0],
        format: fileType.fileFormat
      };
    } else if (contentType === 'file') {
      fileType = DocumentRegistry.defaultTextFileType;
      ext = ext || fileType.extensions[0];
      baseName = 'untitled';
      model = {
        type: fileType.contentType,
        content: '',
        mimetype: fileType.mimeTypes[0],
        format: fileType.fileFormat
      };
    } else if (contentType === 'directory') {
      fileType = DocumentRegistry.defaultDirectoryFileType;
      ext = ext || '';
      baseName = 'Untitled Folder';
      model = {
        type: fileType.contentType,
        content: [],
        format: fileType.fileFormat