How to use @jupyterlab/htmlviewer - 1 common examples

To help you get started, we’ve selected a few @jupyterlab/htmlviewer 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 / htmlviewer-extension / src / index.tsx View on Github external
restorer: ILayoutRestorer | null
): IHTMLViewerTracker {
  // Add an HTML file type to the docregistry.
  const ft: DocumentRegistry.IFileType = {
    name: 'html',
    contentType: 'file',
    fileFormat: 'text',
    displayName: 'HTML File',
    extensions: ['.html'],
    mimeTypes: ['text/html'],
    iconClass: ICON_NAME
  };
  app.docRegistry.addFileType(ft);

  // Create a new viewer factory.
  const factory = new HTMLViewerFactory({
    name: 'HTML Viewer',
    fileTypes: ['html'],
    defaultFor: ['html'],
    readOnly: true
  });

  // Create a widget tracker for HTML documents.
  const tracker = new WidgetTracker({
    namespace: 'htmlviewer'
  });

  // Handle state restoration.
  if (restorer) {
    void restorer.restore(tracker, {
      command: 'docmanager:open',
      args: widget => ({ path: widget.context.path, factory: 'HTML Viewer' }),

@jupyterlab/htmlviewer

A viewer for HTML documents.

BSD-3-Clause
Latest version published 7 days ago

Package Health Score

95 / 100
Full package analysis

Popular @jupyterlab/htmlviewer functions

Similar packages