Options
All
  • Public
  • Public/Protected
  • All
Menu

Class YBaseCell<Metadata>

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

  • new YBaseCell<Metadata>(ymodel: YMap<any>): YBaseCell<Metadata>
  • Type parameters

    Parameters

    • ymodel: YMap<any>

    Returns YBaseCell<Metadata>

Properties

Private _changed

_changed: any

Private _modelObserver

_modelObserver: any

Handle a change to the ymodel.

Protected _notebook

_notebook: YNotebook

The notebook that this cell belongs to.

Private _prevSourceLength

_prevSourceLength: any

Private _undoManager

_undoManager: any

isDisposed

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

isStandalone

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.

ymodel

ymodel: YMap<any>

Accessors

awareness

  • get awareness(): Awareness
  • Returns Awareness

cell_type

  • get cell_type(): any
  • The type of the cell.

    Returns any

changed

  • get changed(): ISignal<this, CellChange<Metadata>>
  • The changed signal.

    Returns ISignal<this, CellChange<Metadata>>

notebook

  • The notebook that this cell belongs to.

    Returns YNotebook

undoManager

  • get undoManager(): UndoManager
  • set undoManager(undoManager: UndoManager): void
  • The notebook that this cell belongs to.

    Returns UndoManager

  • Set the undoManager when adding new cells.

    Parameters

    • undoManager: UndoManager

    Returns void

ysource

  • get ysource(): YText
  • Returns YText

Methods

canRedo

  • canRedo(): boolean
  • Whether the object can redo changes.

    Returns boolean

canUndo

  • canUndo(): boolean
  • Whether the object can undo changes.

    Returns boolean

clearUndoHistory

  • clearUndoHistory(): void
  • Clear the change stack.

    Returns void

clone

  • Clone the cell.

    todo

    clone should only be available in the specific implementations i.e. ISharedCodeCell

    Returns YBaseCell<any>

dispose

  • dispose(): void
  • Dispose of the resources.

    Returns void

getAttachments

  • getAttachments(): IAttachments
  • Gets the cell attachments.

    Returns IAttachments

    The cell attachments.

getId

  • getId(): string
  • Get cell id.

    Returns string

    Cell id

getMetadata

  • getMetadata(): Partial<Metadata>
  • Returns the metadata associated with the notebook.

    Returns Partial<Metadata>

    Notebook's metadata.

getSource

  • getSource(): string
  • Gets cell's source.

    Returns string

    Cell's source.

redo

  • redo(): void
  • Redo an operation.

    Returns void

setAttachments

  • setAttachments(attachments: IAttachments): void
  • Sets the cell attachments

    Parameters

    • attachments: IAttachments

    Returns void

setMetadata

  • setMetadata(value: Partial<Metadata>): void
  • Sets the metadata associated with the notebook.

    Parameters

    • value: Partial<Metadata>

    Returns void

setSource

  • setSource(value: string): void
  • Sets cell's source.

    Parameters

    • value: string

    Returns void

toJSON

  • toJSON(): IBaseCell
  • Serialize the model to JSON.

    Returns IBaseCell

transact

  • transact(f: () => void, undoable?: boolean): 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
        • (): void
        • Returns void

    • Optional undoable: boolean

    Returns void

undo

  • undo(): void
  • Undo an operation.

    Returns void

updateSource

  • updateSource(start: number, end: number, value?: string): void
  • Replace content from start' to endwithvalue`.

    Parameters

    • start: number
    • end: number
    • Optional value: string

    Returns void

Static create

  • Create a new YRawCell that can be inserted into a YNotebook

    Parameters

    • Optional id: string

    Returns YBaseCell<any>

Static createStandalone

  • createStandalone(id?: string): YBaseCell<any>
  • 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 YBaseCell<any>

Generated using TypeDoc