Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CellModel

An implementation of the cell model.

Hierarchy

Implements

Index

Constructors

constructor

  • Construct a cell model from optional cell content.

    Parameters

    Returns CellModel

Properties

Private _changeCellMetadata

_changeCellMetadata: any

Change the cell metadata for a given event.

param

The cell metadata.

param

The event to handle.

Private _updateModelDBMetadata

_updateModelDBMetadata: any

Readonly contentChanged

contentChanged: Signal<CellModel, void>

A signal emitted when the state of the model changes.

Readonly modelDB

modelDB: IModelDB

The underlying IModelDB instance in which model data is stored.

sharedModel

sharedModel: ISharedCell

Readonly stateChanged

stateChanged: Signal<CellModel, IChangedArgs<any, any, string>>

A signal emitted when a model state changes.

Accessors

id

  • get id(): string
  • The id for the cell.

    Returns string

isDisposed

  • get isDisposed(): boolean
  • Whether the model is disposed.

    Returns boolean

metadata

mimeType

  • get mimeType(): string
  • set mimeType(newValue: string): void
  • A mime type of the model.

    Returns string

  • A mime type of the model.

    Notes

    It is never null, the default mime type is text/plain.

    Parameters

    • newValue: string

    Returns void

mimeTypeChanged

  • get mimeTypeChanged(): ISignal<this, IChangedArgs<string, string, string>>
  • A signal emitted when a mimetype changes.

    Returns ISignal<this, IChangedArgs<string, string, string>>

selections

sharedModelSwitched

  • get sharedModelSwitched(): ISignal<this, boolean>
  • A signal emitted when the shared model was switched.

    Returns ISignal<this, boolean>

trusted

  • get trusted(): boolean
  • set trusted(newValue: boolean): void
  • Get the trusted state of the model.

    Returns boolean

  • Set the trusted state of the model.

    Parameters

    • newValue: boolean

    Returns void

type

  • The type of cell.

    Returns CellType

value

Methods

Protected _onSharedModelChanged

  • _onSharedModelChanged(sender: ISharedCodeCell, change: CellChange<ISharedBaseCellMetadata>): void
  • Handle a change to the cell shared model and reflect it in modelDB. We update the modeldb metadata when the shared model changes.

    This method overrides the CodeEditor protected _onSharedModelChanged so we first call super._onSharedModelChanged

    override

    CodeEditor._onSharedModelChanged

    Parameters

    • sender: ISharedCodeCell
    • change: CellChange<ISharedBaseCellMetadata>

    Returns void

dispose

  • dispose(): void
  • Dispose of the resources used by the model.

    Returns void

Protected onGenericChange

  • onGenericChange(): void
  • Handle a change to the observable value.

    Returns void

Protected onModelDBMetadataChange

  • Handle a change to the cell metadata modelDB and reflect it in the shared model.

    Parameters

    Returns void

onTrustedChanged

  • Handle a change to the trusted state.

    The default implementation is a no-op.

    Parameters

    Returns void

switchSharedModel

  • switchSharedModel(sharedModel: ISharedCodeCell, reinitialize?: boolean): void
  • When we initialize a cell model, we create a standalone model that cannot be shared in a YNotebook. Call this function to re-initialize the local representation based on a fresh shared model (e.g. models.YFile or models.YCodeCell).

    Parameters

    • sharedModel: ISharedCodeCell
    • Optional reinitialize: boolean

      Whether to reinitialize the shared model.

    Returns void

toJSON

  • Serialize the model to JSON.

    Returns ICell

Generated using TypeDoc