@jupyterlab/notebook
- Version 3.6.1
- Published
- 570 kB
- 24 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
- deselect()
- deselectAll()
- dispose()
- extendContiguousSelectionTo()
- getContiguousSelection()
- handleEvent()
- isSelected()
- isSelectedOrActive()
- lastClipboardInteraction
- mode
- onActivateRequest()
- onAfterAttach()
- onAfterShow()
- onBeforeDetach()
- onBeforeHide()
- onCellInserted()
- onCellMoved()
- onCellRemoved()
- onModelChanged()
- onResize()
- onUpdateRequest()
- scrollToCell()
- scrollToPosition()
- select()
- selectionChanged
- setFragment()
- stateChanged
StaticNotebook
- codeMimetype
- contentFactory
- dispose()
- editorConfig
- fullyRendered
- model
- modelChanged
- modelContentChanged
- notebookConfig
- onCellInserted()
- onCellMoved()
- onCellRemoved()
- onMetadataChanged()
- onModelChanged()
- onModelContentChanged()
- placeholderCellRendered
- remainingCellToRenderCount
- renderingLayout
- renderingLayoutChanged
- rendermime
- translator
- widgets
Interfaces
Type Aliases
Namespaces
NotebookActions
- changeCellType()
- clearAllOutputs()
- clearOutputs()
- collapseAll()
- copy()
- cut()
- deleteCells()
- deselectAll()
- disableOutputScrolling()
- duplicate()
- enableOutputScrolling()
- expandAllHeadings()
- expandParent()
- extendSelectionAbove()
- extendSelectionBelow()
- findNextParentHeading()
- getHeadingInfo()
- hideAllCode()
- hideAllOutputs()
- hideCode()
- hideOutput()
- insertAbove()
- insertBelow()
- mergeCells()
- moveDown()
- moveUp()
- paste()
- redo()
- renderAllMarkdown()
- renderDefault()
- renderSideBySide()
- replaceSelection()
- run()
- runAll()
- runAllAbove()
- runAllBelow()
- runAndAdvance()
- runAndInsert()
- selectAbove()
- selectAll()
- selectBelow()
- selectLastRunCell()
- setCellCollapse()
- setHeadingCollapse()
- setMarkdownHeader()
- showAllCode()
- showAllOutputs()
- showCode()
- showOutput()
- splitCell()
- toggleAllLineNumbers()
- toggleCurrentHeadingCollapse()
- trust()
- undo()
Variables
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) => React.ReactElement<ExecutionIndicatorComponent.IProps>;
A react functional component for rendering execution indicator.
Classes
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, Cell>;
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 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 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 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 onCellMoved
protected onCellMoved: (fromIndex: number, toIndex: number) => void;
Handle a cell being moved.
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) => void;
Scroll so that the given cell is in view. Selects and activates cell.
Parameter cell
A cell in the notebook widget.
method scrollToPosition
scrollToPosition: (position: number, threshold?: number) => void;
Scroll so that the given position is centered.
Parameter position
The vertical position in the notebook widget.
Parameter threshold
An optional threshold for the scroll (0-50, defaults to 25).
#### Notes If the position is within the threshold percentage of the widget height, measured from the center of the widget, the scroll position will not be changed. A threshold of 0 means we will always scroll so the position is centered, and a threshold of 50 means scrolling only happens if position is outside the current window.
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) => void;
Set URI fragment identifier.
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 selectionExecuted
static readonly selectionExecuted: ISignal< any, { notebook: Notebook; lastCell: Cell }>;
A signal that emits whenever a cell execution is scheduled.
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: IObservableUndoableList<ICellModel>;
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 contentFactory
readonly contentFactory: NotebookModel.IContentFactory;
The cell model factory for the notebook.
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 isInitialized
readonly isInitialized: boolean;
If the model is initialized or not.
property metadata
readonly metadata: IObservableJSON;
The metadata associated with the notebook.
property modelDB
readonly modelDB: IModelDB;
The underlying
IModelDB
instance in which model data is stored.
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: models.ISharedNotebook;
The shared notebook model.
property stateChanged
readonly stateChanged: ISignal<this, IChangedArgs<any>>;
A signal emitted when the document state changes.
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 initialize
initialize: () => void;
Initialize the model with its current state.
# Notes Adds an empty code cell if the model is empty and clears undo state.
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 contentFactory
readonly contentFactory: NotebookModel.IContentFactory;
The content model factory used by the NotebookModelFactory.
property contentType
readonly contentType: Contents.ContentType;
The content type of the file.
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: ( languagePreference?: string, modelDB?: IModelDB, isInitialized?: boolean, collaborationEnabled?: boolean) => INotebookModel;
Create a new model for a given path.
Parameter languagePreference
An optional kernel language preference.
Parameter modelDB
An optional model storage.
Parameter isInitialized
Whether the model is initialized or not.
Parameter collaborationEnabled
Whether collaboration is enabled at the application level or not (default
false
).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 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 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.
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 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.
method defaultToolbarFactory
protected defaultToolbarFactory: ( widget: NotebookPanel) => DocumentRegistry.IToolbarItem[];
Default factory for toolbar items to be added after the widget is created.
class StaticNotebook
class StaticNotebook extends Widget {}
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 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 fullyRendered
readonly fullyRendered: ISignal<this, boolean>;
A signal emitted when the notebook is fully rendered.
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 placeholderCellRendered
readonly placeholderCellRendered: ISignal<this, Cell>;
A signal emitted when the a placeholder cell is rendered.
property remainingCellToRenderCount
readonly remainingCellToRenderCount: number;
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 dispose
dispose: () => void;
Dispose of the resources held by the widget.
method onCellInserted
protected onCellInserted: (index: number, cell: Cell) => void;
Handle a cell being inserted.
The default implementation is a no-op
method onCellMoved
protected onCellMoved: (fromIndex: number, toIndex: number) => void;
Handle a cell being moved.
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: IObservableMap<any>, args: IObservableMap.IChangedArgs<ReadonlyPartialJSONValue>) => 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.
Interfaces
interface INotebookModel
interface INotebookModel extends DocumentRegistry.IModel {}
The definition of a model object for a notebook widget.
property cells
readonly cells: IObservableUndoableList<ICellModel>;
The list of cells in the notebook.
property contentFactory
readonly contentFactory: NotebookModel.IContentFactory;
The cell model factory for the notebook.
property deletedCells
readonly deletedCells: string[];
The array of deleted cells since the notebook was last run.
property isInitialized
isInitialized: boolean;
If the model is initialized or not.
property metadata
readonly metadata: IObservableJSON;
The metadata associated with the notebook.
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: models.ISharedNotebook;
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;
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.
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> | undefined) => 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) => Private.IExecutionState | undefined;
Get the execution state associated with a notebook.
Parameter nb
The notebook used to identify execution state.
- The associated execution state.
method updateRenderOption
updateRenderOption: (options: { showOnToolBar: boolean; showProgress: boolean;}) => void;
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 ITool
interface ITool extends Widget {}
property notebookTools
notebookTools: INotebookTools;
The notebook tools object.
namespace Notebook
namespace Notebook {}
The namespace for the
Notebook
class statics.
variable defaultContentFactory
const defaultContentFactory: IContentFactory;
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 changeCellType
changeCellType: (notebook: Notebook, value: nbformat.CellType) => void;
Change the selected cell type(s).
Parameter notebook
The target notebook widget.
Parameter value
The target cell type.
#### 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 collapseAll
collapseAll: (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 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 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 widget
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, sessionContext?: ISessionContext) => 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) => Promise<boolean>;
Run the selected cell(s).
Parameter notebook
The target notebook widget.
Parameter sessionContext
The optional client session object.
#### 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) => Promise<boolean>;
Run all of the cells in the notebook.
Parameter notebook
The target notebook widget.
Parameter sessionContext
The optional client session object.
#### 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) => Promise<boolean>;
Run all of the cells before the currently active cell (exclusive).
Parameter notebook
The target notebook widget.
Parameter sessionContext
The optional client session object.
#### 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) => Promise<boolean>;
Run all of the cells after the currently active cell (inclusive).
Parameter notebook
The target notebook widget.
Parameter sessionContext
The optional client session object.
#### 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) => Promise<boolean>;
Run the selected cell(s) and advance to the next cell.
Parameter notebook
The target notebook widget.
Parameter sessionContext
The optional client session object.
#### 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) => Promise<boolean>;
Run the selected cell(s) and insert a new code cell.
Parameter notebook
The target notebook widget.
Parameter sessionContext
The optional client session object.
#### 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 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 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) => void;
Set the markdown header level.
Parameter notebook
The target notebook widget.
Parameter level
The header level.
#### 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 widget
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 trust
trust: (notebook: Notebook, translator?: ITranslator) => Promise<void>;
Trust the notebook after prompting the user.
Parameter notebook
The target notebook widget.
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 if there are no cell actions to undo.
namespace NotebookModel
namespace NotebookModel {}
The namespace for the
NotebookModel
class statics.
variable defaultContentFactory
const defaultContentFactory: ContentFactory;
The default
ContentFactory
instance.
class ContentFactory
class ContentFactory {}
The default implementation of an
IContentFactory
.
constructor
constructor(options: ContentFactory.IOptions);
Create a new cell model factory.
property codeCellContentFactory
readonly codeCellContentFactory: CodeCellModel.IContentFactory;
The factory for code cell content.
property modelDB
readonly modelDB: any;
The IModelDB in which to put the notebook data.
method clone
clone: (modelDB: IModelDB) => ContentFactory;
Clone the content factory with a new IModelDB.
method createCell
createCell: (type: nbformat.CellType, options: CellModel.IOptions) => ICellModel;
Create a new cell by cell type.
Parameter type
: the type of the cell to create.
Parameter options
: the cell creation options.
#### Notes This method is intended to be a convenience method to programmatically call the other cell creation methods in the factory.
method createCodeCell
createCodeCell: (options: CodeCellModel.IOptions) => ICodeCellModel;
Create a new code cell.
Parameter source
The data to use for the original source data.
Returns
A new code cell. If a source cell is provided, the new cell will be initialized with the data from the source. If the contentFactory is not provided, the instance
codeCellContentFactory
will be used.
method createMarkdownCell
createMarkdownCell: (options: CellModel.IOptions) => IMarkdownCellModel;
Create a new markdown cell.
Parameter source
The data to use for the original source data.
Returns
A new markdown cell. If a source cell is provided, the new cell will be initialized with the data from the source.
method createRawCell
createRawCell: (options: CellModel.IOptions) => IRawCellModel;
Create a new raw cell.
Parameter source
The data to use for the original source data.
Returns
A new raw cell. If a source cell is provided, the new cell will be initialized with the data from the source.
interface IContentFactory
interface IContentFactory {}
A factory for creating notebook model content.
property codeCellContentFactory
readonly codeCellContentFactory: CodeCellModel.IContentFactory;
The factory for output area models.
property modelDB
modelDB: IModelDB | undefined;
The IModelDB in which to put data for the notebook model.
method clone
clone: (modelDB: IModelDB) => IContentFactory;
Clone the content factory with a new IModelDB.
method createCell
createCell: (type: nbformat.CellType, options: CellModel.IOptions) => ICellModel;
Create a new cell by cell type.
Parameter type
: the type of the cell to create.
Parameter options
: the cell creation options.
#### Notes This method is intended to be a convenience method to programmatically call the other cell creation methods in the factory.
method createCodeCell
createCodeCell: (options: CodeCellModel.IOptions) => ICodeCellModel;
Create a new code cell.
Parameter options
The options used to create the cell.
Returns
A new code cell. If a source cell is provided, the new cell will be initialized with the data from the source.
method createMarkdownCell
createMarkdownCell: (options: CellModel.IOptions) => IMarkdownCellModel;
Create a new markdown cell.
Parameter options
The options used to create the cell.
Returns
A new markdown cell. If a source cell is provided, the new cell will be initialized with the data from the source.
method createRawCell
createRawCell: (options: CellModel.IOptions) => IRawCellModel;
Create a new raw cell.
Parameter options
The options used to create the cell.
Returns
A new raw cell. If a source cell is provided, the new cell will be initialized with the data from the source.
interface IOptions
interface IOptions {}
An options object for initializing a notebook model.
property collaborationEnabled
collaborationEnabled?: boolean;
Whether collaboration should be enabled for this document model.
property contentFactory
contentFactory?: IContentFactory;
A factory for creating cell models.
The default is a shared factory instance.
property disableDocumentWideUndoRedo
disableDocumentWideUndoRedo?: boolean;
Defines if the document can be undo/redo.
property isInitialized
isInitialized?: boolean;
If the model is initialized or not.
property languagePreference
languagePreference?: string;
The language preference for the model.
property modelDB
modelDB?: IModelDB;
A modelDB for storing notebook data.
property translator
translator?: ITranslator;
Language translator.
namespace NotebookModel.ContentFactory
namespace NotebookModel.ContentFactory {}
A namespace for the notebook model content factory.
interface IOptions
interface IOptions {}
The options used to initialize a
ContentFactory
.
property codeCellContentFactory
codeCellContentFactory?: CodeCellModel.IContentFactory;
The factory for code cell model content.
property modelDB
modelDB?: IModelDB;
The modelDB in which to place new content.
namespace NotebookModelFactory
namespace NotebookModelFactory {}
The namespace for notebook model factory statics.
interface IOptions
interface IOptions {}
The options used to initialize a NotebookModelFactory.
property codeCellContentFactory
codeCellContentFactory?: CodeCellModel.IContentFactory;
The factory for code cell content.
property collaborative
collaborative?: boolean;
Whether the model is collaborative or not.
property contentFactory
contentFactory?: NotebookModel.IContentFactory;
The content factory used by the NotebookModelFactory. If given, it will supersede the
codeCellContentFactory
.
property disableDocumentWideUndoRedo
disableDocumentWideUndoRedo?: boolean;
Defines if the document can be undo/redo.
namespace NotebookPanel
namespace NotebookPanel {}
A namespace for
NotebookPanel
statics.
variable defaultContentFactory
const defaultContentFactory: ContentFactory;
Default content factory for the notebook panel.
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 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.
function createNBConvertSelector
createNBConvertSelector: ( optionValueArray: ReadonlyPartialJSONOptionValueArray, translator?: ITranslator) => KeySelector;
Create an nbconvert selector.
function createSlideShowSelector
createSlideShowSelector: (translator?: ITranslator) => KeySelector;
Create a slideshow selector.
class ActiveCellTool
class ActiveCellTool extends Tool {}
A cell tool displaying the active cell contents.
constructor
constructor();
Construct a new active cell tool.
method dispose
dispose: () => void;
Dispose of the resources used by the tool.
method onActiveCellChanged
protected onActiveCellChanged: () => void;
Handle a change to the active cell.
method onActiveNotebookPanelChanged
protected onActiveNotebookPanelChanged: (msg: Message) => void;
Handle a change to the notebook panel.
#### Notes The default implementation is a no-op.
class CellMetadataEditorTool
class CellMetadataEditorTool extends MetadataEditorTool {}
A cell metadata editor
constructor
constructor(options: MetadataEditorTool.IOptions);
method onActiveCellChanged
protected onActiveCellChanged: (msg: Message) => void;
Handle a change to the active cell.
method onActiveCellMetadataChanged
protected onActiveCellMetadataChanged: (msg: Message) => void;
Handle a change to the active cell metadata.
class KeySelector
class KeySelector extends Tool {}
A cell tool that provides a selection for a given metadata key.
constructor
constructor(options: KeySelector.IOptions);
Construct a new KeySelector.
property key
readonly key: string;
The metadata key used by the selector.
property selectNode
readonly selectNode: HTMLSelectElement;
The select node for the widget.
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 onActiveCellChanged
protected onActiveCellChanged: (msg: Message) => void;
Handle a change to the active cell.
method onActiveCellMetadataChanged
protected onActiveCellMetadataChanged: ( msg: ObservableJSON.ChangeMessage) => void;
Handle a change to the metadata of the active cell.
method onAfterAttach
protected onAfterAttach: (msg: Message) => void;
Handle
after-attach
messages for the widget.
method onBeforeDetach
protected onBeforeDetach: (msg: Message) => void;
Handle
before-detach
messages for the widget.
method onValueChanged
protected onValueChanged: () => void;
Handle a change to the value.
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 NotebookMetadataEditorTool
class NotebookMetadataEditorTool extends MetadataEditorTool {}
A notebook metadata editor
constructor
constructor(options: MetadataEditorTool.IOptions);
method onActiveNotebookPanelChanged
protected onActiveNotebookPanelChanged: (msg: Message) => void;
Handle a change to the notebook.
method onActiveNotebookPanelMetadataChanged
protected onActiveNotebookPanelMetadataChanged: (msg: Message) => void;
Handle a change to the notebook metadata.
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 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.
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.KeySelector
namespace NotebookTools.KeySelector {}
The namespace for
KeySelector
static data.
interface IOptions
interface IOptions {}
The options used to initialize a keyselector.
property default
default?: ReadonlyPartialJSONValue;
Default value for default setters and getters if value is not found.
property getter
getter?: (cell: Cell) => ReadonlyPartialJSONValue | undefined;
An optional value getter for the selector.
Parameter cell
The currently active cell.
Returns
The appropriate value for the selector.
property key
key: string;
The metadata key of interest.
property optionValueArray
optionValueArray: ReadonlyPartialJSONOptionValueArray;
The map of values to options.
Value corresponds to the unique identifier. Option corresponds to the localizable value to display.
See:
<option value="volvo">Volvo</option>
#### Notes If a value equals the default, choosing it may erase the key from the metadata.
property setter
setter?: (cell: Cell, value: ReadonlyPartialJSONValue | undefined) => void;
An optional value setter for the selector.
Parameter cell
The currently active cell.
Parameter value
The value of the selector.
#### Notes The setter should set the appropriate metadata value given the value of the selector.
property title
title: string;
The optional title of the selector - defaults to capitalized
key
.
property validCellTypes
validCellTypes?: nbformat.CellType[];
The optional valid cell types - defaults to all valid types.
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 cells in the current notebook.
property trustedCells
readonly trustedCells: number;
The number of trusted 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 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 sessionDialogs
sessionDialogs?: ISessionContextDialogs;
The session context dialogs.
property translator
translator?: ITranslator;
The application language translator.
namespace StaticNotebook
namespace StaticNotebook {}
The namespace for the
StaticNotebook
class statics.
variable defaultContentFactory
const defaultContentFactory: IContentFactory;
Default content factory for the static notebook widget.
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, parent: StaticNotebook) => 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, parent: StaticNotebook) => 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, parent: StaticNotebook) => 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, parent: StaticNotebook) => CodeCell;
Create a new code cell widget.
method createMarkdownCell
createMarkdownCell: ( options: MarkdownCell.IOptions, parent: StaticNotebook) => MarkdownCell;
Create a new markdown cell widget.
method createRawCell
createRawCell: (options: RawCell.IOptions, parent: StaticNotebook) => 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 defaultCell
defaultCell: nbformat.CellType;
The default type for new notebook cells.
property disableDocumentWideUndoRedo
disableDocumentWideUndoRedo: boolean;
Defines if the document can be undo/redo.
property maxNumberOutputs
maxNumberOutputs: number;
Defines the maximum number of outputs per cell.
property numberCellsToRenderDirectly
numberCellsToRenderDirectly: number;
property observedBottomMargin
observedBottomMargin: string;
Defines the observed bottom margin for the virtual notebook, set a positive number of pixels to render cells below the visible view.
property observedTopMargin
observedTopMargin: string;
Defines the observed top margin for the virtual notebook, set a positive number of pixels to render cells below the visible view.
property recordTiming
recordTiming: boolean;
Should timing be recorded in metadata
property remainingTimeBeforeRescheduling
remainingTimeBeforeRescheduling: number;
property renderCellOnIdle
renderCellOnIdle: boolean;
Defines if the placeholder cells should be rendered when the browser is idle.
property renderingLayout
renderingLayout: RenderingLayout;
Defines the rendering layout to use.
property scrollPastEnd
scrollPastEnd: boolean;
Enable scrolling past the last cell
property showEditorForReadOnlyMarkdown
showEditorForReadOnlyMarkdown?: boolean;
Should an editor be shown for read-only markdown
property sideBySideLeftMarginOverride
sideBySideLeftMarginOverride: string;
Override the side-by-side left margin.
property sideBySideOutputRatio
sideBySideOutputRatio: number;
Side-by-side output ratio.
property sideBySideRightMarginOverride
sideBySideRightMarginOverride: string;
Override the side-by-side right margin.
interface IOptions
interface IOptions {}
An options object for initializing a static notebook.
property contentFactory
contentFactory?: IContentFactory;
A factory for creating content.
property editorConfig
editorConfig?: IEditorConfig;
A configuration object for the cell editor settings.
property languagePreference
languagePreference?: string;
The language preference for the model.
property mimeTypeService
mimeTypeService: IEditorMimeTypeService;
The service used to look up mime types.
property notebookConfig
notebookConfig?: INotebookConfig;
A configuration object for notebook settings.
property rendermime
rendermime: IRenderMimeRegistry;
The rendermime instance used by the widget.
property translator
translator?: ITranslator;
The application language translator.
namespace StaticNotebook.ContentFactory
namespace StaticNotebook.ContentFactory {}
A namespace for the static notebook content factory.
interface IOptions
interface IOptions extends Cell.ContentFactory.IOptions {}
Options for the content factory.
namespace ToolbarItems
namespace ToolbarItems {}
A namespace for the default toolbar items.
function createCellTypeItem
createCellTypeItem: (panel: NotebookPanel, translator?: ITranslator) => Widget;
Create a cell type switcher item.
#### Notes It will display the type of the current active cell. If more than one cell is selected but are of different types, it will display
'-'
. When the user changes the cell type, it will change the cell types of the selected cells. It can handle a change to the context.
function createCopyButton
createCopyButton: (panel: NotebookPanel, translator?: ITranslator) => Widget;
Create a copy toolbar item.
Deprecated
since v3.2 This is dead code now.
function createCutButton
createCutButton: (panel: NotebookPanel, translator?: ITranslator) => Widget;
Create a cut toolbar item.
Deprecated
since v3.2 This is dead code now.
function createInsertButton
createInsertButton: (panel: NotebookPanel, translator?: ITranslator) => Widget;
Create an insert toolbar item.
Deprecated
since v3.2 This is dead code now.
function createPasteButton
createPasteButton: (panel: NotebookPanel, translator?: ITranslator) => Widget;
Create a paste toolbar item.
Deprecated
since v3.2 This is dead code now.
function createRestartRunAllButton
createRestartRunAllButton: ( panel: NotebookPanel, dialogs?: ISessionContext.IDialogs, translator?: ITranslator) => Widget;
Create a restart run all toolbar item
Deprecated
since v3.2 This is dead code now.
function createRunButton
createRunButton: (panel: NotebookPanel, translator?: ITranslator) => Widget;
Create a run toolbar item.
Deprecated
since v3.2 This is dead code now.
function createSaveButton
createSaveButton: (panel: NotebookPanel, translator?: ITranslator) => Widget;
Create save button toolbar item.
Deprecated
since v3.2 This is dead code now.
function getDefaultItems
getDefaultItems: ( panel: NotebookPanel, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator) => DocumentRegistry.IToolbarItem[];
Get the default toolbar items for panel
Package Files (14)
Dependencies (24)
- @jupyter/ydoc
- @jupyterlab/apputils
- @jupyterlab/cells
- @jupyterlab/codeeditor
- @jupyterlab/coreutils
- @jupyterlab/docregistry
- @jupyterlab/nbformat
- @jupyterlab/observables
- @jupyterlab/rendermime
- @jupyterlab/services
- @jupyterlab/settingregistry
- @jupyterlab/statusbar
- @jupyterlab/translation
- @jupyterlab/ui-components
- @lumino/algorithm
- @lumino/coreutils
- @lumino/domutils
- @lumino/dragdrop
- @lumino/messaging
- @lumino/properties
- @lumino/signaling
- @lumino/virtualdom
- @lumino/widgets
- react
Dev Dependencies (7)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto 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/notebook
.
- Markdown[](https://www.jsdocs.io/package/@jupyterlab/notebook)
- HTML<a href="https://www.jsdocs.io/package/@jupyterlab/notebook"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 6840 ms. - Missing or incorrect documentation? Open an issue for this package.