Skip to content

Commit

Permalink
Update widget menu items in classic Notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout committed Mar 22, 2018
1 parent f8f4d31 commit 00e3d43
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions widgetsnbextension/src/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,13 @@ WidgetManager.prototype._init_actions = function() {
};
Jupyter.menubar.actions.register(this.saveWidgetsAction, 'save-with-widgets', 'widgets');

this.clearWidgetsAction = {
this.closeAllWidgetsAction = {
handler: (function() {
delete Jupyter.notebook.metadata.widgets;
Jupyter.menubar.actions.get('jupyter-notebook:save-notebook').handler({
notebook: Jupyter.notebook
});
}),
help: 'Clear the widget state information from the notebook'
this.clear_state();
}).bind(this),
help: 'Close all widgets'
};
Jupyter.menubar.actions.register(this.saveWidgetsAction, 'save-clear-widgets', 'widgets');
Jupyter.menubar.actions.register(this.closeAllWidgetsAction, 'close-all-widgets', 'widgets');
};

/**
Expand Down Expand Up @@ -244,11 +241,12 @@ WidgetManager.prototype._init_menu = function() {
var divider = document.createElement('ul');
divider.classList.add('divider');

widgetsSubmenu.appendChild(this._createMenuItem('Save Notebook Widget State', this.saveWidgetsAction));
widgetsSubmenu.appendChild(this._createMenuItem('Clear Notebook Widget State', this.clearWidgetsAction));
widgetsSubmenu.appendChild(divider);
widgetsSubmenu.appendChild(this._createMenuItem('Close All Widgets', this.closeAllWidgetsAction));
widgetsSubmenu.appendChild(divider.cloneNode());
widgetsSubmenu.appendChild(this._createMenuItem('Save Widgets to Notebook', this.saveWidgetsAction));
widgetsSubmenu.appendChild(divider.cloneNode());
widgetsSubmenu.appendChild(this._createMenuItem('Download Widget State', saveState.action));
widgetsSubmenu.appendChild(this._createMenuItem('Embed Widgets', embedWidgets.action));
widgetsSubmenu.appendChild(this._createMenuItem('Export Widgets to HTML', embedWidgets.action));
};

/**
Expand Down

0 comments on commit 00e3d43

Please sign in to comment.