@jupyterlab/notebook
- Version 4.3.5
- Published
- 1.21 MB
- 30 dependencies
- BSD-3-Clause license
Install
npm i @jupyterlab/notebook
yarn add @jupyterlab/notebook
pnpm add @jupyterlab/notebook
Overview
notebook
Index
Variables
Functions
Classes
Notebook
- activeCell
- activeCellChanged
- activeCellIndex
- addFooter()
- deselect()
- deselectAll()
- dispose()
- extendContiguousSelectionTo()
- getContiguousSelection()
- handleEvent()
- isSelected()
- isSelectedOrActive()
- lastClipboardInteraction
- mode
- moveCell()
- onActivateRequest()
- onAfterAttach()
- onAfterShow()
- onBeforeDetach()
- onBeforeHide()
- onCellInserted()
- onCellRemoved()
- onModelChanged()
- onResize()
- onUpdateRequest()
- scrollToCell()
- select()
- selectedCells
- selectionChanged
- setFragment()
- setMode()
- stateChanged
NotebookModel
- cells
- collaborative
- contentChanged
- defaultKernelLanguage
- defaultKernelName
- deletedCells
- deleteMetadata()
- dirty
- dispose()
- fromJSON()
- fromString()
- getMetadata()
- isDisposed
- metadata
- metadataChanged
- nbformat
- nbformatMinor
- readOnly
- setMetadata()
- sharedModel
- standaloneModel
- stateChanged
- toJSON()
- toString()
- triggerContentChange()
- triggerStateChange()
NotebookSearchProvider
- clearHighlight()
- createNew()
- currentMatchIndex
- delayedActiveCellChangeHandlerReady
- dispose()
- endQuery()
- getFilters()
- getInitialQuery()
- getSelectionState()
- highlightNext()
- highlightPrevious()
- isApplicable()
- isReadOnly
- matchesCount
- replaceAllMatches()
- replaceCurrentMatch()
- replaceOptionsSupport
- startQuery()
- translator
- validateFilter()
NotebookToCModel
- configMetadataMap
- dispose()
- documentType
- getCellHeadings()
- getHeadings()
- isAlwaysActive
- isHeadingEqual()
- loadConfigurationFromMetadata()
- onActiveCellChanged()
- onExecuted()
- onExecutionScheduled()
- onHeadingsChanged()
- onMetadataChanged()
- onOutputCleared()
- parser
- sanitizer
- setConfiguration()
- supportedOptions
- toggleCollapse()
- updateRunningStatus()
StaticNotebook
- addHeader()
- cellCollapsed
- cellInViewportChanged
- cellsArray
- codeMimetype
- contentFactory
- dispose()
- editorConfig
- kernelHistory
- model
- modelChanged
- modelContentChanged
- moveCell()
- notebookConfig
- onCellInserted()
- onCellRemoved()
- onMetadataChanged()
- onModelChanged()
- onModelContentChanged()
- onUpdateRequest()
- removeHeader()
- renderCellOutputs()
- renderingLayout
- renderingLayoutChanged
- rendermime
- translator
- widgets
Interfaces
Enums
Type Aliases
Namespaces
NotebookActions
- accessNextHistory()
- accessPreviousHistory()
- changeCellType()
- clearAllOutputs()
- clearOutputs()
- collapseAllHeadings()
- copy()
- cut()
- deleteCells()
- deselectAll()
- disableOutputScrolling()
- duplicate()
- enableOutputScrolling()
- expandAllHeadings()
- expandParent()
- extendSelectionAbove()
- extendSelectionBelow()
- findNextParentHeading()
- focusActiveCell()
- getHeadingInfo()
- hideAllCode()
- hideAllOutputs()
- hideCode()
- hideOutput()
- insertAbove()
- insertBelow()
- insertSameLevelHeadingAbove()
- insertSameLevelHeadingBelow()
- mergeCells()
- moveDown()
- moveUp()
- paste()
- redo()
- renderAllMarkdown()
- renderDefault()
- renderSideBySide()
- replaceSelection()
- run()
- runAll()
- runAllAbove()
- runAllBelow()
- runAndAdvance()
- runAndInsert()
- runCells()
- selectAbove()
- selectAll()
- selectBelow()
- selectHeadingAboveOrCollapseHeading()
- selectHeadingBelowOrExpandHeading()
- selectLastRunCell()
- setCellCollapse()
- setHeadingCollapse()
- setMarkdownHeader()
- showAllCode()
- showAllOutputs()
- showCode()
- showOutput()
- splitCell()
- toggleAllLineNumbers()
- toggleCurrentHeadingCollapse()
- toggleOutput()
- trust()
- undo()
Variables
variable INotebookCellExecutor
const INotebookCellExecutor: Token<INotebookCellExecutor>;
The notebook cell executor token.
variable INotebookTools
const INotebookTools: Token<INotebookTools>;
The notebook tools token.
variable INotebookTracker
const INotebookTracker: Token<INotebookTracker>;
The notebook tracker token.
variable INotebookWidgetFactory
const INotebookWidgetFactory: Token<NotebookWidgetFactory.IFactory>;
The notebook widget factory token.
Functions
function ExecutionIndicatorComponent
ExecutionIndicatorComponent: ( props: ExecutionIndicatorComponent.IProps) => JSX.Element;
A react functional component for rendering execution indicator.
function getIdForHeading
getIdForHeading: ( heading: INotebookHeading, parser: IRenderMime.IMarkdownParser, sanitizer: IRenderMime.ISanitizer) => Promise<string | null>;
Get the element id for an heading
Parameter heading
Heading
Parameter parser
The markdownparser
Returns
The element id
function runCell
runCell: ({ cell, notebook, notebookConfig, onCellExecuted, onCellExecutionScheduled, sessionContext, sessionDialogs, translator,}: INotebookCellExecutor.IRunCellOptions) => Promise<boolean>;
Run a single notebook cell.
Parameter options
Cell execution options
Returns
Execution status
function setCellExecutor
setCellExecutor: (executor: INotebookCellExecutor) => void;
Set the notebook cell executor and the related signals.
Classes
class CellList
class CellList {}
A cell list object that supports undo/redo.
constructor
constructor(model: ISharedNotebook);
Construct the cell list.
property changed
readonly changed: ISignal<this, IObservableList.IChangedArgs<ICellModel>>;
A signal emitted when the cell list has changed.
property isDisposed
readonly isDisposed: boolean;
Test whether the cell list has been disposed.
property length
readonly length: number;
Get the length of the cell list.
Returns
The number of cells in the cell list.
property model
protected model: ISharedNotebook;
method [Symbol.iterator]
[Symbol.iterator]: () => IterableIterator<ICellModel>;
Create an iterator over the cells in the cell list.
Returns
A new iterator starting at the front of the cell list.
method dispose
dispose: () => void;
Dispose of the resources held by the cell list.
method get
get: (index: number) => ICellModel;
Get the cell at the specified index.
Parameter index
The positive integer index of interest.
Returns
The cell at the specified index.
class CellTypeSwitcher
class CellTypeSwitcher extends ReactWidget {}
A toolbar widget that switches cell types.
constructor
constructor(widget: Notebook, translator?: ITranslator);
Construct a new cell type switcher.
property handleChange
handleChange: (event: React.ChangeEvent<HTMLSelectElement>) => void;
Handle
change
events for the HTMLSelect component.
property handleKeyDown
handleKeyDown: (event: React.KeyboardEvent) => void;
Handle
keydown
events for the HTMLSelect component.
method render
render: () => JSX.Element;
class CommandEditStatus
class CommandEditStatus extends VDomRenderer<CommandEditStatus.Model> {}
StatusBar item to display which notebook mode user is in.
constructor
constructor(translator?: ITranslator);
Construct a new CommandEdit status item.
property translator
protected translator: ITranslator;
method render
render: () => JSX.Element | null;
Render the CommandEdit status item.
class ExecutionIndicator
class ExecutionIndicator extends VDomRenderer<ExecutionIndicator.Model> {}
A VDomRenderer widget for displaying the execution status.
constructor
constructor(translator?: ITranslator, showProgress?: boolean);
Construct the kernel status widget.
method render
render: () => JSX.Element | null;
Render the execution status item.
class KernelError
class KernelError extends Error {}
constructor
constructor(content: KernelMessage.IExecuteReplyMsg);
Construct the kernel error.
property errorName
readonly errorName: string;
Exception name
property errorValue
readonly errorValue: string;
Exception value
property traceback
readonly traceback: string[];
Traceback
class Notebook
class Notebook extends StaticNotebook {}
A notebook widget that supports interactivity.
constructor
constructor(options: Notebook.IOptions);
Construct a notebook widget.
property activeCell
readonly activeCell: any;
Get the active cell widget.
#### Notes This is a cell or
null
if there is no active cell.
property activeCellChanged
readonly activeCellChanged: ISignal<this, any>;
A signal emitted when the active cell changes.
#### Notes This can be due to the active index changing or the cell at the active index changing.
property activeCellIndex
activeCellIndex: number;
The active cell index of the notebook.
#### Notes The index will be clamped to the bounds of the notebook cells.
property lastClipboardInteraction
lastClipboardInteraction: 'copy' | 'cut' | 'paste';
property mode
mode: NotebookMode;
The interactivity mode of the notebook.
property selectedCells
readonly selectedCells: Cell[];
List of selected and active cells
property selectionChanged
readonly selectionChanged: ISignal<this, void>;
A signal emitted when the selection state of the notebook changes.
property stateChanged
readonly stateChanged: ISignal<this, IChangedArgs<any>>;
A signal emitted when the state of the notebook changes.
method addFooter
protected addFooter: () => void;
Adds a footer to the notebook.
method deselect
deselect: (widget: Cell) => void;
Deselect a cell widget.
#### Notes It is a no-op if the value does not change. It will emit the
selectionChanged
signal.
method deselectAll
deselectAll: () => void;
Deselect all of the cells.
method dispose
dispose: () => void;
Dispose of the resources held by the widget.
method extendContiguousSelectionTo
extendContiguousSelectionTo: (index: number) => void;
Move the head of an existing contiguous selection to extend the selection.
Parameter index
The new head of the existing selection.
#### Notes If there is no existing selection, the active cell is considered an existing one-cell selection.
If the new selection is a single cell, that cell becomes the active cell and all cells are deselected.
There is no change if there are no cells (i.e., activeCellIndex is -1).
method getContiguousSelection
getContiguousSelection: () => | { head: number; anchor: number } | { head: null; anchor: null };
Get the head and anchor of a contiguous cell selection.
The head of a contiguous selection is always the active cell.
If there are no cells selected,
{head: null, anchor: null}
is returned.Throws an error if the currently selected cells do not form a contiguous selection.
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 isSelected
isSelected: (widget: Cell) => boolean;
Whether a cell is selected.
method isSelectedOrActive
isSelectedOrActive: (widget: Cell) => boolean;
Whether a cell is selected or is the active cell.
method moveCell
moveCell: (from: number, to: number, n?: number) => void;
Move cells preserving widget view state.
#### Notes This is required because at the model level a move is a deletion followed by an insertion. Hence the view state is not preserved.
Parameter from
The index of the cell to move
Parameter to
The new index of the cell
Parameter n
Number of cells to move
method onActivateRequest
protected onActivateRequest: (msg: Message) => void;
Handle
'activate-request'
messages.
method onAfterAttach
protected onAfterAttach: (msg: Message) => void;
Handle
after-attach
messages for the widget.
method onAfterShow
protected onAfterShow: (msg: Message) => void;
A message handler invoked on an
'after-show'
message.
method onBeforeDetach
protected onBeforeDetach: (msg: Message) => void;
Handle
before-detach
messages for the widget.
method onBeforeHide
protected onBeforeHide: (msg: Message) => void;
A message handler invoked on an
'before-hide'
message.
method onCellInserted
protected onCellInserted: (index: number, cell: Cell) => void;
Handle a cell being inserted.
method onCellRemoved
protected onCellRemoved: (index: number, cell: Cell) => void;
Handle a cell being removed.
method onModelChanged
protected onModelChanged: ( oldValue: INotebookModel, newValue: INotebookModel) => void;
Handle a new model.
method onResize
protected onResize: (msg: Widget.ResizeMessage) => void;
A message handler invoked on a
'resize'
message.
method onUpdateRequest
protected onUpdateRequest: (msg: Message) => void;
Handle
update-request
messages sent to the widget.
method scrollToCell
scrollToCell: (cell: Cell, align?: WindowedList.ScrollToAlign) => Promise<void>;
Scroll so that the given cell is in view. Selects and activates cell.
Parameter cell
A cell in the notebook widget.
Parameter align
Type of alignment.
method select
select: (widget: Cell) => void;
Select a cell widget.
#### Notes It is a no-op if the value does not change. It will emit the
selectionChanged
signal.
method setFragment
setFragment: (fragment: string) => Promise<void>;
Set URI fragment identifier.
method setMode
protected setMode: ( newValue: NotebookMode, options?: { focus?: boolean }) => void;
Set the notebook mode.
Parameter newValue
Notebook mode
Parameter options
Control mode side-effect
Parameter
options.focus Whether to ensure focus (default) or not when setting the mode.
class NotebookActions
class NotebookActions {}
A collection of actions that run against notebooks.
#### Notes All of the actions are a no-op if there is no model on the notebook. The actions set the widget
mode
to'command'
unless otherwise specified. The actions will preserve the selection on the notebook widget unless otherwise specified.
property executed
static readonly executed: ISignal< any, { notebook: Notebook; cell: Cell; success: boolean; error?: KernelError | null; }>;
A signal that emits whenever a cell completes execution.
property executionScheduled
static readonly executionScheduled: ISignal< any, { notebook: Notebook; cell: Cell }>;
A signal that emits whenever a cell execution is scheduled.
property outputCleared
static readonly outputCleared: ISignal<any, { notebook: Notebook; cell: Cell }>;
A signal that emits when a cell's output is cleared.
property selectionExecuted
static readonly selectionExecuted: ISignal< any, { notebook: Notebook; lastCell: Cell }>;
A signal that emits when one notebook's cells are all executed.
class NotebookAdapter
class NotebookAdapter extends WidgetLSPAdapter<NotebookPanel> {}
constructor
constructor(editorWidget: NotebookPanel, options: IAdapterOptions);
property activeEditor
readonly activeEditor: any;
Get the activated CM editor.
property documentPath
readonly documentPath: string;
Get current path of the document.
property editor
readonly editor: Notebook;
The wrapped
Notebook
widget.
property editors
readonly editors: Document.ICodeBlockOptions[];
Get the list of CM editor with its type in the document,
property editorWidget
editorWidget: NotebookPanel;
property languageFileExtension
readonly languageFileExtension: string;
Get the file extension of the document.
property mimeType
readonly mimeType: string;
Get the mime type of the document.
property options
protected options: IAdapterOptions;
property ready
readonly ready: Promise<void>;
Promise that resolves once the adapter is initialized
property wrapperElement
readonly wrapperElement: HTMLElement;
Get the inner HTMLElement of the document widget.
method createVirtualDocument
createVirtualDocument: () => VirtualDocument;
Generate the virtual document associated with the document.
method dispose
dispose: () => void;
Dispose the widget.
method getEditorIndex
getEditorIndex: (ceEditor: Document.IEditor) => number;
Get the index of input editor
Parameter ceEditor
instance of the code editor
method getEditorIndexAt
getEditorIndexAt: (position: IVirtualPosition) => number;
Get the index of editor from the cursor position in the virtual document.
Parameter position
the position of cursor in the virtual document.
Deprecated
This is error-prone and will be removed in JupyterLab 5.0, use
getEditorIndex()
withvirtualDocument.getEditorAtVirtualLine(position)
instead.
method getEditorWrapper
getEditorWrapper: (ceEditor: Document.IEditor) => HTMLElement;
Get the wrapper of input editor.
Parameter ceEditor
instance of the code editor
method handleCellChange
handleCellChange: ( cells: CellList, change: IObservableList.IChangedArgs<ICellModel>) => Promise<void>;
Update the virtual document on cell changing event.
Parameter cells
Observable list of changed cells
Parameter change
Changed data
method initOnceReady
protected initOnceReady: () => Promise<void>;
Initialization function called once the editor and the LSP connection manager is ready. This function will create the virtual document and connect various signals.
method isReady
isReady: () => boolean;
Method to check if the notebook context is ready.
method language_info
protected language_info: () => nbformat.ILanguageInfoMetadata;
Get the metadata of notebook.
method onKernelChanged
onKernelChanged: ( _session: SessionContext, change: Session.ISessionConnection.IKernelChangedArgs) => Promise<void>;
Callback on kernel changed event, it will disconnect the document with the language server and then reconnect.
Parameter _session
Session context of changed kernel
Parameter change
Changed data
class NotebookHistory
class NotebookHistory implements INotebookHistory {}
A console history manager object.
constructor
constructor(options: NotebookHistory.IOptions);
Construct a new console history object.
property editor
editor: any;
The current editor used by the history manager.
property isDisposed
readonly isDisposed: boolean;
Get whether the notebook history manager is disposed.
property kernelSession
readonly kernelSession: string;
Kernel session number for filtering
property placeholder
readonly placeholder: string;
The placeholder text that a history session began with.
method back
back: (activeCell: Cell) => Promise<string | undefined>;
Get the previous item in the notebook history.
Parameter activeCell
The currently selected Cell in the notebook.
Returns
A Promise resolving to the historical cell content text.
method checkSession
protected checkSession: (activeCell: Cell) => Promise<void>;
Set placeholder and editor. Start session if one is not already started.
Parameter activeCell
The currently selected Cell in the notebook.
method dispose
dispose: () => void;
Dispose of the resources held by the notebook history manager.
method forward
forward: (activeCell: Cell) => Promise<string | undefined>;
Get the next item in the notebook history.
Parameter activeCell
The currently selected Cell in the notebook.
Returns
A Promise resolving to the historical cell content text.
method onHistory
protected onHistory: ( value: KernelMessage.IHistoryReplyMsg, cell?: Cell) => void;
Populate the history collection on history reply from a kernel.
Parameter value
The kernel message history reply.
#### Notes History entries have the shape: [session: number, line: number, input: string] Contiguous duplicates are stripped out of the API response.
method onTextChange
protected onTextChange: () => void;
Handle a text change signal from the editor.
method reset
reset: () => void;
Reset the history navigation state, i.e., start a new history session.
method setFilter
protected setFilter: (filterStr?: string) => void;
Set the filter data.
Parameter filterStr
The string to use when filtering the data.
method updateEditor
updateEditor: (activeCell: Cell, content: string | undefined) => void;
Update the editor of the cell with provided text content.
Parameter activeCell
The currently selected Cell in the notebook.
Parameter content
the result from back or forward
class NotebookModel
class NotebookModel implements INotebookModel {}
An implementation of a notebook Model.
constructor
constructor(options?: NotebookModel.IOptions);
Construct a new notebook model.
property cells
readonly cells: CellList;
Get the observable list of notebook cells.
property collaborative
readonly collaborative: boolean;
Whether the model is collaborative or not.
property contentChanged
readonly contentChanged: ISignal<this, void>;
A signal emitted when the document content changes.
property defaultKernelLanguage
readonly defaultKernelLanguage: string;
The default kernel language of the document.
property defaultKernelName
readonly defaultKernelName: string;
The default kernel name of the document.
property deletedCells
readonly deletedCells: string[];
A list of deleted cells for the notebook..
property dirty
dirty: boolean;
The dirty state of the document.
property isDisposed
readonly isDisposed: boolean;
Whether the model is disposed.
property metadata
readonly metadata: nbformat.INotebookMetadata;
The metadata associated with the notebook.
### Notes This is a copy of the metadata. Changing a part of it won't affect the model. As this returns a copy of all metadata, it is advised to use
getMetadata
to speed up the process of getting a single key.
property metadataChanged
readonly metadataChanged: ISignal<INotebookModel, IMapChange<any>>;
Signal emitted when notebook metadata changes.
property nbformat
readonly nbformat: number;
The major version number of the nbformat.
property nbformatMinor
readonly nbformatMinor: number;
The minor version number of the nbformat.
property readOnly
readOnly: boolean;
The read only state of the document.
property sharedModel
readonly sharedModel: ISharedNotebook;
The shared notebook model.
property standaloneModel
protected standaloneModel: boolean;
Whether the model should disposed the shared model on disposal or not.
property stateChanged
readonly stateChanged: ISignal<this, IChangedArgs<any>>;
A signal emitted when the document state changes.
method deleteMetadata
deleteMetadata: (key: string) => void;
Delete a metadata
Parameter key
Metadata key
method dispose
dispose: () => void;
Dispose of the resources held by the model.
method fromJSON
fromJSON: (value: nbformat.INotebookContent) => void;
Deserialize the model from JSON.
#### Notes Should emit a [contentChanged] signal.
method fromString
fromString: (value: string) => void;
Deserialize the model from a string.
#### Notes Should emit a [contentChanged] signal.
method getMetadata
getMetadata: (key: string) => any;
Get a metadata
### Notes This returns a copy of the key value.
Parameter key
Metadata key
method setMetadata
setMetadata: (key: string, value: any) => void;
Set a metadata
Parameter key
Metadata key
Parameter value
Metadata value
method toJSON
toJSON: () => nbformat.INotebookContent;
Serialize the model to JSON.
method toString
toString: () => string;
Serialize the model to a string.
method triggerContentChange
protected triggerContentChange: () => void;
Trigger a content changed signal.
method triggerStateChange
protected triggerStateChange: (args: IChangedArgs<any>) => void;
Trigger a state change signal.
class NotebookModelFactory
class NotebookModelFactory implements DocumentRegistry.IModelFactory<INotebookModel> {}
A model factory for notebooks.
constructor
constructor(options?: NotebookModelFactory.IOptions);
Construct a new notebook model factory.
property collaborative
readonly collaborative: boolean;
Whether the model is collaborative or not.
property contentType
readonly contentType: Contents.ContentType;
The content type of the file.
property disableDocumentWideUndoRedo
disableDocumentWideUndoRedo: boolean;
Define the disableDocumentWideUndoRedo property.
Modifiers
@experimental
@alpha
property fileFormat
readonly fileFormat: Contents.FileFormat;
The format of the file.
property isDisposed
readonly isDisposed: boolean;
Get whether the model factory has been disposed.
property name
readonly name: string;
The name of the model.
method createNew
createNew: ( options?: DocumentRegistry.IModelOptions<ISharedNotebook>) => INotebookModel;
Create a new model for a given path.
Parameter options
Model options.
Returns
A new document model.
method dispose
dispose: () => void;
Dispose of the model factory.
method preferredLanguage
preferredLanguage: (path: string) => string;
Get the preferred kernel language given a path.
class NotebookPanel
class NotebookPanel extends DocumentWidget<Notebook, INotebookModel> {}
A widget that hosts a notebook toolbar and content area.
#### Notes The widget keeps the document metadata in sync with the current kernel on the context.
constructor
constructor(options: DocumentWidget.IOptions<Notebook, INotebookModel>);
Construct a new notebook panel.
property model
readonly model: INotebookModel;
The model for the widget.
property sessionContext
readonly sessionContext: ISessionContext;
The session context used by the panel.
property translator
translator: ITranslator;
method [Printing.symbol]
[Printing.symbol]: () => () => Promise<void>;
Prints the notebook by converting to HTML with nbconvert.
method dispose
dispose: () => void;
Dispose of the resources used by the widget.
method onBeforeHide
protected onBeforeHide: (msg: Message) => void;
A message handler invoked on a 'before-hide' message.
method onBeforeShow
protected onBeforeShow: (msg: Message) => void;
A message handler invoked on a 'before-show' message.
method setConfig
setConfig: (config: NotebookPanel.IConfig) => void;
Update the options for the current notebook panel.
Parameter config
new options to set
method setFragment
setFragment: (fragment: string) => void;
Set URI fragment identifier.
class NotebookSearchProvider
class NotebookSearchProvider extends SearchProvider<NotebookPanel> {}
Notebook document search provider
constructor
constructor(widget: NotebookPanel, translator?: ITranslator);
Constructor
Parameter widget
The widget to search in
Parameter translator
Application translator
property currentMatchIndex
readonly currentMatchIndex: number;
The current index of the selected match.
property delayedActiveCellChangeHandlerReady
protected delayedActiveCellChangeHandlerReady: Promise<void>;
property isReadOnly
readonly isReadOnly: boolean;
Set to true if the widget under search is read-only, false if it is editable. Will be used to determine whether to show the replace option.
property matchesCount
readonly matchesCount: number;
The number of matches.
property replaceOptionsSupport
readonly replaceOptionsSupport: IReplaceOptionsSupport;
Support for options adjusting replacement behavior.
property translator
protected translator: ITranslator;
method clearHighlight
clearHighlight: () => Promise<void>;
Clear currently highlighted match.
method createNew
static createNew: ( widget: NotebookPanel, translator?: ITranslator) => ISearchProvider;
Instantiate a search provider for the notebook panel.
#### Notes The widget provided is always checked using
isApplicable
before calling this factory.Parameter widget
The widget to search on
Parameter translator
[optional] The translator object
Returns
The search provider on the notebook panel
method dispose
dispose: () => void;
Dispose of the resources held by the search provider.
#### Notes If the object's
dispose
method is called more than once, all calls made after the first will be a no-op.#### Undefined Behavior It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.
method endQuery
endQuery: () => Promise<void>;
Stop the search and clear all internal state.
method getFilters
getFilters: () => { [key: string]: IFilter };
Get the filters for the given provider.
Returns
The filters.
method getInitialQuery
getInitialQuery: () => string;
Get an initial query value if applicable so that it can be entered into the search box as an initial query
Returns
Initial value used to populate the search box.
method getSelectionState
getSelectionState: () => SelectionState;
method highlightNext
highlightNext: ( loop?: boolean, options?: IHighlightAdjacentMatchOptions) => Promise<ISearchMatch | undefined>;
Highlight the next match.
Parameter loop
Whether to loop within the matches list.
Returns
The next match if available.
method highlightPrevious
highlightPrevious: ( loop?: boolean, options?: IHighlightAdjacentMatchOptions) => Promise<ISearchMatch | undefined>;
Highlight the previous match.
Parameter loop
Whether to loop within the matches list.
Returns
The previous match if available.
method isApplicable
static isApplicable: (domain: Widget) => domain is NotebookPanel;
Report whether or not this provider has the ability to search on the given object
Parameter domain
Widget to test
Returns
Search ability
method replaceAllMatches
replaceAllMatches: ( newText: string, options?: IReplaceOptions) => Promise<boolean>;
Replace all matches in the notebook with the provided text
Parameter newText
The replacement text.
Returns
A promise that resolves with a boolean indicating whether a replace occurred.
method replaceCurrentMatch
replaceCurrentMatch: ( newText: string, loop?: boolean, options?: IReplaceOptions) => Promise<boolean>;
Replace the currently selected match with the provided text
Parameter newText
The replacement text.
Parameter loop
Whether to loop within the matches list.
Returns
A promise that resolves with a boolean indicating whether a replace occurred.
method startQuery
startQuery: (query: RegExp, filters: IFilters | undefined) => Promise<void>;
Search for a regular expression with optional filters.
Parameter query
A regular expression to test for
Parameter filters
Filter parameters to pass to provider
method validateFilter
validateFilter: (name: string, value: boolean) => Promise<boolean>;
class NotebookToCFactory
class NotebookToCFactory extends TableOfContentsFactory<NotebookPanel> {}
Table of content model factory for Notebook files.
constructor
constructor( tracker: INotebookTracker, parser: any, sanitizer: IRenderMime.ISanitizer);
Constructor
Parameter tracker
Widget tracker
Parameter parser
Markdown parser
Parameter sanitizer
Sanitizer
property parser
protected parser: any;
property sanitizer
protected sanitizer: IRenderMime.ISanitizer;
property scrollToTop
scrollToTop: boolean;
Whether to scroll the active heading to the top of the document or not.
class NotebookToCModel
class NotebookToCModel extends TableOfContentsModel< INotebookHeading, NotebookPanel> {}
Table of content model for Notebook files.
constructor
constructor( widget: NotebookPanel, parser: any, sanitizer: IRenderMime.ISanitizer, configuration?: TableOfContents.IConfig);
Constructor
Parameter widget
The widget to search in
Parameter parser
Markdown parser
Parameter sanitizer
Sanitizer
Parameter configuration
Default model configuration
property configMetadataMap
protected configMetadataMap: { [k: string]: string[]; [k: number]: string[]; [k: symbol]: string[];};
Mapping between configuration options and notebook metadata.
If it starts with
!
, the boolean value of the configuration option is opposite to the one stored in metadata. If it contains/
, the metadata data is nested.
property documentType
readonly documentType: string;
Type of document supported by the model.
#### Notes A
data-document-type
attribute with this value will be set on the tree view.jp-TableOfContents-content[data-document-type="..."]
property isAlwaysActive
readonly isAlwaysActive: boolean;
Whether the model gets updated even if the table of contents panel is hidden or not.
property parser
protected parser: any;
property sanitizer
protected sanitizer: IRenderMime.ISanitizer;
property supportedOptions
readonly supportedOptions: (string | number | symbol)[];
List of configuration options supported by the model.
method dispose
dispose: () => void;
Dispose the object
method getCellHeadings
getCellHeadings: (cell: Cell) => INotebookHeading[];
Get the headings of a given cell.
Parameter cell
Cell
Returns
The associated headings
method getHeadings
protected getHeadings: () => Promise<INotebookHeading[] | null>;
Produce the headings for a document.
Returns
The list of new headings or
null
if nothing needs to be updated.
method isHeadingEqual
protected isHeadingEqual: ( heading1: INotebookHeading, heading2: INotebookHeading) => boolean;
Test if two headings are equal or not.
Parameter heading1
First heading
Parameter heading2
Second heading
Returns
Whether the headings are equal.
method loadConfigurationFromMetadata
protected loadConfigurationFromMetadata: () => TableOfContents.IConfig;
Read table of content configuration from notebook metadata.
Returns
ToC configuration from metadata
method onActiveCellChanged
protected onActiveCellChanged: ( notebook: Notebook, cell: Cell<ICellModel>) => void;
method onExecuted
protected onExecuted: ( _: unknown, args: { notebook: Notebook; cell: Cell; success: boolean; error: KernelError | null; }) => void;
method onExecutionScheduled
protected onExecutionScheduled: ( _: unknown, args: { notebook: Notebook; cell: Cell }) => void;
method onHeadingsChanged
protected onHeadingsChanged: () => void;
method onMetadataChanged
protected onMetadataChanged: () => void;
method onOutputCleared
protected onOutputCleared: ( _: unknown, args: { notebook: Notebook; cell: Cell }) => void;
method setConfiguration
setConfiguration: (c: TableOfContents.IConfig) => void;
Model configuration setter.
Parameter c
New configuration
method toggleCollapse
toggleCollapse: (options: { heading?: INotebookHeading; collapsed?: boolean;}) => void;
Callback on heading collapse.
Parameter
options.heading The heading to change state (all headings if not provided)
Parameter
options.collapsed The new collapsed status (toggle existing status if not provided)
method updateRunningStatus
protected updateRunningStatus: (headings: INotebookHeading[]) => void;
class NotebookTools
class NotebookTools extends Widget implements INotebookTools {}
A widget that provides metadata tools.
constructor
constructor(options: NotebookTools.IOptions);
Construct a new NotebookTools object.
property activeCell
readonly activeCell: any;
The active cell widget.
property activeNotebookPanel
readonly activeNotebookPanel: NotebookPanel;
The current notebook.
property selectedCells
readonly selectedCells: Cell[];
The currently selected cells.
property translator
translator: ITranslator;
method addItem
addItem: (options: NotebookTools.IAddOptions) => void;
Add a cell tool item.
method addSection
addSection: (options: NotebookTools.IAddSectionOptions) => void;
class NotebookTracker
class NotebookTracker extends WidgetTracker<NotebookPanel> implements INotebookTracker {}
property activeCell
readonly activeCell: any;
The currently focused cell.
#### Notes This is a read-only property. If there is no cell with the focus, then this value is
null
.
property activeCellChanged
readonly activeCellChanged: ISignal<this, any>;
A signal emitted when the current active cell changes.
#### Notes If there is no cell with the focus, then
null
will be emitted.
property selectionChanged
readonly selectionChanged: ISignal<this, void>;
A signal emitted when the selection state changes.
method add
add: (panel: NotebookPanel) => Promise<void>;
Add a new notebook panel to the tracker.
Parameter panel
The notebook panel being added.
method dispose
dispose: () => void;
Dispose of the resources held by the tracker.
method onCurrentChanged
protected onCurrentChanged: (widget: NotebookPanel) => void;
Handle the current change event.
class NotebookTrustStatus
class NotebookTrustStatus extends VDomRenderer<NotebookTrustStatus.Model> {}
The NotebookTrust status item.
constructor
constructor(translator?: ITranslator);
Construct a new status item.
property translator
translator: ITranslator;
method render
render: () => JSX.Element | null;
Render the NotebookTrust status item.
class NotebookViewModel
class NotebookViewModel extends WindowedListModel {}
Notebook view model for the windowed list.
constructor
constructor(cells: Cell[], options?: WindowedList.IModelOptions);
Construct a notebook windowed list model.
property cells
protected cells: Cell[];
property cellsEstimatedHeight
protected cellsEstimatedHeight: Map<string, number>;
Mapping between the cell ids and the cell estimated heights
This height is not refreshed with the changes to the document. It is only used to measure cells outside the viewport on CPU idle cycle to improve UX scrolling.
property DEFAULT_CELL_MARGIN
static DEFAULT_CELL_MARGIN: number;
Default cell margin (top + bottom)
property DEFAULT_CELL_SIZE
static DEFAULT_CELL_SIZE: number;
Default cell height
property DEFAULT_EDITOR_LINE_HEIGHT
static DEFAULT_EDITOR_LINE_HEIGHT: number;
Default editor line height
property estimateWidgetSize
estimateWidgetSize: (index: number) => number;
Cell size estimator
Parameter index
Cell index
Returns
Cell height in pixels
property scrollDownThreshold
readonly scrollDownThreshold: number;
Threshold used to decide if the cell should be scrolled to in the
smart
mode. Defaults to scrolling when less than a full line of the cell is visible.
property scrollUpThreshold
readonly scrollUpThreshold: number;
Threshold used to decide if the cell should be scrolled to in the
smart
mode. Defaults to scrolling when the cell margin or more is invisible.
property widgetRenderer
widgetRenderer: (index: number) => Widget;
Render the cell at index.
Parameter index
Cell index
Returns
Cell widget
method setEstimatedWidgetSize
setEstimatedWidgetSize: (cellId: string, size: number | null) => void;
Set an estimated height for a cell
Parameter cellId
Cell ID
Parameter size
Cell height
class NotebookWidgetFactory
class NotebookWidgetFactory extends ABCWidgetFactory< NotebookPanel, INotebookModel> {}
A widget factory for notebook panels.
constructor
constructor(options: NotebookWidgetFactory.IOptions<NotebookPanel>);
Construct a new notebook widget factory.
Parameter options
The options used to construct the factory.
property contentFactory
readonly contentFactory: NotebookPanel.IContentFactory;
The content factory used by the widget factory.
property editorConfig
editorConfig: StaticNotebook.IEditorConfig;
A configuration object for cell editor settings.
property mimeTypeService
readonly mimeTypeService: IEditorMimeTypeService;
The service used to look up mime types.
property notebookConfig
notebookConfig: StaticNotebook.INotebookConfig;
A configuration object for notebook settings.
property rendermime
readonly rendermime: IRenderMimeRegistry;
method createNewWidget
protected createNewWidget: ( context: DocumentRegistry.IContext<INotebookModel>, source?: NotebookPanel) => NotebookPanel;
Create a new widget.
#### Notes The factory will start the appropriate kernel.
class NotebookWindowedLayout
class NotebookWindowedLayout extends WindowedLayout {}
Windowed list layout for the notebook.
property activeCell
activeCell: any;
Notebook's active cell
property footer
footer: any;
Notebook widget's footer
property header
header: any;
Notebook's header
method attachWidget
protected attachWidget: (index: number, widget: Widget) => void;
Attach a widget to the parent's DOM node.
Parameter index
The current index of the widget in the layout.
Parameter widget
The widget to attach to the parent.
#### Notes This method is called automatically by the panel layout at the appropriate time. It should not be called directly by user code.
The default implementation adds the widgets's node to the parent's node at the proper location, and sends the appropriate attach messages to the widget if the parent is attached to the DOM.
Subclasses may reimplement this method to control how the widget's node is added to the parent's node.
method detachWidget
protected detachWidget: (index: number, widget: Widget) => void;
Detach a widget from the parent's DOM node.
Parameter index
The previous index of the widget in the layout.
Parameter widget
The widget to detach from the parent.
#### Notes This method is called automatically by the panel layout at the appropriate time. It should not be called directly by user code.
The default implementation removes the widget's node from the parent's node, and sends the appropriate detach messages to the widget if the parent is attached to the DOM.
Subclasses may reimplement this method to control how the widget's node is removed from the parent's node.
method dispose
dispose: () => void;
Dispose the layout
method moveWidget
protected moveWidget: ( fromIndex: number, toIndex: number, widget: Widget) => void;
Move a widget in the parent's DOM node.
Parameter fromIndex
The previous index of the widget in the layout.
Parameter toIndex
The current index of the widget in the layout.
Parameter widget
The widget to move in the parent.
#### Notes This method is called automatically by the panel layout at the appropriate time. It should not be called directly by user code.
The default implementation moves the widget's node to the proper location in the parent's node and sends the appropriate attach and detach messages to the widget if the parent is attached to the DOM.
Subclasses may reimplement this method to control how the widget's node is moved in the parent's node.
method onAfterAttach
protected onAfterAttach: (msg: Message) => void;
method onBeforeDetach
protected onBeforeDetach: (msg: Message) => void;
method onChildRemoved
protected onChildRemoved: (msg: Widget.ChildMessage) => void;
A message handler invoked on a
'child-removed'
message.Parameter msg
Message
method removeWidget
removeWidget: (widget: Widget) => void;
* A message handler invoked on a
'child-removed'
message. *Parameter widget
The widget to remove from the layout.
#### Notes A widget is automatically removed from the layout when its
parent
is set tonull
. This method should only be invoked directly when removing a widget from a layout which has yet to be installed on a parent widget.This method does *not* modify the widget's
parent
.
class StaticNotebook
class StaticNotebook extends WindowedList<NotebookViewModel> {}
A widget which renders static non-interactive notebooks.
#### Notes The widget model must be set separately and can be changed at any time. Consumers of the widget must account for a
null
model, and may want to listen to themodelChanged
signal.
constructor
constructor(options: StaticNotebook.IOptions);
Construct a notebook widget.
property cellCollapsed
readonly cellCollapsed: ISignal<this, Cell>;
property cellInViewportChanged
readonly cellInViewportChanged: ISignal<this, Cell>;
property cellsArray
protected cellsArray: Cell[];
property codeMimetype
readonly codeMimetype: string;
Get the mimetype for code cells.
property contentFactory
readonly contentFactory: StaticNotebook.IContentFactory;
The cell factory used by the widget.
property editorConfig
editorConfig: StaticNotebook.IEditorConfig;
A configuration object for cell editor settings.
property kernelHistory
readonly kernelHistory: INotebookHistory;
property model
model: INotebookModel;
The model for the widget.
property modelChanged
readonly modelChanged: ISignal<this, void>;
A signal emitted when the model of the notebook changes.
property modelContentChanged
readonly modelContentChanged: ISignal<this, void>;
A signal emitted when the model content changes.
#### Notes This is a convenience signal that follows the current model.
property notebookConfig
notebookConfig: StaticNotebook.INotebookConfig;
A configuration object for notebook settings.
property renderingLayout
renderingLayout: RenderingLayout;
property renderingLayoutChanged
readonly renderingLayoutChanged: ISignal<this, RenderingLayout>;
A signal emitted when the rendering layout of the notebook changes.
property rendermime
readonly rendermime: IRenderMimeRegistry;
The Rendermime instance used by the widget.
property translator
readonly translator: ITranslator;
Translator to be used by cell renderers
property widgets
readonly widgets: readonly Cell[];
A read-only sequence of the widgets in the notebook.
method addHeader
protected addHeader: () => void;
Adds a message to the notebook as a header.
method dispose
dispose: () => void;
Dispose of the resources held by the widget.
method moveCell
moveCell: (from: number, to: number, n?: number) => void;
Move cells preserving widget view state.
#### Notes This is required because at the model level a move is a deletion followed by an insertion. Hence the view state is not preserved.
Parameter from
The index of the cell to move
Parameter to
The new index of the cell
Parameter n
Number of cells to move
method onCellInserted
protected onCellInserted: (index: number, cell: Cell) => void;
Handle a cell being inserted.
The default implementation is a no-op
method onCellRemoved
protected onCellRemoved: (index: number, cell: Cell) => void;
Handle a cell being removed.
The default implementation is a no-op
method onMetadataChanged
protected onMetadataChanged: (sender: INotebookModel, args: IMapChange) => void;
Handle changes to the notebook model metadata.
#### Notes The default implementation updates the mimetypes of the code cells when the
language_info
metadata changes.
method onModelChanged
protected onModelChanged: ( oldValue: INotebookModel | null, newValue: INotebookModel | null) => void;
Handle a new model.
#### Notes This method is called after the model change has been handled internally and before the
modelChanged
signal is emitted. The default implementation is a no-op.
method onModelContentChanged
protected onModelContentChanged: (model: INotebookModel, args: void) => void;
Handle changes to the notebook model content.
#### Notes The default implementation emits the
modelContentChanged
signal.
method onUpdateRequest
protected onUpdateRequest: (msg: Message) => void;
A message handler invoked on an
'update-request'
message.#### Notes The default implementation of this handler is a no-op.
method removeHeader
protected removeHeader: () => void;
Removes the header.
method renderCellOutputs
renderCellOutputs: (index: number) => void;
Force rendering the cell outputs of a given cell if it is still a placeholder.
#### Notes The goal of this method is to allow search on cell outputs (that is based on DOM tree introspection).
Parameter index
The cell index
Interfaces
interface INotebookCellExecutor
interface INotebookCellExecutor {}
Notebook cell executor interface
method runCell
runCell: (options: INotebookCellExecutor.IRunCellOptions) => Promise<boolean>;
Execute a cell.
Parameter options
Cell execution options
interface INotebookHeading
interface INotebookHeading extends TableOfContents.IHeading {}
Interface describing a notebook cell heading.
property cellRef
cellRef: Cell;
Reference to a notebook cell.
property isRunning
isRunning: RunningStatus;
Running status of the cells in the heading
property outputIndex
outputIndex?: number;
Index of the output containing the heading
property type
type: Cell.HeadingType;
Type of heading
interface INotebookHistory
interface INotebookHistory extends IDisposable {}
The definition of a console history manager object.
property editor
editor: CodeEditor.IEditor | null;
The current editor used by the history widget.
property kernelSession
readonly kernelSession: string;
The session number of the current kernel session
property placeholder
readonly placeholder: string;
The placeholder text that a history session began with.
method back
back: (activeCell: Cell) => Promise<string | undefined>;
Get the previous item in the console history.
Parameter activeCell
The currently selected Cell in the notebook.
Returns
A Promise for console command text or
undefined
if unavailable.
method forward
forward: (activeCell: Cell) => Promise<string | undefined>;
Get the next item in the console history.
Parameter activeCell
The currently selected Cell in the notebook.
Returns
A Promise for console command text or
undefined
if unavailable.
method reset
reset: () => void;
Reset the history navigation state, i.e., start a new history session.
method updateEditor
updateEditor: (activeCell: Cell, content: string | undefined) => void;
Get the next item in the console history.
Parameter activeCell
The currently selected Cell in the notebook.
Parameter content
the result from back or forward
interface INotebookModel
interface INotebookModel extends DocumentRegistry.IModel {}
The definition of a model object for a notebook widget.
property cells
readonly cells: CellList;
The list of cells in the notebook.
property deletedCells
readonly deletedCells: string[];
The array of deleted cells since the notebook was last run.
property metadata
readonly metadata: nbformat.INotebookMetadata;
The metadata associated with the notebook.
### Notes This is a copy of the metadata. Changing a part of it won't affect the model. As this returns a copy of all metadata, it is advised to use
getMetadata
to speed up the process of getting a single key.
property metadataChanged
readonly metadataChanged: ISignal<INotebookModel, IMapChange>;
Signal emitted when notebook metadata changes.
property nbformat
readonly nbformat: number;
The major version number of the nbformat.
property nbformatMinor
readonly nbformatMinor: number;
The minor version number of the nbformat.
property sharedModel
readonly sharedModel: ISharedNotebook;
Shared model
method deleteMetadata
deleteMetadata: (key: string) => void;
Delete a metadata
Parameter key
Metadata key
method getMetadata
getMetadata: (key: string) => any;
Get a metadata
### Notes This returns a copy of the key value.
Parameter key
Metadata key
method setMetadata
setMetadata: (key: string, value: any) => void;
Set a metadata
Parameter key
Metadata key
Parameter value
Metadata value
interface INotebookTools
interface INotebookTools extends Widget {}
The interface for notebook metadata tools.
property activeCell
activeCell: Cell | null;
property activeNotebookPanel
activeNotebookPanel: NotebookPanel | null;
property selectedCells
selectedCells: Cell[];
method addItem
addItem: (options: NotebookTools.IAddOptions) => void;
method addSection
addSection: (options: NotebookTools.IAddSectionOptions) => void;
interface INotebookTracker
interface INotebookTracker extends IWidgetTracker<NotebookPanel> {}
An object that tracks notebook widgets.
property activeCell
readonly activeCell: Cell | null;
The currently focused cell.
#### Notes If there is no cell with the focus, then this value is
null
.
property activeCellChanged
readonly activeCellChanged: ISignal<this, Cell | null>;
A signal emitted when the current active cell changes.
#### Notes If there is no cell with the focus, then
null
will be emitted.
property selectionChanged
readonly selectionChanged: ISignal<this, void>;
A signal emitted when the selection state changes.
Enums
enum RunningStatus
enum RunningStatus { Idle = -1, Error = -0.5, Scheduled = 0, Running = 1,}
Cell running status
Type Aliases
type NotebookMode
type NotebookMode = 'command' | 'edit';
The interactivity modes for the notebook.
Namespaces
namespace CommandEditStatus
namespace CommandEditStatus {}
A namespace for CommandEdit statics.
class Model
class Model extends VDomModel {}
A VDomModel for the CommandEdit renderer.
property notebookMode
readonly notebookMode: NotebookMode;
The current mode of the current notebook.
namespace ExecutionIndicator
namespace ExecutionIndicator {}
A namespace for ExecutionIndicator statics.
function createExecutionIndicatorItem
createExecutionIndicatorItem: ( panel: NotebookPanel, translator?: ITranslator, loadSettings?: Promise<ISettingRegistry.ISettings>) => Widget;
function getSettingValue
getSettingValue: (settings: ISettingRegistry.ISettings) => { showOnToolBar: boolean; showProgress: boolean;};
class Model
class Model extends VDomModel {}
A VDomModel for the execution status indicator.
constructor
constructor();
property currentNotebook
readonly currentNotebook: Notebook;
The current activated notebook in model.
property displayOption
displayOption: Private.DisplayOption;
The display options for progress bar and elapsed time.
property renderFlag
readonly renderFlag: boolean;
method attachNotebook
attachNotebook: ( data: { content?: Notebook; context?: ISessionContext } | null) => void;
Attach a notebook with session context to model in order to keep track of multiple notebooks. If a session context is already attached, only set current activated notebook to input.
Parameter data
The notebook and session context to be attached to model
method executionState
executionState: (nb: Notebook) => IExecutionState | undefined;
Get the execution state associated with a notebook.
Parameter nb
The notebook used to identify execution state.
Returns
- The associated execution state.
method updateRenderOption
updateRenderOption: (options: { showOnToolBar: boolean; showProgress: boolean;}) => void;
interface IExecutionState
interface IExecutionState {}
Execution state of a notebook.
property executionStatus
executionStatus: string;
Execution status of kernel, this status is deducted from the number of scheduled code cells.
property interval
interval: number;
Id of
setInterval
, it is used to start / stop the elapsed time counter.
property kernelStatus
kernelStatus: ISessionContext.KernelDisplayStatus;
Current status of kernel.
property needReset
needReset: boolean;
Flag to reset the execution state when a code cell is scheduled for executing.
property scheduledCell
scheduledCell: Set<string>;
Set of messages scheduled for executing,
executionStatus
is set toidle if the length of this set is 0 and to
busy` otherwise.
property scheduledCellNumber
scheduledCellNumber: number;
Total number of cells requested for executing, it is used to compute the execution progress in progress bar.
property timeout
timeout: number;
Id of
setTimeout
, it is used to create / clear the state resetting request.
property totalTime
totalTime: number;
Total execution time.
namespace INotebookCellExecutor
namespace INotebookCellExecutor {}
Notebook cell executor namespace
interface IRunCellOptions
interface IRunCellOptions {}
Execution options for notebook cell executor.
property cell
cell: Cell;
Cell to execute
property notebook
notebook: INotebookModel;
Notebook to which the cell belongs
property notebookConfig
notebookConfig: StaticNotebook.INotebookConfig;
Notebook widget configuration
property onCellExecuted
onCellExecuted: (args: { cell: Cell; success: boolean; error?: KernelError | null;}) => void;
A callback to notify a cell completed execution.
property onCellExecutionScheduled
onCellExecutionScheduled: (args: { cell: Cell }) => void;
A callback to notify that a cell execution is scheduled.
property sessionContext
sessionContext?: ISessionContext;
Document session context
property sessionDialogs
sessionDialogs?: ISessionContextDialogs;
Session dialogs
property translator
translator?: ITranslator;
Application translator
namespace INotebookTools
namespace INotebookTools {}
The namespace for NotebookTools class statics.
interface IAddOptions
interface IAddOptions {}
The options used to add an item to the notebook tools.
interface IAddSectionOptions
interface IAddSectionOptions {}
The options used to add a section to the notebook tools.
property label
label?: string;
The label of the new section.
property rank
rank?: number;
The rank order of the section among its siblings.
property sectionName
sectionName: string;
The name of the new section.
property tool
tool?: INotebookTools.ITool;
The tool to add to the notebook tools area.
interface ITool
interface ITool extends Widget {}
property notebookTools
notebookTools: INotebookTools;
The notebook tools object.
namespace Notebook
namespace Notebook {}
The namespace for the
Notebook
class statics.
class ContentFactory
class ContentFactory extends StaticNotebook.ContentFactory {}
The default implementation of a notebook content factory..
#### Notes Override methods on this class to customize the default notebook factory methods that create notebook content.
interface IContentFactory
interface IContentFactory extends StaticNotebook.IContentFactory {}
The content factory for the notebook widget.
interface IOptions
interface IOptions extends StaticNotebook.IOptions {}
An options object for initializing a notebook widget.
namespace Notebook.ContentFactory
namespace Notebook.ContentFactory {}
A namespace for the notebook content factory.
interface IOptions
interface IOptions extends StaticNotebook.ContentFactory.IOptions {}
An options object for initializing a notebook content factory.
namespace NotebookActions
namespace NotebookActions {}
A namespace for
NotebookActions
static methods.
function accessNextHistory
accessNextHistory: (notebook: Notebook) => Promise<void>;
Access next notebook history.
Parameter notebook
The target notebook widget.
function accessPreviousHistory
accessPreviousHistory: (notebook: Notebook) => Promise<void>;
function changeCellType
changeCellType: ( notebook: Notebook, value: nbformat.CellType, translator?: ITranslator) => void;
Change the selected cell type(s).
Parameter notebook
The target notebook widget.
Parameter value
The target cell type.
Parameter translator
The application translator.
#### Notes It should preserve the widget mode. This action can be undone. The existing selection will be cleared. Any cells converted to markdown will be unrendered.
function clearAllOutputs
clearAllOutputs: (notebook: Notebook) => void;
Clear all the code outputs on the widget.
Parameter notebook
The target notebook widget.
#### Notes The widget
mode
will be preserved.
function clearOutputs
clearOutputs: (notebook: Notebook) => void;
Clear the code outputs of the selected cells.
Parameter notebook
The target notebook widget.
#### Notes The widget
mode
will be preserved.
function collapseAllHeadings
collapseAllHeadings: (notebook: Notebook) => any;
Collapse all cells in given notebook.
Parameter notebook
The target notebook widget.
function copy
copy: (notebook: Notebook) => void;
Copy the selected cell(s) data to a clipboard.
Parameter notebook
The target notebook widget.
function cut
cut: (notebook: Notebook) => void;
Cut the selected cell data to a clipboard.
Parameter notebook
The target notebook widget.
#### Notes This action can be undone. A new code cell is added if all cells are cut.
function deleteCells
deleteCells: (notebook: Notebook) => void;
Delete the selected cells.
Parameter notebook
The target notebook widget.
#### Notes The cell after the last selected cell will be activated. It will add a code cell if all cells are deleted. This action can be undone.
function deselectAll
deselectAll: (notebook: Notebook) => void;
Deselect all of the cells of the notebook.
Parameter notebook
the target notebook widget.
function disableOutputScrolling
disableOutputScrolling: (notebook: Notebook) => void;
Disable output scrolling for all selected cells.
Parameter notebook
The target notebook widget.
function duplicate
duplicate: ( notebook: Notebook, mode?: 'below' | 'belowSelected' | 'above' | 'replace') => void;
Duplicate selected cells in the notebook without using the application clipboard.
Parameter notebook
The target notebook widget.
Parameter mode
the mode of adding cells: 'below' (default) adds cells below the active cell, 'belowSelected' adds cells below all selected cells, 'above' adds cells above the active cell, and 'replace' removes the currently selected cells and adds cells in their place.
#### Notes The last pasted cell becomes the active cell. This is a no-op if there is no cell data on the clipboard. This action can be undone.
function enableOutputScrolling
enableOutputScrolling: (notebook: Notebook) => void;
Enable output scrolling for all selected cells.
Parameter notebook
The target notebook widget.
function expandAllHeadings
expandAllHeadings: (notebook: Notebook) => any;
Un-collapse all cells in given notebook.
Parameter notebook
The target notebook widget.
function expandParent
expandParent: (cell: Cell, notebook: Notebook) => void;
Finds the "parent" heading of the given cell and expands. Used for the case that a cell becomes active that is within a collapsed heading.
Parameter cell
"Child" cell that has become the active cell
Parameter notebook
The target notebook widget.
function extendSelectionAbove
extendSelectionAbove: (notebook: Notebook, toTop?: boolean) => void;
Extend the selection to the cell above.
Parameter notebook
The target notebook widget.
Parameter toTop
If true, denotes selection to extend to the top.
#### Notes This is a no-op if the first cell is the active cell. The new cell will be activated.
function extendSelectionBelow
extendSelectionBelow: (notebook: Notebook, toBottom?: boolean) => void;
Extend the selection to the cell below.
Parameter notebook
The target notebook widget.
Parameter toBottom
If true, denotes selection to extend to the bottom.
#### Notes This is a no-op if the last cell is the active cell. The new cell will be activated.
function findNextParentHeading
findNextParentHeading: (cell: Cell, notebook: Notebook) => number;
Finds the next heading that isn't a child of the given markdown heading.
Parameter cell
"Child" cell that has become the active cell
Parameter notebook
The target notebook widget.
function focusActiveCell
focusActiveCell: ( notebook: Notebook, options?: { waitUntilReady?: boolean; preventScroll?: boolean }) => Promise<void>;
If the notebook has an active cell, focus it.
Parameter notebook
The target notebook widget
Parameter options
Optional options to change the behavior of this function
Parameter
options.waitUntilReady If true, do not call focus until activeCell.ready is resolved
Parameter
options.preventScroll If true, do not scroll the active cell into view
Returns
a promise that resolves when focus has been called on the active cell's node.
#### Notes By default, waits until after the active cell has been attached unless called with { waitUntilReady: false }
function getHeadingInfo
getHeadingInfo: (cell: Cell) => { isHeading: boolean; headingLevel: number; collapsed?: boolean;};
If given cell is a markdown heading, returns the heading level. If given cell is not markdown, returns 7 (there are only 6 levels of markdown headings)
Parameter cell
The target cell widget.
function hideAllCode
hideAllCode: (notebook: Notebook) => void;
Hide the code on all code cells.
Parameter notebook
The target notebook widget.
function hideAllOutputs
hideAllOutputs: (notebook: Notebook) => void;
Hide the output on all code cells.
Parameter notebook
The target notebook widget.
function hideCode
hideCode: (notebook: Notebook) => void;
Hide the code on selected code cells.
Parameter notebook
The target notebook widget.
function hideOutput
hideOutput: (notebook: Notebook) => void;
Hide the output on selected code cells.
Parameter notebook
The target notebook widget.
function insertAbove
insertAbove: (notebook: Notebook) => void;
Insert a new code cell above the active cell or in index 0 if the notebook is empty.
Parameter notebook
The target notebook widget.
#### Notes The widget mode will be preserved. This action can be undone. The existing selection will be cleared. The new cell will the active cell.
function insertBelow
insertBelow: (notebook: Notebook) => void;
Insert a new code cell below the active cell or in index 0 if the notebook is empty.
Parameter notebook
The target notebook widget.
#### Notes The widget mode will be preserved. This action can be undone. The existing selection will be cleared. The new cell will be the active cell.
function insertSameLevelHeadingAbove
insertSameLevelHeadingAbove: (notebook: Notebook) => Promise<void>;
Insert new heading of same level above active cell.
Parameter notebook
The target notebook widget
function insertSameLevelHeadingBelow
insertSameLevelHeadingBelow: (notebook: Notebook) => Promise<void>;
Insert new heading of same level at end of current section.
Parameter notebook
The target notebook widget
function mergeCells
mergeCells: (notebook: Notebook, mergeAbove?: boolean) => void;
Merge the selected cells.
Parameter notebook
The target notebook widget.
Parameter mergeAbove
If only one cell is selected, indicates whether to merge it with the cell above (true) or below (false, default).
#### Notes The widget mode will be preserved. If only one cell is selected and
mergeAbove
is true, the above cell will be selected. If only one cell is selected andmergeAbove
is false, the below cell will be selected. If the active cell is a code cell, its outputs will be cleared. This action can be undone. The final cell will have the same type as the active cell. If the active cell is a markdown cell, it will be unrendered.
function moveDown
moveDown: (notebook: Notebook) => void;
Move the selected cell(s) down.
Parameter notebook
= The target notebook widget.
function moveUp
moveUp: (notebook: Notebook) => void;
Move the selected cell(s) up.
Parameter notebook
The target notebook widget.
function paste
paste: ( notebook: Notebook, mode?: 'below' | 'belowSelected' | 'above' | 'replace') => void;
Paste cells from the application clipboard.
Parameter notebook
The target notebook widget.
Parameter mode
the mode of adding cells: 'below' (default) adds cells below the active cell, 'belowSelected' adds cells below all selected cells, 'above' adds cells above the active cell, and 'replace' removes the currently selected cells and adds cells in their place.
#### Notes The last pasted cell becomes the active cell. This is a no-op if there is no cell data on the clipboard. This action can be undone.
function redo
redo: (notebook: Notebook) => void;
Redo a cell action.
Parameter notebook
The target notebook widget.
#### Notes This is a no-op if there are no cell actions to redo.
function renderAllMarkdown
renderAllMarkdown: (notebook: Notebook) => Promise<boolean>;
function renderDefault
renderDefault: (notebook: Notebook) => void;
Render not side-by-side.
Parameter notebook
The target notebook widget.
function renderSideBySide
renderSideBySide: (notebook: Notebook) => void;
Render side-by-side.
Parameter notebook
The target notebook widget.
function replaceSelection
replaceSelection: (notebook: Notebook, text: string) => void;
Replaces the selection in the active cell of the notebook.
Parameter notebook
The target notebook widget.
Parameter text
The text to replace the selection.
function run
run: ( notebook: Notebook, sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator) => Promise<boolean>;
Run the selected cell(s).
Parameter notebook
The target notebook widget.
Parameter sessionContext
The client session object.
Parameter sessionDialogs
The session dialogs.
Parameter translator
The application translator.
#### Notes The last selected cell will be activated, but not scrolled into view. The existing selection will be cleared. An execution error will prevent the remaining code cells from executing. All markdown cells will be rendered.
function runAll
runAll: ( notebook: Notebook, sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator) => Promise<boolean>;
Run all of the cells in the notebook.
Parameter notebook
The target notebook widget.
Parameter sessionContext
The client session object.
Parameter sessionDialogs
The session dialogs.
Parameter translator
The application translator.
#### Notes The existing selection will be cleared. An execution error will prevent the remaining code cells from executing. All markdown cells will be rendered. The last cell in the notebook will be activated and scrolled into view.
function runAllAbove
runAllAbove: ( notebook: Notebook, sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator) => Promise<boolean>;
Run all of the cells before the currently active cell (exclusive).
Parameter notebook
The target notebook widget.
Parameter sessionContext
The client session object.
Parameter sessionDialogs
The session dialogs.
Parameter translator
The application translator.
#### Notes The existing selection will be cleared. An execution error will prevent the remaining code cells from executing. All markdown cells will be rendered. The currently active cell will remain selected.
function runAllBelow
runAllBelow: ( notebook: Notebook, sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator) => Promise<boolean>;
Run all of the cells after the currently active cell (inclusive).
Parameter notebook
The target notebook widget.
Parameter sessionContext
The client session object.
Parameter sessionDialogs
The session dialogs.
Parameter translator
The application translator.
#### Notes The existing selection will be cleared. An execution error will prevent the remaining code cells from executing. All markdown cells will be rendered. The last cell in the notebook will be activated and scrolled into view.
function runAndAdvance
runAndAdvance: ( notebook: Notebook, sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator) => Promise<boolean>;
Run the selected cell(s) and advance to the next cell.
Parameter notebook
The target notebook widget.
Parameter sessionContext
The client session object.
Parameter sessionDialogs
The session dialogs.
Parameter translator
The application translator.
#### Notes The existing selection will be cleared. The cell after the last selected cell will be activated and scrolled into view. An execution error will prevent the remaining code cells from executing. All markdown cells will be rendered. If the last selected cell is the last cell, a new code cell will be created in
'edit'
mode. The new cell creation can be undone.
function runAndInsert
runAndInsert: ( notebook: Notebook, sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator) => Promise<boolean>;
Run the selected cell(s) and insert a new code cell.
Parameter notebook
The target notebook widget.
Parameter sessionContext
The client session object.
Parameter sessionDialogs
The session dialogs.
Parameter translator
The application translator.
#### Notes An execution error will prevent the remaining code cells from executing. All markdown cells will be rendered. The widget mode will be set to
'edit'
after running. The existing selection will be cleared. The cell insert can be undone. The new cell will be scrolled into view.
function runCells
runCells: ( notebook: Notebook, cells: readonly Cell[], sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator) => Promise<boolean>;
Run specified cells.
Parameter notebook
The target notebook widget.
Parameter cells
The cells to run.
Parameter sessionContext
The client session object.
Parameter sessionDialogs
The session dialogs.
Parameter translator
The application translator.
#### Notes The existing selection will be preserved. The mode will be changed to command. An execution error will prevent the remaining code cells from executing. All markdown cells will be rendered.
function selectAbove
selectAbove: (notebook: Notebook) => void;
Select the above the active cell.
Parameter notebook
The target notebook widget.
#### Notes The widget mode will be preserved. This is a no-op if the first cell is the active cell. This will skip any collapsed cells. The existing selection will be cleared.
function selectAll
selectAll: (notebook: Notebook) => void;
Select all of the cells of the notebook.
Parameter notebook
the target notebook widget.
function selectBelow
selectBelow: (notebook: Notebook) => void;
Select the cell below the active cell.
Parameter notebook
The target notebook widget.
#### Notes The widget mode will be preserved. This is a no-op if the last cell is the active cell. This will skip any collapsed cells. The existing selection will be cleared.
function selectHeadingAboveOrCollapseHeading
selectHeadingAboveOrCollapseHeading: (notebook: Notebook) => void;
Select the heading above the active cell or, if already at heading, collapse it.
Parameter notebook
The target notebook widget.
#### Notes The widget mode will be preserved. This is a no-op if the active cell is the topmost heading in collapsed state The existing selection will be cleared.
function selectHeadingBelowOrExpandHeading
selectHeadingBelowOrExpandHeading: (notebook: Notebook) => void;
Select the heading below the active cell or, if already at heading, expand it.
Parameter notebook
The target notebook widget.
#### Notes The widget mode will be preserved. This is a no-op if the active cell is the last heading in expanded state The existing selection will be cleared.
function selectLastRunCell
selectLastRunCell: (notebook: Notebook) => void;
Go to the last cell that is run or current if it is running.
Note: This requires execution timing to be toggled on or this will have no effect.
Parameter notebook
The target notebook widget.
function setCellCollapse
setCellCollapse: (cell: Cell, collapsing: boolean) => any;
If cell is a markdown heading, sets the headingCollapsed field, and otherwise hides the cell.
Parameter cell
The cell to collapse / expand
Parameter collapsing
Whether to collapse or expand the given cell
function setHeadingCollapse
setHeadingCollapse: ( cell: Cell, collapsing: boolean, notebook: StaticNotebook) => number;
Set the given cell and ** all "child" cells ** to the given collapse / expand if cell is a markdown header.
Parameter cell
The cell
Parameter collapsing
Whether to collapse or expand the cell
Parameter notebook
The target notebook widget.
function setMarkdownHeader
setMarkdownHeader: ( notebook: Notebook, level: number, translator?: ITranslator) => void;
Set the markdown header level.
Parameter notebook
The target notebook widget.
Parameter level
The header level.
Parameter translator
The application translator.
#### Notes All selected cells will be switched to markdown. The level will be clamped between 1 and 6. If there is an existing header, it will be replaced. There will always be one blank space after the header. The cells will be unrendered.
function showAllCode
showAllCode: (notebook: Notebook) => void;
Show the code on all code cells.
Parameter notebook
The target notebook widget.
function showAllOutputs
showAllOutputs: (notebook: Notebook) => void;
Show the output on all code cells.
Parameter notebook
The target notebook widget.
function showCode
showCode: (notebook: Notebook) => void;
Show the code on selected code cells.
Parameter notebook
The target notebook widget.
function showOutput
showOutput: (notebook: Notebook) => void;
Show the output on selected code cells.
Parameter notebook
The target notebook widget.
function splitCell
splitCell: (notebook: Notebook) => void;
Split the active cell into two or more cells.
Parameter notebook
The target notebook widget.
#### Notes It will preserve the existing mode. The last cell will be activated if no selection is found. If text was selected, the cell containing the selection will be activated. The existing selection will be cleared. The activated cell will have focus and the cursor will remain in the initial position. The leading whitespace in the second cell will be removed. If there is no content, two empty cells will be created. Both cells will have the same type as the original cell. This action can be undone.
function toggleAllLineNumbers
toggleAllLineNumbers: (notebook: Notebook) => void;
Toggle the line number of all cells.
Parameter notebook
The target notebook widget.
#### Notes The original state is based on the state of the active cell. The
mode
of the widget will be preserved.
function toggleCurrentHeadingCollapse
toggleCurrentHeadingCollapse: (notebook: Notebook) => any;
Toggles the collapse state of the active cell of the given notebook and ** all of its "child" cells ** if the cell is a heading.
Parameter notebook
The target notebook widget.
function toggleOutput
toggleOutput: (notebook: Notebook) => void;
Toggle output visibility on selected code cells. If at least one output is visible, all outputs are hidden. If no outputs are visible, all outputs are made visible.
Parameter notebook
The target notebook widget.
function trust
trust: (notebook: Notebook, translator?: ITranslator) => Promise<void>;
Trust the notebook after prompting the user.
Parameter notebook
The target notebook widget.
Parameter translator
The application translator.
Returns
a promise that resolves when the transaction is finished.
#### Notes No dialog will be presented if the notebook is already trusted.
function undo
undo: (notebook: Notebook) => void;
Undo a cell action.
Parameter notebook
The target notebook widget.
#### Notes This is a no-op if there are no cell actions to undo.
namespace NotebookHistory
namespace NotebookHistory {}
A namespace for NotebookHistory statics.
interface IOptions
interface IOptions {}
The initialization options for a console history object.
property sessionContext
sessionContext: ISessionContext;
The client session used by the foreign handler.
property translator
translator?: ITranslator;
The application language translator.
namespace NotebookModel
namespace NotebookModel {}
The namespace for the
NotebookModel
class statics.
interface IOptions
interface IOptions extends DocumentRegistry.IModelOptions<ISharedNotebook> {}
An options object for initializing a notebook model.
property defaultCell
defaultCell?: 'code' | 'markdown' | 'raw';
Default cell type.
property disableDocumentWideUndoRedo
disableDocumentWideUndoRedo?: boolean;
Defines if the document can be undo/redo.
Default: true
Modifiers
@experimental
@alpha
property translator
translator?: ITranslator;
Language translator.
namespace NotebookModelFactory
namespace NotebookModelFactory {}
The namespace for notebook model factory statics.
interface IOptions
interface IOptions {}
The options used to initialize a NotebookModelFactory.
property collaborative
collaborative?: boolean;
Whether the model is collaborative or not.
property disableDocumentWideUndoRedo
disableDocumentWideUndoRedo?: boolean;
Defines if the document can be undo/redo.
Default: true
Modifiers
@experimental
@alpha
namespace NotebookPanel
namespace NotebookPanel {}
A namespace for
NotebookPanel
statics.
variable IContentFactory
const IContentFactory: Token<IContentFactory>;
The notebook renderer token.
class ContentFactory
class ContentFactory extends Notebook.ContentFactory implements IContentFactory {}
The default implementation of an
IContentFactory
.
method createNotebook
createNotebook: (options: Notebook.IOptions) => Notebook;
Create a new content area for the panel.
interface IConfig
interface IConfig {}
Notebook config interface for NotebookPanel
property autoStartDefault
autoStartDefault: boolean;
Whether to automatically start the preferred kernel
property editorConfig
editorConfig: StaticNotebook.IEditorConfig;
A config object for cell editors
property kernelShutdown
kernelShutdown: boolean;
Whether to shut down the kernel when closing the panel or not
property notebookConfig
notebookConfig: StaticNotebook.INotebookConfig;
A config object for notebook widget
interface IContentFactory
interface IContentFactory extends Notebook.IContentFactory {}
A content factory interface for NotebookPanel.
method createNotebook
createNotebook: (options: Notebook.IOptions) => Notebook;
Create a new content area for the panel.
namespace NotebookTools
namespace NotebookTools {}
The namespace for NotebookTools class statics.
variable ActiveCellMessage
const ActiveCellMessage: ConflatableMessage;
A singleton conflatable
'activecell-changed'
message.
variable ActiveNotebookPanelMessage
const ActiveNotebookPanelMessage: ConflatableMessage;
A singleton conflatable
'activenotebookpanel-changed'
message.
variable SelectionMessage
const SelectionMessage: ConflatableMessage;
A singleton conflatable
'selection-changed'
message.
class MetadataEditorTool
class MetadataEditorTool extends Tool {}
A raw metadata editor.
constructor
constructor(options: MetadataEditorTool.IOptions);
Construct a new raw metadata tool.
property editor
readonly editor: JSONEditor;
The editor used by the tool.
method createEditor
protected createEditor: () => void;
method onActiveNotebookPanelChanged
protected onActiveNotebookPanelChanged: (msg: Message) => void;
Handle a change to the notebook.
class Tool
class Tool extends Widget implements INotebookTools.ITool {}
The base notebook tool, meant to be subclassed.
property notebookTools
notebookTools: INotebookTools;
The notebook tools object.
method dispose
dispose: () => void;
method onActiveCellChanged
protected onActiveCellChanged: (msg: Message) => void;
Handle a change to the active cell.
#### Notes The default implementation is a no-op.
method onActiveCellMetadataChanged
protected onActiveCellMetadataChanged: ( msg: ObservableJSON.ChangeMessage) => void;
Handle a change to the metadata of the active cell.
#### Notes The default implementation is a no-op.
method onActiveNotebookPanelChanged
protected onActiveNotebookPanelChanged: (msg: Message) => void;
Handle a change to the notebook panel.
#### Notes The default implementation is a no-op.
method onActiveNotebookPanelMetadataChanged
protected onActiveNotebookPanelMetadataChanged: ( msg: ObservableJSON.ChangeMessage) => void;
Handle a change to the metadata of the active cell.
#### Notes The default implementation is a no-op.
method onSelectionChanged
protected onSelectionChanged: (msg: Message) => void;
Handle a change to the selection.
#### Notes The default implementation is a no-op.
method processMessage
processMessage: (msg: Message) => void;
Process a message sent to the widget.
Parameter msg
The message sent to the widget.
interface IAddOptions
interface IAddOptions {}
The options used to add an item to the notebook tools.
interface IAddSectionOptions
interface IAddSectionOptions {}
The options used to add a section to the notebook tools.
property label
label?: string;
The label of the new section.
property rank
rank?: number;
The rank order of the section among its siblings.
property sectionName
sectionName: string;
The name of the new section.
property tool
tool?: INotebookTools.ITool;
The tool to add to the notebook tools area.
interface IOptions
interface IOptions {}
The options used to create a NotebookTools object.
property tracker
tracker: INotebookTracker;
The notebook tracker used by the notebook tools.
property translator
translator?: ITranslator;
Language translator.
interface IToolPanel
interface IToolPanel {}
Interface for an extended panel section.
type ReadonlyPartialJSONOptionValueArray
type ReadonlyPartialJSONOptionValueArray = [ ReadonlyPartialJSONValue | undefined, ReadonlyPartialJSONValue][];
A type alias for a readonly partial JSON tuples
[option, value]
.option
should be localized.Note: Partial here means that JSON object attributes can be
undefined
.
namespace NotebookTools.MetadataEditorTool
namespace NotebookTools.MetadataEditorTool {}
The namespace for
MetadataEditorTool
static data.
interface IOptions
interface IOptions {}
The options used to initialize a metadata editor tool.
property collapsed
collapsed?: boolean;
Initial collapse state, defaults to true.
property editorFactory
editorFactory: CodeEditor.Factory;
The editor factory used by the tool.
property label
label?: string;
The label for the JSON editor
property translator
translator?: ITranslator;
Language translator.
namespace NotebookTrustStatus
namespace NotebookTrustStatus {}
A namespace for NotebookTrust statics.
class Model
class Model extends VDomModel {}
A VDomModel for the NotebookTrust status item.
property activeCellTrusted
readonly activeCellTrusted: boolean;
Whether the active cell is trusted.
property notebook
notebook: Notebook;
The current notebook for the model.
property totalCells
readonly totalCells: number;
The total number of code cells in the current notebook.
property trustedCells
readonly trustedCells: number;
The number of trusted code cells in the current notebook.
namespace NotebookWidgetFactory
namespace NotebookWidgetFactory {}
The namespace for
NotebookWidgetFactory
statics.
interface IFactory
interface IFactory extends DocumentRegistry.IWidgetFactory<NotebookPanel, INotebookModel> {}
The interface for a notebook widget factory.
property autoStartDefault
autoStartDefault: boolean;
Whether to automatically start the preferred kernel.
property editorConfig
editorConfig: StaticNotebook.IEditorConfig;
A configuration object for cell editor settings.
property notebookConfig
notebookConfig: StaticNotebook.INotebookConfig;
A configuration object for notebook settings.
property shutdownOnClose
shutdownOnClose: boolean;
Whether the kernel should be shutdown when the widget is closed.
interface IOptions
interface IOptions<T extends NotebookPanel> extends DocumentRegistry.IWidgetFactoryOptions<T> {}
The options used to construct a
NotebookWidgetFactory
.
property contentFactory
contentFactory: NotebookPanel.IContentFactory;
A notebook panel content factory.
property editorConfig
editorConfig?: StaticNotebook.IEditorConfig;
The notebook cell editor configuration.
property mimeTypeService
mimeTypeService: IEditorMimeTypeService;
The service used to look up mime types.
property notebookConfig
notebookConfig?: StaticNotebook.INotebookConfig;
The notebook configuration.
property rendermime
rendermime: IRenderMimeRegistry;
property translator
translator?: ITranslator;
The application language translator.
namespace StaticNotebook
namespace StaticNotebook {}
The namespace for the
StaticNotebook
class statics.
variable defaultEditorConfig
const defaultEditorConfig: IEditorConfig;
Default configuration options for cell editors.
variable defaultNotebookConfig
const defaultNotebookConfig: INotebookConfig;
Default configuration options for notebooks.
class ContentFactory
class ContentFactory extends Cell.ContentFactory implements IContentFactory {}
The default implementation of an
IContentFactory
.
method createCodeCell
createCodeCell: (options: CodeCell.IOptions) => CodeCell;
Create a new code cell widget.
#### Notes If no cell content factory is passed in with the options, the one on the notebook content factory is used.
method createMarkdownCell
createMarkdownCell: (options: MarkdownCell.IOptions) => MarkdownCell;
Create a new markdown cell widget.
#### Notes If no cell content factory is passed in with the options, the one on the notebook content factory is used.
method createRawCell
createRawCell: (options: RawCell.IOptions) => RawCell;
Create a new raw cell widget.
#### Notes If no cell content factory is passed in with the options, the one on the notebook content factory is used.
interface IContentFactory
interface IContentFactory extends Cell.IContentFactory {}
A factory for creating notebook content.
#### Notes This extends the content factory of the cell itself, which extends the content factory of the output area and input area. The result is that there is a single factory for creating all child content of a notebook.
method createCodeCell
createCodeCell: (options: CodeCell.IOptions) => CodeCell;
Create a new code cell widget.
method createMarkdownCell
createMarkdownCell: (options: MarkdownCell.IOptions) => MarkdownCell;
Create a new markdown cell widget.
method createRawCell
createRawCell: (options: RawCell.IOptions) => RawCell;
Create a new raw cell widget.
interface IEditorConfig
interface IEditorConfig {}
A config object for the cell editors.
interface INotebookConfig
interface INotebookConfig {}
A config object for the notebook widget
property accessKernelHistory
accessKernelHistory?: boolean;
property defaultCell
defaultCell: nbformat.CellType;
The default type for new notebook cells.
property disableDocumentWideUndoRedo
disableDocumentWideUndoRedo: boolean;
Defines if the document can be undo/redo.
property enableKernelInitNotification
enableKernelInitNotification: boolean;
Whether to display notification if code cell is run while kernel is still initializing.
property inputHistoryScope
inputHistoryScope: 'global' | 'session';
Whether to split stdin line history by kernel session or keep globally accessible.
property maxNumberOutputs
maxNumberOutputs: number;
Defines the maximum number of outputs per cell.
property overscanCount
overscanCount: number;
Number of cells to render in addition to those visible in the viewport.
### Notes In 'full' windowing mode, this is the number of cells above and below the viewport. In 'defer' windowing mode, this is the number of cells to render initially in addition to the one of the viewport.
property recordTiming
recordTiming: boolean;
Should timing be recorded in metadata
property renderingLayout
renderingLayout: RenderingLayout;
Defines the rendering layout to use.