Class YBaseCell<Metadata>

Implements an API for nbformat.IBaseCell.

Type Parameters

Hierarchy

Implements

Constructors

  • Base 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.

    Type Parameters

    Parameters

    • ymodel: YMap<any>

      Cell map

    • ysource: YText

      Cell source

    • options: SharedCell.IOptions = {}

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

    • Optional ymetadata: YMap<any>

      Cell metadata

    Returns YBaseCell<Metadata>

Properties

_awareness: null | Awareness
_changed: Signal<YBaseCell<Metadata>, CellChange> = ...
_disposed: Signal<YBaseCell<Metadata>, void> = ...
_isDisposed: boolean = false
_metadataChanged: Signal<YBaseCell<Metadata>, IMapChange<any>> = ...
_notebook: null | YNotebook = null

The notebook that this cell belongs to.

_prevSourceLength: number
_undoManager: null | UndoManager = null
_ymetadata: YMap<any>
_ysource: YText
ymodel: YMap<any>

Accessors

  • 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

Methods

  • Handle a change to the ymodel.

    Parameters

    Returns void

  • Sets all or a single cell metadata.

    If only one argument is provided, it will override all cell metadata. Otherwise a single key will be set to a new value.

    Parameters

    • metadata: Partial<Metadata>

      Cell's metadata key or cell's metadata.

    Returns void

  • Sets a cell metadata.

    Parameters

    Returns void

  • 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

  • Replace content from start' to endwithvalue`.

    Parameters

    • start: number
    • end: number
    • value: string = ''

    Returns void

  • Create a new YCell 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 YBaseCell<any>

Generated using TypeDoc