How to use the @jupyterlab/apputils.IFrame function in @jupyterlab/apputils

To help you get started, we’ve selected a few @jupyterlab/apputils 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 / src / index.tsx View on Github external
constructor(options: DocumentWidget.IOptionsOptionalContent) {
    super({
      ...options,
      content: new IFrame({ sandbox: ['allow-same-origin'] })
    });
    this.content.addClass(CSS_CLASS);

    void this.context.ready.then(() => {
      this.update();
      // Throttle the rendering rate of the widget.
      this._monitor = new ActivityMonitor({
        signal: this.context.model.contentChanged,
        timeout: RENDER_TIMEOUT
      });
      this._monitor.activityStopped.connect(this.update, this);
    });

    // Make a refresh button for the toolbar.
    this.toolbar.addItem(
      'refresh',
github jupyterlab / jupyterlab-data-explorer / jupyterlab / packages / help-extension / src / index.tsx View on Github external
function newHelpWidget(url: string, text: string): MainAreaWidget {
    // Allow scripts and forms so that things like
    // readthedocs can use their search functionality.
    // We *don't* allow same origin requests, which
    // can prevent some content from being loaded onto the
    // help pages.
    let content = new IFrame({
      sandbox: ['allow-scripts', 'allow-forms']
    });
    content.url = url;
    content.addClass(HELP_CLASS);
    content.title.label = text;
    content.id = `${namespace}-${++counter}`;
    let widget = new MainAreaWidget({ content });
    widget.addClass('jp-Help');
    return widget;
  }
github dask / dask-labextension / src / dashboard.tsx View on Github external
constructor() {
    super({
      // Disable allow some iframe extensions to let server requests
      // and scripts to execute in the bokeh server context.
      // This is unsafe, but we presumably trust the code in the bokeh server.
      content: new IFrame({ sandbox: ['allow-scripts', 'allow-same-origin'] })
    });
    this._inactivePanel = Private.createInactivePanel();
    this.content.node.appendChild(this._inactivePanel);
    this.update();
  }
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / iframe.spec.ts View on Github external
it('should be the url of the iframe', () => {
        let iframe = new IFrame();
        expect(iframe.url).to.equal('');
        iframe.url = 'foo';
        expect(iframe.url).to.equal('foo');
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / iframe.spec.ts View on Github external
it('should set the referrer policy for the iframe.', () => {
        let iframe = new IFrame({ referrerPolicy: 'unsafe-url' });
        let node = iframe.node.querySelector('iframe')!;
        expect(iframe.referrerPolicy).to.equal('unsafe-url');
        iframe.referrerPolicy = 'origin';
        expect(iframe.referrerPolicy).to.equal('origin');
        expect(node.getAttribute('referrerpolicy')).to.equal('origin');
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / iframe.spec.ts View on Github external
it('should create a new iframe widget', () => {
        let iframe = new IFrame();
        expect(iframe).to.be.an.instanceof(IFrame);
        expect(iframe.hasClass('jp-IFrame')).to.equal(true);
        expect(iframe.node.querySelector('iframe')).to.be.ok;
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / iframe.spec.ts View on Github external
it('should set the exceptions for the sandbox attribute.', () => {
        let iframe = new IFrame({
          sandbox: ['allow-scripts', 'allow-same-origin']
        });
        let node = iframe.node.querySelector('iframe')!;
        expect(iframe.sandbox).to.deep.equal([
          'allow-scripts',
          'allow-same-origin'
        ]);
        iframe.sandbox = ['allow-pointer-lock'];
        expect(iframe.sandbox).to.deep.equal(['allow-pointer-lock']);
        expect(node.getAttribute('sandbox')).to.equal('allow-pointer-lock');
      });
    });
github jupyterlab / jupyterlab / packages / help-extension / src / index.ts View on Github external
constructor(url: string) {
    super();
    let layout = this.layout = new PanelLayout();
    let iframe = new IFrame();
    iframe.url = url;
    layout.addWidget(iframe);
  }
github dask / dask-labextension / src / dashboard.tsx View on Github external
constructor() {
    super({ content: new IFrame() });
    this.content.url = '';
  }
github rapidsai / jupyterlab-nvdashboard / src / dashboard.tsx View on Github external
constructor() {
    super({
      content: new IFrame({ sandbox: ['allow-scripts', 'allow-same-origin'] })
    });
    this._inactivePanel = Private.createInactivePanel();
    this.content.node.appendChild(this._inactivePanel);
    this.update();
  }