@jupyterlab/cells

  • Version 3.5.0
  • Published
  • 212 kB
  • 24 dependencies
  • BSD-3-Clause license

Install

npm i @jupyterlab/cells
yarn add @jupyterlab/cells
pnpm add @jupyterlab/cells

Overview

cells

Index

Variables

Functions

Classes

Interfaces

Namespaces

Variables

variable MARKDOWN_HEADING_COLLAPSED

const MARKDOWN_HEADING_COLLAPSED: string;

    Functions

    function isCodeCellModel

    isCodeCellModel: (model: ICellModel) => model is ICodeCellModel;

      function isMarkdownCellModel

      isMarkdownCellModel: (model: ICellModel) => model is IMarkdownCellModel;

        function isRawCellModel

        isRawCellModel: (model: ICellModel) => model is IRawCellModel;

          Classes

          class AttachmentsCell

          abstract class AttachmentsCell<T extends IAttachmentsCellModel> extends Cell<T> {}
          • AttachmentsCell - A base class for a cell widget that allows attachments to be drag/drop'd or pasted onto it

          method handleEvent

          handleEvent: (event: Event) => void;
          • Handle the DOM events for the widget.

            Parameter event

            The DOM event sent to the widget.

            #### Notes This method implements the DOM EventListener interface and is called in response to events on the notebook panel's node. It should not be called directly by user code.

          method onAfterAttach

          protected onAfterAttach: (msg: Message) => void;
          • Handle after-attach messages for the widget.

          method onBeforeDetach

          protected onBeforeDetach: (msg: Message) => void;
          • A message handler invoked on a 'before-detach' message

          method updateCellSourceWithAttachment

          protected abstract updateCellSourceWithAttachment: (
          attachmentName: string,
          URI?: string
          ) => void;
          • Modify the cell source to include a reference to the attachment.

          class AttachmentsCellModel

          class AttachmentsCellModel extends CellModel {}
          • A base implementation for cell models with attachments.

          constructor

          constructor(options: AttachmentsCellModel.IOptions);
          • Construct a new cell with optional attachments.

          property attachments

          readonly attachments: IAttachmentsModel;
          • Get the attachments of the model.

          method toJSON

          toJSON: () => nbformat.IRawCell | nbformat.IMarkdownCell;
          • Serialize the model to JSON.

          class Cell

          class Cell<T extends ICellModel = ICellModel> extends Widget {}
          • A base cell widget.

          constructor

          constructor(options: Cell.IOptions<T>);
          • Construct a new base cell widget.

          property contentFactory

          readonly contentFactory: Cell.IContentFactory;
          • The content factory used by the widget.

          property displayChanged

          readonly displayChanged: ISignal<this, void>;
          • Signal to indicate that widget has changed visibly (in size, in type, etc)

          property editor

          readonly editor: CodeEditor.IEditor;
          • Get the CodeEditor used by the cell.

          property editorWidget

          readonly editorWidget: CodeEditorWrapper;
          • Get the CodeEditorWrapper used by the cell.

          property inputArea

          readonly inputArea: InputArea;
          • Get the input area for the cell.

          property inputHidden

          inputHidden: boolean;
          • The view state of input being hidden.

          property model

          readonly model: ICellModel;
          • Get the model used by the cell.

          property promptNode

          readonly promptNode: HTMLElement;
          • Get the prompt node used by the cell.

          property readOnly

          readOnly: boolean;
          • The read only state of the cell.

          property ready

          readonly ready: Promise<void>;
          • A promise that resolves when the widget renders for the first time.

          property syncCollapse

          syncCollapse: boolean;
          • Whether to sync the collapse state to the cell model.

          property syncEditable

          syncEditable: boolean;
          • Whether to sync the editable state to the cell model.

          method clone

          clone: () => Cell<T>;
          • Clone the cell, using the same model.

          method dispose

          dispose: () => void;
          • Dispose of the resources held by the widget.

          method handleInputHidden

          protected handleInputHidden: (value: boolean) => void;
          • Handle the input being hidden.

            #### Notes This is called by the inputHidden setter so that subclasses can perform actions upon the input being hidden without accessing private state.

          method initializeState

          initializeState: () => this;
          • Initialize view state from model.

            #### Notes Should be called after construction. For convenience, returns this, so it can be chained in the construction, like new Foo().initializeState();

          method loadCollapseState

          loadCollapseState: () => void;
          • Revert view collapse state from model.

          method loadEditableState

          loadEditableState: () => void;
          • Load view editable state from model.

          method onActivateRequest

          protected onActivateRequest: (msg: Message) => void;
          • Handle 'activate-request' messages.

          method onAfterAttach

          protected onAfterAttach: (msg: Message) => void;
          • Handle after-attach messages.

          method onFitRequest

          protected onFitRequest: (msg: Message) => void;
          • Handle fit-request messages.

          method onMetadataChanged

          protected onMetadataChanged: (
          model: IObservableJSON,
          args: IObservableMap.IChangedArgs<any>
          ) => void;
          • Handle changes in the metadata.

          method onResize

          protected onResize: (msg: Widget.ResizeMessage) => void;
          • Handle resize messages.

          method onUpdateRequest

          protected onUpdateRequest: (msg: Message) => void;
          • Handle update-request messages.

          method saveCollapseState

          saveCollapseState: () => void;
          • Save view collapse state to model

          method saveEditableState

          saveEditableState: () => void;
          • Save view editable state to model

          method setPrompt

          setPrompt: (value: string) => void;
          • Set the prompt for the widget.

          class CellFooter

          class CellFooter extends Widget implements ICellFooter {}
          • Default implementation of a cell footer.

          constructor

          constructor();
          • Construct a new cell footer.

          class CellHeader

          class CellHeader extends Widget implements ICellHeader {}
          • Default implementation of a cell header.

          constructor

          constructor();
          • Construct a new cell header.

          class CellModel

          class CellModel extends CodeEditor.Model implements ICellModel {}
          • An implementation of the cell model.

          constructor

          constructor(options: CellModel.IOptions);
          • Construct a cell model from optional cell content.

          property contentChanged

          readonly contentChanged: Signal<this, void>;
          • A signal emitted when the state of the model changes.

          property id

          readonly id: string;
          • The id for the cell.

          property metadata

          readonly metadata: IObservableJSON;
          • The metadata associated with the cell.

          property sharedModel

          sharedModel: models.ISharedCell;

            property stateChanged

            readonly stateChanged: Signal<this, IChangedArgs<any, any, string>>;
            • A signal emitted when a model state changes.

            property trusted

            trusted: boolean;
            • Get the trusted state of the model.

            property type

            readonly type: nbformat.CellType;
            • The type of cell.

            method onGenericChange

            protected onGenericChange: () => void;
            • Handle a change to the observable value.

            method onModelDBMetadataChange

            protected onModelDBMetadataChange: (
            sender: IObservableJSON,
            event: IObservableJSON.IChangedArgs
            ) => void;
            • Handle a change to the cell metadata modelDB and reflect it in the shared model.

            method onTrustedChanged

            onTrustedChanged: (
            trusted: IObservableValue,
            args: ObservableValue.IChangedArgs
            ) => void;
            • Handle a change to the trusted state.

              The default implementation is a no-op.

            method switchSharedModel

            switchSharedModel: (
            sharedModel: models.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).

              Parameter sharedModel

              Parameter reinitialize

              Whether to reinitialize the shared model.

            method toJSON

            toJSON: () => nbformat.ICell;
            • Serialize the model to JSON.

            class CodeCell

            class CodeCell extends Cell<ICodeCellModel> {}
            • A widget for a code cell.

            constructor

            constructor(options: CodeCell.IOptions);
            • Construct a code cell widget.

            property outputArea

            readonly outputArea: OutputArea;
            • Get the output area for the cell.

            property outputHidden

            outputHidden: boolean;
            • The view state of output being collapsed.

            property outputsScrolled

            outputsScrolled: boolean;
            • Whether the output is in a scrolled state?

            property syncScrolled

            syncScrolled: boolean;
            • Whether to sync the scrolled state to the cell model.

            method clone

            clone: () => CodeCell;
            • Clone the cell, using the same model.

            method cloneOutputArea

            cloneOutputArea: () => OutputArea;
            • Clone the OutputArea alone, returning a simplified output area, using the same model.

            method dispose

            dispose: () => void;
            • Dispose of the resources used by the widget.

            method handleInputHidden

            protected handleInputHidden: (value: boolean) => void;
            • Handle the input being hidden.

              #### Notes This method is called by the case cell implementation and is subclasses here so the code cell can watch to see when input is hidden without accessing private state.

            method initializeState

            initializeState: () => this;
            • Initialize view state from model.

              #### Notes Should be called after construction. For convenience, returns this, so it can be chained in the construction, like new Foo().initializeState();

            method loadCollapseState

            loadCollapseState: () => void;
            • Revert view collapse state from model.

              We consider the collapsed metadata key as the source of truth for outputs being hidden.

            method loadScrolledState

            loadScrolledState: () => void;
            • Revert view collapse state from model.

            method onMetadataChanged

            protected onMetadataChanged: (
            model: IObservableJSON,
            args: IObservableMap.IChangedArgs<JSONValue>
            ) => void;
            • Handle changes in the metadata.

            method onStateChanged

            protected onStateChanged: (model: ICellModel, args: IChangedArgs<any>) => void;
            • Handle changes in the model.

            method saveCollapseState

            saveCollapseState: () => void;
            • Save view collapse state to model

            method saveScrolledState

            saveScrolledState: () => void;
            • Save view collapse state to model

            class CodeCellModel

            class CodeCellModel extends CellModel implements ICodeCellModel {}
            • An implementation of a code cell Model.

            constructor

            constructor(options: CodeCellModel.IOptions);
            • Construct a new code cell with optional original cell content.

            property executionCount

            executionCount: nbformat.ExecutionCount;
            • The execution count of the cell.

            property isDirty

            readonly isDirty: boolean;
            • Whether the cell is dirty or not.

              A cell is dirty if it is output is not empty and does not result of the input code execution.

            property outputs

            readonly outputs: IOutputAreaModel;
            • The cell outputs.

            property type

            readonly type: string;
            • The type of the cell.

            method clearExecution

            clearExecution: () => void;

              method dispose

              dispose: () => void;
              • Dispose of the resources held by the model.

              method onModelDBOutputsChange

              protected onModelDBOutputsChange: (
              sender: IOutputAreaModel,
              event: IOutputAreaModel.ChangedArgs
              ) => void;
              • Handle a change to the cell outputs modelDB and reflect it in the shared model.

              method onTrustedChanged

              onTrustedChanged: (
              trusted: IObservableValue,
              args: ObservableValue.IChangedArgs
              ) => void;
              • Handle a change to the trusted state.

              method switchSharedModel

              switchSharedModel: (
              sharedModel: models.ISharedCodeCell,
              reinitialize?: boolean
              ) => void;

                method toJSON

                toJSON: () => nbformat.ICodeCell;
                • Serialize the model to JSON.

                class Collapser

                abstract class Collapser extends ReactWidget {}
                • Abstract collapser base class.

                  ### Notes A collapser is a visible div to the left of a cell's input/output that a user can click on to collapse the input/output.

                constructor

                constructor();
                • Construct a new collapser.

                property collapsed

                readonly collapsed: boolean;
                • Is the input/output of the parent collapsed.

                method handleClick

                protected abstract handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
                • Handle the click event.

                method render

                protected render: () => React.ReactElement<any>;
                • Render the collapser with the virtual DOM.

                class InputArea

                class InputArea extends Widget {}
                • An input area widget, which hosts a prompt and an editor widget.

                constructor

                constructor(options: InputArea.IOptions);
                • Construct an input area widget.

                property contentFactory

                readonly contentFactory: InputArea.IContentFactory;
                • The content factory used by the widget.

                property editor

                readonly editor: CodeEditor.IEditor;
                • Get the CodeEditor used by the cell.

                property editorWidget

                readonly editorWidget: CodeEditorWrapper;
                • Get the CodeEditorWrapper used by the cell.

                property model

                readonly model: ICellModel;
                • The model used by the widget.

                property promptNode

                readonly promptNode: HTMLElement;
                • Get the prompt node used by the cell.

                property renderedInput

                readonly renderedInput: Widget;
                • Get the rendered input area widget, if any.

                method dispose

                dispose: () => void;
                • Dispose of the resources held by the widget.

                method renderInput

                renderInput: (widget: Widget) => void;
                • Render an input instead of the text editor.

                method setPrompt

                setPrompt: (value: string) => void;
                • Set the prompt of the input area.

                method showEditor

                showEditor: () => void;
                • Show the text editor.

                class InputCollapser

                class InputCollapser extends Collapser {}
                • A collapser subclass to collapse a cell's input area.

                constructor

                constructor();
                • Construct a new input collapser.

                property collapsed

                readonly collapsed: boolean;
                • Is the cell's input collapsed?

                method handleClick

                protected handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
                • Handle a click event for the user to collapse the cell's input.

                class InputPlaceholder

                class InputPlaceholder extends Placeholder {}
                • The input placeholder class.

                constructor

                constructor(callback: (e: React.MouseEvent<HTMLDivElement>) => void);
                • Construct a new input placeholder.

                method render

                protected render: () => React.ReactElement<any>[];
                • Render the input placeholder using the virtual DOM.

                class InputPrompt

                class InputPrompt extends Widget implements IInputPrompt {}
                • The default input prompt implementation.

                constructor

                constructor();

                  property executionCount

                  executionCount: string;
                  • The execution count for the prompt.

                  class MarkdownCell

                  class MarkdownCell extends AttachmentsCell<IMarkdownCellModel> {}
                  • A widget for a Markdown cell.

                    #### Notes Things get complicated if we want the rendered text to update any time the text changes, the text editor model changes, or the input area model changes. We don't support automatically updating the rendered text in all of these cases.

                  constructor

                  constructor(options: MarkdownCell.IOptions);
                  • Construct a Markdown cell widget.

                  property headingCollapsed

                  headingCollapsed: boolean;

                    property headingInfo

                    readonly headingInfo: { text: string; level: number };
                    • Text that represents the heading if cell is a heading. Returns empty string if not a heading.

                    property numberChildNodes

                    numberChildNodes: number;

                      property ready

                      readonly ready: Promise<void>;
                      • A promise that resolves when the widget renders for the first time.

                      property rendered

                      rendered: boolean;
                      • Whether the cell is rendered.

                      property showEditorForReadOnly

                      showEditorForReadOnly: boolean;

                        property toggleCollapsedSignal

                        readonly toggleCollapsedSignal: Signal<this, boolean>;

                          method clone

                          clone: () => MarkdownCell;
                          • Clone the cell, using the same model.

                          method dispose

                          dispose: () => void;

                            method maybeCreateCollapseButton

                            protected maybeCreateCollapseButton: () => void;

                              method maybeCreateOrUpdateExpandButton

                              protected maybeCreateOrUpdateExpandButton: () => void;

                                method onUpdateRequest

                                protected onUpdateRequest: (msg: Message) => void;

                                  method renderCollapseButtons

                                  protected renderCollapseButtons: (widget: Widget) => void;
                                  • Render the collapse button for heading cells, and for collapsed heading cells render the "expand hidden cells" button.

                                  method renderInput

                                  protected renderInput: (widget: Widget) => void;
                                  • Render an input instead of the text editor.

                                  method showEditor

                                  protected showEditor: () => void;
                                  • Show the text editor instead of rendered input.

                                  method updateCellSourceWithAttachment

                                  protected updateCellSourceWithAttachment: (
                                  attachmentName: string,
                                  URI?: string
                                  ) => void;
                                  • Modify the cell source to include a reference to the attachment.

                                  class MarkdownCellModel

                                  class MarkdownCellModel extends AttachmentsCellModel {}
                                  • An implementation of a markdown cell model.

                                  constructor

                                  constructor(options: CellModel.IOptions);
                                  • Construct a markdown cell model from optional cell content.

                                  property type

                                  readonly type: string;
                                  • The type of the cell.

                                  method toJSON

                                  toJSON: () => nbformat.IMarkdownCell;
                                  • Serialize the model to JSON.

                                  class OutputCollapser

                                  class OutputCollapser extends Collapser {}
                                  • A collapser subclass to collapse a cell's output area.

                                  constructor

                                  constructor();
                                  • Construct a new output collapser.

                                  property collapsed

                                  readonly collapsed: boolean;
                                  • Is the cell's output collapsed?

                                  method handleClick

                                  protected handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
                                  • Handle a click event for the user to collapse the cell's output.

                                  class OutputPlaceholder

                                  class OutputPlaceholder extends Placeholder {}
                                  • The output placeholder class.

                                  constructor

                                  constructor(callback: (e: React.MouseEvent<HTMLDivElement>) => void);
                                  • Construct a new output placeholder.

                                  method render

                                  protected render: () => React.ReactElement<any>[];
                                  • Render the output placeholder using the virtual DOM.

                                  class Placeholder

                                  abstract class Placeholder extends ReactWidget {}
                                  • An abstract base class for placeholders

                                    ### Notes A placeholder is the element that is shown when input/output is hidden.

                                  constructor

                                  constructor(callback: (e: React.MouseEvent<HTMLDivElement>) => void);
                                  • Construct a new placeholder.

                                  method handleClick

                                  protected handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
                                  • Handle the click event.

                                  class RawCell

                                  class RawCell extends Cell<IRawCellModel> {}
                                  • A widget for a raw cell.

                                  constructor

                                  constructor(options: RawCell.IOptions);
                                  • Construct a raw cell widget.

                                  method clone

                                  clone: () => RawCell;
                                  • Clone the cell, using the same model.

                                  class RawCellModel

                                  class RawCellModel extends AttachmentsCellModel {}
                                  • An implementation of a raw cell model.

                                  property type

                                  readonly type: string;
                                  • The type of the cell.

                                  method toJSON

                                  toJSON: () => nbformat.IRawCell;
                                  • Serialize the model to JSON.

                                  Interfaces

                                  interface IAttachmentsCellModel

                                  interface IAttachmentsCellModel extends ICellModel {}
                                  • The definition of a model cell object for a cell with attachments.

                                  property attachments

                                  readonly attachments: IAttachmentsModel;
                                  • The cell attachments

                                  interface ICellFooter

                                  interface ICellFooter extends Widget {}
                                  • The interface for a cell footer.

                                  interface ICellHeader

                                  interface ICellHeader extends Widget {}
                                  • The interface for a cell header.

                                  interface ICellModel

                                  interface ICellModel extends CodeEditor.IModel {}
                                  • The definition of a model object for a cell.

                                  property contentChanged

                                  readonly contentChanged: ISignal<ICellModel, void>;
                                  • A signal emitted when the content of the model changes.

                                  property id

                                  readonly id: string;
                                  • A unique identifier for the cell.

                                  property metadata

                                  readonly metadata: IObservableJSON;
                                  • The metadata associated with the cell.

                                  property sharedModel

                                  readonly sharedModel: models.ISharedCell & models.ISharedText;

                                    property stateChanged

                                    readonly stateChanged: ISignal<ICellModel, IChangedArgs<any>>;
                                    • A signal emitted when a model state changes.

                                    property trusted

                                    trusted: boolean;
                                    • Whether the cell is trusted.

                                    property type

                                    readonly type: nbformat.CellType;
                                    • The type of the cell.

                                    method toJSON

                                    toJSON: () => nbformat.ICell;
                                    • Serialize the model to JSON.

                                    interface ICodeCellModel

                                    interface ICodeCellModel extends ICellModel {}
                                    • The definition of a code cell.

                                    property executionCount

                                    executionCount: nbformat.ExecutionCount;
                                    • The code cell's prompt number. Will be null if the cell has not been run.

                                    property isDirty

                                    readonly isDirty: boolean;
                                    • Whether the code cell has been edited since the last run.

                                    property outputs

                                    readonly outputs: IOutputAreaModel;
                                    • The cell outputs.

                                    property type

                                    readonly type: 'code';
                                    • The type of the cell.

                                      #### Notes This is a read-only property.

                                    method clearExecution

                                    clearExecution: () => void;
                                    • Clear execution, outputs, and related metadata

                                    method toJSON

                                    toJSON: () => nbformat.ICodeCell;
                                    • Serialize the model to JSON.

                                    interface IInputPrompt

                                    interface IInputPrompt extends Widget {}
                                    • The interface for the input prompt.

                                    property executionCount

                                    executionCount: string | null;
                                    • The execution count of the prompt.

                                    interface IMarkdownCellModel

                                    interface IMarkdownCellModel extends IAttachmentsCellModel {}
                                    • The definition of a markdown cell.

                                    property type

                                    readonly type: 'markdown';
                                    • The type of the cell.

                                    method toJSON

                                    toJSON: () => nbformat.IMarkdownCell;
                                    • Serialize the model to JSON.

                                    interface IRawCellModel

                                    interface IRawCellModel extends IAttachmentsCellModel {}
                                    • The definition of a raw cell.

                                    property type

                                    readonly type: 'raw';
                                    • The type of the cell.

                                    method toJSON

                                    toJSON: () => nbformat.IRawCell;
                                    • Serialize the model to JSON.

                                    Namespaces

                                    namespace AttachmentsCellModel

                                    namespace AttachmentsCellModel {}
                                    • The namespace for AttachmentsCellModel statics.

                                    variable defaultContentFactory

                                    const defaultContentFactory: ContentFactory;
                                    • The shared ContentFactory instance.

                                    class ContentFactory

                                    class ContentFactory implements IContentFactory {}
                                    • The default implementation of an IContentFactory.

                                    method createAttachmentsModel

                                    createAttachmentsModel: (
                                    options: IAttachmentsModel.IOptions
                                    ) => IAttachmentsModel;
                                    • Create an attachments model.

                                    interface IContentFactory

                                    interface IContentFactory {}
                                    • A factory for creating code cell model content.

                                    method createAttachmentsModel

                                    createAttachmentsModel: (
                                    options: IAttachmentsModel.IOptions
                                    ) => IAttachmentsModel;
                                    • Create an output area.

                                    interface IOptions

                                    interface IOptions extends CellModel.IOptions {}
                                    • The options used to initialize a AttachmentsCellModel.

                                    property contentFactory

                                    contentFactory?: IContentFactory;
                                    • The factory for attachment model creation.

                                    namespace Cell

                                    namespace Cell {}
                                    • The namespace for the Cell class statics.

                                    variable defaultContentFactory

                                    const defaultContentFactory: ContentFactory;
                                    • The default content factory for cells.

                                    class ContentFactory

                                    class ContentFactory implements IContentFactory {}
                                    • The default implementation of an IContentFactory.

                                      This includes a CodeMirror editor factory to make it easy to use out of the box.

                                    constructor

                                    constructor(options?: ContentFactory.IOptions);
                                    • Create a content factory for a cell.

                                    property editorFactory

                                    readonly editorFactory: CodeEditor.Factory;
                                    • The readonly editor factory that create code editors

                                    method createCellFooter

                                    createCellFooter: () => ICellFooter;
                                    • Create a new cell header for the parent widget.

                                    method createCellHeader

                                    createCellHeader: () => ICellHeader;
                                    • Create a new cell header for the parent widget.

                                    method createInputPrompt

                                    createInputPrompt: () => IInputPrompt;
                                    • Create an input prompt.

                                    method createOutputPrompt

                                    createOutputPrompt: () => IOutputPrompt;
                                    • Create the output prompt for the widget.

                                    method createStdin

                                    createStdin: (options: Stdin.IOptions) => IStdin;
                                    • Create an stdin widget.

                                    interface IContentFactory

                                    interface IContentFactory
                                    extends OutputArea.IContentFactory,
                                    InputArea.IContentFactory {}
                                    • The factory object for customizable cell children.

                                      This is used to allow users of cells to customize child content.

                                      This inherits from OutputArea.IContentFactory to avoid needless nesting and provide a single factory object for all notebook/cell/outputarea related widgets.

                                    method createCellFooter

                                    createCellFooter: () => ICellFooter;
                                    • Create a new cell header for the parent widget.

                                    method createCellHeader

                                    createCellHeader: () => ICellHeader;
                                    • Create a new cell header for the parent widget.

                                    interface IOptions

                                    interface IOptions<T extends ICellModel> {}
                                    • An options object for initializing a cell widget.

                                    property contentFactory

                                    contentFactory?: IContentFactory;
                                    • The factory object for customizable cell children.

                                    property editorConfig

                                    editorConfig?: Partial<CodeEditor.IConfig>;
                                    • The configuration options for the text editor widget.

                                    property maxNumberOutputs

                                    maxNumberOutputs?: number;
                                    • The maximum number of output items to display in cell output.

                                    property model

                                    model: T;
                                    • The model used by the cell.

                                    property placeholder

                                    placeholder?: boolean;
                                    • Whether this cell is a placeholder for future rendering.

                                    property updateEditorOnShow

                                    updateEditorOnShow?: boolean;
                                    • Whether to send an update request to the editor when it is shown.

                                    namespace Cell.ContentFactory

                                    namespace Cell.ContentFactory {}
                                    • A namespace for cell content factory.

                                    interface IOptions

                                    interface IOptions {}
                                    • Options for the content factory.

                                    property editorFactory

                                    editorFactory?: CodeEditor.Factory;
                                    • The editor factory used by the content factory.

                                      If this is not passed, a default CodeMirror editor factory will be used.

                                    namespace CellDragUtils

                                    namespace CellDragUtils {}

                                      function createCellDragImage

                                      createCellDragImage: (
                                      activeCell: Cell,
                                      selectedCells: nbformat.ICell[]
                                      ) => HTMLElement;
                                      • Create an image for the cell(s) to be dragged

                                        Parameter activeCell

                                        The cell from where the drag event is triggered

                                        Parameter selectedCells

                                        The cells to be dragged

                                      function detectTargetArea

                                      detectTargetArea: (cell: Cell, target: HTMLElement) => ICellTargetArea;
                                      • Detect which part of the cell triggered the MouseEvent

                                        Parameter cell

                                        The cell which contains the MouseEvent's target

                                        Parameter target

                                        The DOM node which triggered the MouseEvent

                                      function findCell

                                      findCell: (
                                      node: HTMLElement,
                                      cells: IterableOrArrayLike<Cell<ICellModel>>,
                                      isCellNode: (node: HTMLElement) => boolean
                                      ) => number;
                                      • Find the cell index containing the target html element. This function traces up the DOM hierarchy to find the root cell node. Then find the corresponding child and select it.

                                        Parameter node

                                        the cell node or a child of the cell node.

                                        Parameter cells

                                        an iterable of Cells

                                        Parameter isCellNode

                                        a function that takes in a node and checks if it is a cell node.

                                        Returns

                                        index of the cell we're looking for. Returns -1 if the cell is not founds

                                      function shouldStartDrag

                                      shouldStartDrag: (
                                      prevX: number,
                                      prevY: number,
                                      nextX: number,
                                      nextY: number
                                      ) => boolean;
                                      • Detect if a drag event should be started. This is down if the mouse is moved beyond a certain distance (DRAG_THRESHOLD).

                                        Parameter prevX

                                        X Coordinate of the mouse pointer during the mousedown event

                                        Parameter prevY

                                        Y Coordinate of the mouse pointer during the mousedown event

                                        Parameter nextX

                                        Current X Coordinate of the mouse pointer

                                        Parameter nextY

                                        Current Y Coordinate of the mouse pointer

                                      type ICellTargetArea

                                      type ICellTargetArea = 'input' | 'prompt' | 'cell' | 'unknown';

                                        namespace CellModel

                                        namespace CellModel {}
                                        • The namespace for CellModel statics.

                                        interface IOptions

                                        interface IOptions {}
                                        • The options used to initialize a CellModel.

                                        property cell

                                        cell?: nbformat.IBaseCell;
                                        • The source cell data.

                                        property id

                                        id?: string;
                                        • A unique identifier for this cell.

                                        property modelDB

                                        modelDB?: IModelDB;
                                        • An IModelDB in which to store cell data.

                                        namespace CodeCell

                                        namespace CodeCell {}
                                        • The namespace for the CodeCell class statics.

                                        function execute

                                        execute: (
                                        cell: CodeCell,
                                        sessionContext: ISessionContext,
                                        metadata?: JSONObject
                                        ) => Promise<KernelMessage.IExecuteReplyMsg | void>;
                                        • Execute a cell given a client session.

                                        interface IOptions

                                        interface IOptions extends Cell.IOptions<ICodeCellModel> {}
                                        • An options object for initializing a base cell widget.

                                        property rendermime

                                        rendermime: IRenderMimeRegistry;
                                        • The mime renderer for the cell widget.

                                        namespace CodeCellModel

                                        namespace CodeCellModel {}
                                        • The namespace for CodeCellModel statics.

                                        variable defaultContentFactory

                                        const defaultContentFactory: ContentFactory;
                                        • The shared ContentFactory instance.

                                        class ContentFactory

                                        class ContentFactory implements IContentFactory {}
                                        • The default implementation of an IContentFactory.

                                        method createOutputArea

                                        createOutputArea: (options: IOutputAreaModel.IOptions) => IOutputAreaModel;
                                        • Create an output area.

                                        interface IContentFactory

                                        interface IContentFactory {}
                                        • A factory for creating code cell model content.

                                        method createOutputArea

                                        createOutputArea: (options: IOutputAreaModel.IOptions) => IOutputAreaModel;
                                        • Create an output area.

                                        interface IOptions

                                        interface IOptions extends CellModel.IOptions {}
                                        • The options used to initialize a CodeCellModel.

                                        property contentFactory

                                        contentFactory?: IContentFactory;
                                        • The factory for output area model creation.

                                        namespace InputArea

                                        namespace InputArea {}
                                        • A namespace for InputArea statics.

                                        variable defaultContentFactory

                                        const defaultContentFactory: ContentFactory;
                                        • The default ContentFactory instance.

                                        variable defaultEditorFactory

                                        const defaultEditorFactory: CodeEditor.Factory;
                                        • The default editor factory singleton based on CodeMirror.

                                        class ContentFactory

                                        class ContentFactory implements IContentFactory {}
                                        • Default implementation of IContentFactory.

                                          This defaults to using an editorFactory based on CodeMirror.

                                        constructor

                                        constructor(options?: ContentFactory.IOptions);
                                        • Construct a ContentFactory.

                                        property editorFactory

                                        readonly editorFactory: CodeEditor.Factory;
                                        • Return the CodeEditor.Factory being used.

                                        method createInputPrompt

                                        createInputPrompt: () => IInputPrompt;
                                        • Create an input prompt.

                                        interface IContentFactory

                                        interface IContentFactory {}
                                        • An input area widget content factory.

                                          The content factory is used to create children in a way that can be customized.

                                        property editorFactory

                                        readonly editorFactory: CodeEditor.Factory;
                                        • The editor factory we need to include in CodeEditorWrapper.IOptions.

                                          This is a separate readonly attribute rather than a factory method as we need to pass it around.

                                        method createInputPrompt

                                        createInputPrompt: () => IInputPrompt;
                                        • Create an input prompt.

                                        interface IOptions

                                        interface IOptions {}
                                        • The options used to create an InputArea.

                                        property contentFactory

                                        contentFactory?: IContentFactory;
                                        • The content factory used by the widget to create children.

                                          Defaults to one that uses CodeMirror.

                                        property model

                                        model: ICellModel;
                                        • The model used by the widget.

                                        property placeholder

                                        placeholder?: boolean;
                                        • Whether this input area is a placeholder for future rendering.

                                        property updateOnShow

                                        updateOnShow?: boolean;
                                        • Whether to send an update request to the editor when it is shown.

                                        namespace InputArea.ContentFactory

                                        namespace InputArea.ContentFactory {}
                                        • A namespace for the input area content factory.

                                        interface IOptions

                                        interface IOptions {}
                                        • Options for the content factory.

                                        property editorFactory

                                        editorFactory?: CodeEditor.Factory;
                                        • The editor factory used by the content factory.

                                          If this is not passed, a default CodeMirror editor factory will be used.

                                        namespace MarkdownCell

                                        namespace MarkdownCell {}
                                        • The namespace for the CodeCell class statics.

                                        variable defaultShowEditorForReadOnlyMarkdown

                                        const defaultShowEditorForReadOnlyMarkdown: boolean;
                                        • Default value for showEditorForReadOnlyMarkdown.

                                        interface IOptions

                                        interface IOptions extends Cell.IOptions<IMarkdownCellModel> {}
                                        • An options object for initializing a base cell widget.

                                        property rendermime

                                        rendermime: IRenderMimeRegistry;
                                        • The mime renderer for the cell widget.

                                        property showEditorForReadOnlyMarkdown

                                        showEditorForReadOnlyMarkdown?: boolean;
                                        • Show editor for read-only Markdown cells.

                                        namespace RawCell

                                        namespace RawCell {}
                                        • The namespace for the RawCell class statics.

                                        interface IOptions

                                        interface IOptions extends Cell.IOptions<IRawCellModel> {}
                                        • An options object for initializing a base cell widget.

                                        Package Files (8)

                                        Dependencies (24)

                                        Dev Dependencies (9)

                                        Peer Dependencies (0)

                                        No peer dependencies.

                                        Badge

                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@jupyterlab/cells.

                                        • Markdown
                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@jupyterlab/cells)
                                        • HTML
                                          <a href="https://www.jsdocs.io/package/@jupyterlab/cells"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>