Class YNotebook

Shared implementation of the Shared Document types.

Shared cells can be inserted into a SharedNotebook. Shared cells only start emitting events when they are connected to a SharedNotebook.

"Standalone" cells must not be inserted into a (Shared)Notebook. Standalone cells emit events immediately after they have been created, but they must not be included into a (Shared)Notebook.

Hierarchy

Implements

Constructors

Properties

_changed: Signal<YNotebook, NotebookChange> = ...
_disableDocumentWideUndoRedo: boolean
_metadataChanged: Signal<YNotebook, IMapChange<any>> = ...
_ycellMapping: WeakMap<YMap<any>, YCellType> = ...
_ycells: YArray<YMap<any>> = ...

Internal Yjs cells list

cells: YCellType[]

Cells list

version: string = '1.0.0'

Document version

ymeta: YMap<any> = ...

YJS map for the notebook metadata

Accessors

  • get awareness(): Awareness
  • Shared awareness

    Returns Awareness

  • get disposed(): ISignal<this, void>
  • A signal emitted when the document is disposed.

    Returns ISignal<this, void>

  • get undoManager(): UndoManager
  • YJS document undo manager

    Returns UndoManager

  • get ydoc(): Doc
  • YJS document.

    Returns Doc

  • get ystate(): YMap<any>
  • Shared state

    Returns YMap<any>

Methods

  • Handle a change to the ystate.

    Parameters

    • events: YEvent<any>[]

    Returns void

  • Handle a change to the list of cells.

    Parameters

    • event: YArrayEvent<YMap<any>>

    Returns void

  • Override the notebook with a JSON-serialized document.

    Parameters

    • value: INotebookContent

      The notebook

    Returns void

  • Returns some metadata associated with the notebook.

    If no key is provided, it will return all metadata. Else it will return the value for that key.

    Returns

    Notebook's metadata.

    Returns INotebookMetadata

  • Returns a metadata associated with the notebook.

    Returns

    Notebook's metadata.

    Parameters

    • key: string

      Key to get from the metadata

    Returns undefined | PartialJSONValue

  • Move cells.

    Parameters

    • fromIndex: number
    • toIndex: number
    • n: number = 1

    Returns void

  • Sets some metadata associated with the notebook.

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

    Parameters

    • metadata: INotebookMetadata

      All Notebook's metadata or the key to set.

    Returns void

  • Sets a metadata associated with the notebook.

    Parameters

    • metadata: string

      The key to set.

    • value: PartialJSONValue

      New metadata value

    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)
        • (): void
        • Returns void

    • undoable: boolean = true

    Returns void

  • Updates the metadata associated with the notebook.

    Parameters

    • value: Partial<INotebookMetadata>

    Returns void

Generated using TypeDoc