|
@@ -106,9 +106,11 @@ namespace ToolbarItems {
|
|
*/
|
|
*/
|
|
export
|
|
export
|
|
function createSaveButton(panel: NotebookPanel): ToolbarButton {
|
|
function createSaveButton(panel: NotebookPanel): ToolbarButton {
|
|
- return new ToolbarButton(TOOLBAR_SAVE, () => {
|
|
|
|
- panel.context.save();
|
|
|
|
- }, 'Save the notebook contents');
|
|
|
|
|
|
+ return new ToolbarButton({
|
|
|
|
+ className: TOOLBAR_SAVE,
|
|
|
|
+ onClick: () => { panel.context.save(); },
|
|
|
|
+ tooltip: 'Save the notebook contents'
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -116,9 +118,11 @@ namespace ToolbarItems {
|
|
*/
|
|
*/
|
|
export
|
|
export
|
|
function createInsertButton(panel: NotebookPanel): ToolbarButton {
|
|
function createInsertButton(panel: NotebookPanel): ToolbarButton {
|
|
- return new ToolbarButton(TOOLBAR_INSERT, () => {
|
|
|
|
- NotebookActions.insertBelow(panel.content);
|
|
|
|
- }, 'Insert a cell below');
|
|
|
|
|
|
+ return new ToolbarButton({
|
|
|
|
+ className: TOOLBAR_INSERT,
|
|
|
|
+ onClick: () => { NotebookActions.insertBelow(panel.content); },
|
|
|
|
+ tooltip: 'Insert a cell below'
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -126,9 +130,13 @@ namespace ToolbarItems {
|
|
*/
|
|
*/
|
|
export
|
|
export
|
|
function createCutButton(panel: NotebookPanel): ToolbarButton {
|
|
function createCutButton(panel: NotebookPanel): ToolbarButton {
|
|
- return new ToolbarButton(TOOLBAR_CUT, () => {
|
|
|
|
- NotebookActions.cut(panel.content, panel.clipboard);
|
|
|
|
- }, 'Cut the selected cell(s)');
|
|
|
|
|
|
+ return new ToolbarButton({
|
|
|
|
+ className: TOOLBAR_CUT,
|
|
|
|
+ onClick: () => {
|
|
|
|
+ NotebookActions.cut(panel.content, panel.clipboard);
|
|
|
|
+ },
|
|
|
|
+ tooltip: 'Cut the selected cell(s)'
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -136,9 +144,13 @@ namespace ToolbarItems {
|
|
*/
|
|
*/
|
|
export
|
|
export
|
|
function createCopyButton(panel: NotebookPanel): ToolbarButton {
|
|
function createCopyButton(panel: NotebookPanel): ToolbarButton {
|
|
- return new ToolbarButton(TOOLBAR_COPY, () => {
|
|
|
|
- NotebookActions.copy(panel.content, panel.clipboard);
|
|
|
|
- }, 'Copy the selected cell(s)');
|
|
|
|
|
|
+ return new ToolbarButton({
|
|
|
|
+ className: TOOLBAR_COPY,
|
|
|
|
+ onClick: () => {
|
|
|
|
+ NotebookActions.copy(panel.content, panel.clipboard);
|
|
|
|
+ },
|
|
|
|
+ tooltip: 'Copy the selected cell(s)'
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -146,9 +158,13 @@ namespace ToolbarItems {
|
|
*/
|
|
*/
|
|
export
|
|
export
|
|
function createPasteButton(panel: NotebookPanel): ToolbarButton {
|
|
function createPasteButton(panel: NotebookPanel): ToolbarButton {
|
|
- return new ToolbarButton(TOOLBAR_PASTE, () => {
|
|
|
|
- NotebookActions.paste(panel.content, panel.clipboard);
|
|
|
|
- }, 'Paste cell(s) from the clipboard');
|
|
|
|
|
|
+ return new ToolbarButton({
|
|
|
|
+ className: TOOLBAR_PASTE,
|
|
|
|
+ onClick: () => {
|
|
|
|
+ NotebookActions.paste(panel.content, panel.clipboard);
|
|
|
|
+ },
|
|
|
|
+ tooltip: 'Paste cell(s) from the clipboard'
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -156,9 +172,13 @@ namespace ToolbarItems {
|
|
*/
|
|
*/
|
|
export
|
|
export
|
|
function createRunButton(panel: NotebookPanel): ToolbarButton {
|
|
function createRunButton(panel: NotebookPanel): ToolbarButton {
|
|
- return new ToolbarButton(TOOLBAR_RUN, () => {
|
|
|
|
- NotebookActions.runAndAdvance(panel.content, panel.context.kernel);
|
|
|
|
- }, 'Run the selected cell(s) and advance');
|
|
|
|
|
|
+ return new ToolbarButton({
|
|
|
|
+ className: TOOLBAR_RUN,
|
|
|
|
+ onClick: () => {
|
|
|
|
+ NotebookActions.runAndAdvance(panel.content, panel.context.kernel);
|
|
|
|
+ },
|
|
|
|
+ tooltip: 'Run the selected cell(s) and advance'
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -166,11 +186,15 @@ namespace ToolbarItems {
|
|
*/
|
|
*/
|
|
export
|
|
export
|
|
function createInterruptButton(panel: NotebookPanel): ToolbarButton {
|
|
function createInterruptButton(panel: NotebookPanel): ToolbarButton {
|
|
- return new ToolbarButton(TOOLBAR_INTERRUPT, () => {
|
|
|
|
- if (panel.context.kernel) {
|
|
|
|
- panel.context.kernel.interrupt();
|
|
|
|
- }
|
|
|
|
- }, 'Interrupt the kernel');
|
|
|
|
|
|
+ return new ToolbarButton({
|
|
|
|
+ className: TOOLBAR_INTERRUPT,
|
|
|
|
+ onClick: () => {
|
|
|
|
+ if (panel.context.kernel) {
|
|
|
|
+ panel.context.kernel.interrupt();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ tooltip: 'Interrupt the kernel'
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -178,9 +202,13 @@ namespace ToolbarItems {
|
|
*/
|
|
*/
|
|
export
|
|
export
|
|
function createRestartButton(panel: NotebookPanel): ToolbarButton {
|
|
function createRestartButton(panel: NotebookPanel): ToolbarButton {
|
|
- return new ToolbarButton(TOOLBAR_RESTART, () => {
|
|
|
|
- panel.restart();
|
|
|
|
- }, 'Restart the kernel');
|
|
|
|
|
|
+ return new ToolbarButton({
|
|
|
|
+ className: TOOLBAR_RESTART,
|
|
|
|
+ onClick: () => {
|
|
|
|
+ panel.restart();
|
|
|
|
+ },
|
|
|
|
+ tooltip: 'Restart the kernel'
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|