Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update widget menu items in classic Notebook #2012

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion widgetsnbextension/src/embed_widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ data,

var mod = dialog.modal({
show: true,
title: 'Embed widgets',
title: 'Export Widgets to HTML',
body: content,
keyboard_manager: Jupyter.notebook.keyboard_manager,
notebook: Jupyter.notebook,
Expand Down
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