Class YRawCell

Shareable raw cell.

Hierarchy

  • YAttachmentCell
    • YRawCell

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.

    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 YRawCell

Properties

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

The notebook that this cell belongs to.

ymodel: YMap<any>

Accessors

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

    Returns null | Awareness

  • get isDisposed(): boolean
  • Whether the model has been disposed or not.

    Returns boolean

  • 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
  • Returns YText

Methods

  • Delete a metadata cell.

    Parameters

    • key: string

      The key to delete

    Returns void

  • Extract changes from YJS events

    Returns

    Cell changes

    Parameters

    • events: YEvent<any>[]

      YJS events

    Returns Partial<CellChange>

  • Sets cell's source.

    Parameters

    • value: string

    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 YRawCell 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 YRawCell

Generated using TypeDoc