How to use the @jupyterlab/outputarea.OutputAreaModel function in @jupyterlab/outputarea

To help you get started, we’ve selected a few @jupyterlab/outputarea 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 voila-dashboards / voila / js / output.js View on Github external
initialize(attributes, options) {
        super.initialize(attributes, options)
        // The output area model is trusted since widgets are
        // only rendered in trusted contexts.
        this._outputs = new OutputAreaModel({trusted: true});
        this.listenTo(this, 'change:msg_id', this.onMsgIdChange);
        this.onMsgIdChange();
    }
github jupyterlab / jupyterlab / test / src / cells / widget.spec.ts View on Github external
it('should create an output area widget', () => {
          let factory = new CodeCellWidget.ContentFactory({ editorFactory });
          let model = new OutputAreaModel();
          let output = factory.createOutputArea({
            model,
            rendermime,
            contentFactory: OutputAreaWidget.defaultContentFactory
          });
          expect(output).to.be.an(OutputAreaWidget);
        });
github jupyterlab / jupyterlab-data-explorer / tests / test-outputarea / src / model.spec.ts View on Github external
it('should accept options', () => {
        const contentFactory = new OutputAreaModel.ContentFactory();
        model = new OutputAreaModel({
          values: NBTestUtils.DEFAULT_OUTPUTS,
          contentFactory,
          trusted: true
        });
        expect(model.contentFactory).to.equal(contentFactory);
        expect(model.trusted).to.equal(true);
      });
    });
github yuvipanda / simplest-notebook / test / src / outputarea / model.spec.ts View on Github external
it('should accept options', () => {
        let contentFactory = new OutputAreaModel.ContentFactory();
        model = new OutputAreaModel({
          values: DEFAULT_OUTPUTS,
          contentFactory,
          trusted: true
        });
        expect(model.contentFactory).to.be(contentFactory);
        expect(model.trusted).to.be(true);
      });
github jupyterlab / jupyterlab / test / src / outputarea / widget.spec.ts View on Github external
beforeEach(() => {
    model = new OutputAreaModel({ values: DEFAULT_OUTPUTS, trusted: true });
    widget = new LogOutputAreaWidget({ rendermime, model });
  });
github ines / juniper / src / index.js View on Github external
renderCell($element) {
        const outputArea = new OutputArea({
            model: new OutputAreaModel({ trusted: true }),
            rendermime: new RenderMimeRegistry({
                initialFactories: this.getRenderers()
            })
        });

        const $cell = this._$('div', this.classNames.cell);
        $element.replaceWith($cell);
        const $input = this._$('div', this.classNames.input);
        $cell.appendChild($input);
        const $button = this._$('button', this.classNames.button, 'run');
        $cell.appendChild($button);
        const $output = this._$('div', this.classNames.output);
        $cell.appendChild($output);
        Widget.attach(outputArea, $output);

        const cm = new CodeMirror($input, {
github ines / spacy-course / src / components / juniper.js View on Github external
componentDidMount() {
        this.setState({ content: this.props.children })
        const renderers = standardRendererFactories.filter(factory =>
            factory.mimeTypes.includes('text/latex') ? window.MathJax : true
        )

        const outputArea = new OutputArea({
            model: new OutputAreaModel({ trusted: true }),
            rendermime: new RenderMimeRegistry({ initialFactories: renderers }),
        })

        const cm = new CodeMirror(this.inputRef, {
            value: this.props.children.trim(),
            mode: this.props.lang,
            theme: this.props.theme,
        })
        this.setState({ cm })

        const runCode = wrapper => {
            const value = cm.getValue()
            this.execute(outputArea, wrapper ? wrapper(value) : value)
        }
        const setValue = value => cm.setValue(value)
        cm.setOption('extraKeys', { 'Shift-Enter': runCode })
github minrk / thebelab / src / thebelab.js View on Github external
});
  }
  let renderMime = new RenderMimeRegistry(renderers);

  let manager = options.manager;

  renderMime.addFactory(
    {
      safe: false,
      mimeTypes: [WIDGET_MIMETYPE],
      createRenderer: options => new WidgetRenderer(options, manager),
    },
    1
  );

  let model = new OutputAreaModel({ trusted: true });

  let outputArea = new OutputArea({
    model: model,
    rendermime: renderMime,
  });

  $element.replaceWith($cell);

  let $cm_element = $("<div class="thebelab-input">");
  $cell.append($cm_element);
  $cell.append(
    $("<button class="thebelab-button thebelab-run-button">")
      .text("run")
      .attr("title", "run this cell")
      .click(execute)
  );</button></div>