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

Pulled notebook export UI into separate extension so it can be disabled easily #10094

Merged
merged 6 commits into from
Apr 16, 2021

Conversation

DianeHu
Copy link
Contributor

@DianeHu DianeHu commented Apr 13, 2021

References

Addresses #5274. Technically, export isn't the exact same as download, but I figured if a user wants to disable download it's highly likely they'll want to disable export as well.

Code changes

  1. I pulled all export UI code in notebook-extension into a separate plugin so that it can be disabled easily if a user wants to customize a JL environment to not have those features available. Specifically, notebook-extension adds the "export notebook as" commands to the file menu and command palette, so all those commands can now be easily set to not display.
  2. I pulled out the getCurrent function into a separate function so that it could be used in the new export plugin as well as the original one it lived in. This required adding a few arguments to make things work out.
  3. I removed some unused imports across the extension.

User-facing changes

No user-facing changes with the extension enabled as is. If @jupyterlab/notebook-extension:export is disabled (the ID for the new plugin), then the file menu and command palette will no longer show any export commands:

image
image

Backwards-incompatible changes

None

@jupyterlab-dev-mode
Copy link

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

@DianeHu DianeHu marked this pull request as ready for review April 14, 2021 00:51
isEnabled
});

if (mainMenu) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this check happen after getting the response from the server?

Otherwise if the menu is not provided, it looks like the command would not be added to the command palette either? (the if (palette) check below)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the original code, this section (lines 399-442) is all bundled into populateMenus, which is only called after checking for if (mainMenu) in its parent function.

// Add main menu notebook menu.
if (mainMenu) {
populateMenus(
app,
mainMenu,
tracker,
services,
translator,
palette,
sessionDialogs
);
}

That's why I put the check here before anything gets added--I don't have context on the original code so I'm not sure if there's a specific reason it's all bundled together. Should it be different here after pulling it out?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, thanks for looking it up 👍

Not sure there was a specific reason indeed to have it that way. It just caught attention since usually the menu and palettes are handled as two independent components.

But it would be totally fine to pull it out in a separate change too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtpio just moved it down! Let me know if you think that's a good spot for it, or if I should reorganize it differently.

@jtpio jtpio added this to the 3.1 milestone Apr 14, 2021
@DianeHu
Copy link
Contributor Author

DianeHu commented Apr 15, 2021

Looks like there are a few cancelled checks, closing and reopening to make it re-run the checks

@DianeHu DianeHu closed this Apr 15, 2021
@DianeHu DianeHu reopened this Apr 15, 2021
@DianeHu DianeHu closed this Apr 15, 2021
@DianeHu DianeHu reopened this Apr 15, 2021
@DianeHu
Copy link
Contributor Author

DianeHu commented Apr 15, 2021

@jtpio it seems the jupyterlab/tests tests keep timing out (they're running over the 30 min mark). Everything that finished running has passed however, including the tests that finished running in jupyterlab/tests--should I be concerned or is this ok?

Edit: nvm, looks like everything is passing now!

@DianeHu DianeHu closed this Apr 15, 2021
@DianeHu DianeHu reopened this Apr 15, 2021
Copy link
Member

@jtpio jtpio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jtpio jtpio merged commit ced83da into jupyterlab:master Apr 16, 2021
krassowska added a commit to krassowska/jupyterlab that referenced this pull request Apr 18, 2021
blink1073 pushed a commit that referenced this pull request Apr 18, 2021
* Add 'merge cell above/below' commands with shortcuts

* Add tests for mergeCells with mergeAbove = true

* Lint

* Update after #10094
@github-actions github-actions bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Jan 19, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
maintenance pkg:notebook status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants