nbclassic icon indicating copy to clipboard operation
nbclassic copied to clipboard

Improve "save as" to be able to create directories and to be able to infer the notebook name from the current notebook.

Open andrewfulton9 opened this issue 2 years ago • 0 comments

Problem

Currently when you try to use "save as" you are limited to saving a file in an already existing folder and furthermore the full path of the new file (except for the .ipynb suffix) must be given. If the notebook name is not given in the path the only feedback you are given is that the text, "Enter a notebook path relative to the notebook dir", turns red:

https://github.com/jupyter/nbclassic/assets/13774419/9fa167a8-f216-4f9b-99ac-db57add2aafc

If you give a path that includes 1 or more folders that don't exist the error "No such file or directory":

https://github.com/jupyter/nbclassic/assets/13774419/2d7e9b6c-959c-4d57-b3ae-f589c9a20112

Proposed Solution

If no notebook name is given infer the name of the new notebook from the existing notebook. For example say you are working on notebook.ipynb in the root directory, and typed existing_folder/ into the save as dialog the new notebook would be saved to existing_folder/notebook.ipynb.

For paths that contain new folders, open a dialog giving the option to cancel the save as operation, or to create the directory, similar to how overwriting a file from save as works.

Additional context

These changes will behave similarly to JupyterLab current functioning.

andrewfulton9 avatar Nov 07 '23 17:11 andrewfulton9