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 attachments(): undefined | IAttachments
  • Cell attachments

    Returns undefined | IAttachments

  • set attachments(v: undefined | IAttachments): void
  • Cell attachments

    Parameters

    • v: undefined | IAttachments

    Returns void

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

    Returns null | Awareness

  • get disposed(): ISignal<this, void>
  • Signal emitted when the cell is disposed.

    Returns ISignal<this, void>

  • 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 undoManager(): null | UndoManager
  • The cell undo manager.

    Returns null | UndoManager

  • get ysource(): YText
  • Returns YText

Methods

  • Delete a metadata cell.

    Parameters

    • key: string

      The key to delete

    Returns void

  • Gets the cell attachments.

    Returns

    The cell attachments.

    Returns undefined | IAttachments

  • Extract changes from YJS events

    Returns

    Cell changes

    Parameters

    • events: YEvent<any>[]

      YJS events

    Returns Partial<CellChange>

  • Returns all or a single metadata associated with the cell.

    Returns

    cell's metadata.

    Returns Partial<IBaseCellMetadata>

  • Returns a metadata associated with the cell.

    Returns

    Cell's metadata.

    Parameters

    • key: string

      Metadata key to get

    Returns undefined | PartialJSONValue

  • Sets the cell attachments

    Parameters

    • attachments: undefined | IAttachments

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

      Cell's metadata key or cell's metadata.

    Returns void

  • Sets a cell metadata.

    Parameters

    • metadata: string

      Cell's metadata key.

    • value: PartialJSONValue

      Metadata value

    Returns void

  • 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