How to use the @nteract/commutable.createCodeCell function in @nteract/commutable

To help you get started, we’ve selected a few @nteract/commutable 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 nteract / nteract / packages / notebook-render / src / index.tsx View on Github external
notebook: ImmutableNotebook;
  transforms: object;
  theme: "light" | "dark";
}

interface State {
  notebook: ImmutableNotebook;
}

export default class NotebookRender extends React.PureComponent {
  static defaultProps = {
    displayOrder: defaultDisplayOrder,
    transforms: defaultTransforms,
    notebook: appendCellToNotebook(
      emptyNotebook,
      createCodeCell().set("source", "# where's the content?")
    ),
    theme: "light"
  };

  constructor(props: Props) {
    super(props);

    this.state = {
      notebook: fromJS(props.notebook)
    };
  }

  componentWillReceiveProps(nextProps: Props) {
    if (nextProps.notebook !== this.props.notebook) {
      this.setState({ notebook: fromJS(nextProps.notebook) });
    }
github nteract / nteract / packages / notebook-preview / src / index.tsx View on Github external
notebook: any;
  transforms: Transforms;
  theme: "light" | "dark";
};

type State = {
  notebook: any;
};

export class NotebookPreview extends React.PureComponent {
  static defaultProps = {
    displayOrder: defaultDisplayOrder,
    transforms: defaultTransforms,
    notebook: appendCellToNotebook(
      emptyNotebook,
      createCodeCell().set("source", "# where's the content?")
    ),
    theme: "light"
  };

  constructor(props: Props) {
    super(props);

    this.state = {
      notebook: fromJS(props.notebook)
    };
  }

  componentWillReceiveProps(nextProps: Props) {
    if (nextProps.notebook !== this.props.notebook) {
      this.setState({ notebook: fromJS(nextProps.notebook) });
    }
github nteract / nteract / packages / notebook-preview / src / index.tsx View on Github external
const Themes = {
  dark: createGlobalStyle`
    :root {
      ${themes.dark}
    }`,
  light: createGlobalStyle`
    :root {
      ${themes.light}
    }`
};

export class NotebookPreview extends React.PureComponent {
  static defaultProps = {
    notebook: appendCellToNotebook(
      emptyNotebook,
      createCodeCell().set("source", "# where's the content?")
    ),
    theme: "light"
  };

  constructor(props: Props) {
    super(props);

    this.state = {
      notebook: fromJS(props.notebook)
    };
  }

  componentWillReceiveProps(nextProps: Props) {
    if (nextProps.notebook !== this.props.notebook) {
      this.setState({ notebook: fromJS(nextProps.notebook) });
    }
github nteract / nteract / packages / notebook-render / src / index.tsx View on Github external
const Themes = {
  dark: createGlobalStyle`
    :root {
      ${themes.dark}
    }`,
  light: createGlobalStyle`
    :root {
      ${themes.light}
    }`
};

export default class NotebookRender extends React.PureComponent {
  static defaultProps = {
    notebook: appendCellToNotebook(
      emptyNotebook,
      createCodeCell().set("source", "# where's the content?")
    ),
    theme: "light"
  };

  constructor(props: Props) {
    super(props);

    this.state = {
      notebook: fromJS(props.notebook)
    };
  }

  componentWillReceiveProps(nextProps: Props) {
    if (nextProps.notebook !== this.props.notebook) {
      this.setState({ notebook: fromJS(nextProps.notebook) });
    }