@jupyter/ydoc
    Preparing search index...

    Interface ISharedNotebook

    Implements an API for nbformat.INotebookContent

    interface ISharedNotebook {
        awareness: Awareness;
        cells: ISharedCell[];
        changed: ISignal<ISharedNotebook, NotebookChange>;
        dirty: boolean;
        disableDocumentWideUndoRedo?: boolean;
        disposed: ISignal<ISharedNotebook, void>;
        isDisposed: boolean;
        metadata: INotebookMetadata;
        metadataChanged: ISignal<ISharedNotebook, IMapChange<any>>;
        nbformat: number;
        nbformat_minor: number;
        state: JSONObject;
        version: string;
        addCell(cell: Cell): ISharedCell;
        canRedo(): boolean;
        canUndo(): boolean;
        clearUndoHistory(): void;
        deleteCell(index: number): void;
        deleteCellRange(from: number, to: number): void;
        deleteMetadata(key: string): void;
        dispose(): void;
        fromJSON(value: INotebookContent): void;
        getCell(index: number): ISharedCell;
        getMetadata(): INotebookMetadata;
        getMetadata(key: string): PartialJSONValue | undefined;
        getSource(): JSONValue;
        getState(key: string): JSONValue | undefined;
        insertCell(index: number, cell: Cell): ISharedCell;
        insertCells(index: number, cells: Cell[]): ISharedCell[];
        moveCell(fromIndex: number, toIndex: number): void;
        moveCells(fromIndex: number, toIndex: number, n?: number): void;
        redo(): boolean;
        setMetadata(metadata: INotebookMetadata): void;
        setMetadata(metadata: string, value: PartialJSONValue): void;
        setSource(value: JSONValue): void;
        setState(key: string, value: JSONValue): void;
        toJSON(): INotebookContent;
        transact(f: () => void, undoable?: boolean, origin?: any): void;
        undo(): boolean;
        updateMetadata(value: Partial<nbformat.INotebookMetadata>): void;
    }

    Hierarchy (View Summary)

    Implemented by

    Index
    awareness: Awareness

    Document awareness

    cells: ISharedCell[]

    The list of shared cells in the notebook.

    The changed signal.

    dirty: boolean

    Document dirty state

    disableDocumentWideUndoRedo?: boolean

    Wether the undo/redo logic should be considered on the full document across all cells.

    disposed: ISignal<ISharedNotebook, void>

    A signal emitted when the object is disposed.

    isDisposed: boolean

    Test whether the object has been disposed.

    This property is always safe to access.

    Notebook metadata.

    metadataChanged: ISignal<ISharedNotebook, IMapChange<any>>

    Signal triggered when a metadata changes.

    nbformat: number

    The major version number of the nbformat.

    nbformat_minor: number

    The minor version number of the nbformat.

    state: JSONObject

    Document state

    version: string

    Document version

    • Remove a cell.

      Parameters

      • index: number

        Index of the cell to remove.

      Returns void

    • Remove a range of cells.

      Parameters

      • from: number

        The start index of the range to remove (inclusive).

      • to: number

        The end index of the range to remove (exclusive).

      Returns void

    • Delete a metadata notebook.

      Parameters

      • key: string

        The key to delete

      Returns void

    • Dispose of the resources held by the object.

      If the object's dispose method is called more than once, all calls made after the first will be a no-op.

      It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

      Returns void

    • Insert a list of shared cells into a specific position.

      Parameters

      • index: number

        Position to insert the cells.

      • cells: Cell[]

        Array of shared cells to insert.

      Returns ISharedCell[]

      The inserted cells.

    • Move a cell.

      Parameters

      • fromIndex: number

        Index of the cell to move.

      • toIndex: number

        New position of the cell.

      Returns void

    • Move cells.

      Parameters

      • fromIndex: number

        Index of the first cells to move.

      • toIndex: number

        New position of the first cell (in the current array).

      • Optionaln: number

        Number of cells to move (default 1)

      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

      • Optionalundoable: boolean

        Whether to track the change in the action history or not (default true)

      • Optionalorigin: any

      Returns void