Class YCodeCell

Shareable code cell.

Hierarchy

Implements

Constructors

  • Code cell constructor

    Notes

    Don't use the constructor directly - prefer using YNotebook.insertCell

    The ysource is needed because ymodel.get('source') will not return the real source if the model is not yet attached to a document. Requesting it explicitly allows to introspect a non-empty source before the cell is attached to the document.

    Parameters

    • ymodel: YMap<any>

      Cell map

    • ysource: YText

      Cell source

    • youtputs: YArray<any>

      Code cell outputs

    • options: SharedCell.IOptions = {}

      { notebook?: The notebook the cell is attached to }

    • Optional ymetadata: YMap<any>

      Cell metadata

    Returns YCodeCell

Properties

_metadataChanged: Signal<YCodeCell, IMapChange<any>> = ...
_notebook: null | YNotebook = null

The notebook that this cell belongs to.

_youtputs: YArray<IOutput>
ymodel: YMap<any>

Accessors

  • get awareness(): null | Awareness
  • Cell notebook awareness or null if the cell is standalone.

    Returns null | Awareness

  • get isStandalone(): boolean
  • Whether the cell is standalone or not.

    If the cell is standalone. It cannot be inserted into a YNotebook because the Yjs model is already attached to an anonymous Y.Doc instance.

    Returns boolean

  • get metadata(): Partial<Metadata>
  • Cell metadata.

    Notes

    You should prefer to access and modify the specific key of interest.

    Returns Partial<Metadata>

  • set metadata(v: Partial<Metadata>): void
  • Cell metadata.

    Notes

    You should prefer to access and modify the specific key of interest.

    Parameters

    • v: Partial<Metadata>

    Returns void

  • get ysource(): YText
  • Shareable text

    Returns YText

Methods

  • Defer setting the undo manager as it requires the cell to be attached to the notebook Y document.

    Returns void

  • Perform a transaction. While the function f is called, all changes to the shared document are bundled into a single event.

    Parameters

    • f: (() => void)

      Transaction to execute

        • (): void
        • Returns void

    • undoable: boolean = true

      Whether to track the change in the action history or not (default true)

    Returns void

  • Create a new YCodeCell that works standalone. It cannot be inserted into a YNotebook because the Yjs model is already attached to an anonymous Y.Doc instance.

    Parameters

    • Optional id: string

    Returns YCodeCell

Generated using TypeDoc