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

Factory overrides #6813

Merged
merged 9 commits into from Aug 22, 2019
Merged

Factory overrides #6813

merged 9 commits into from Aug 22, 2019

Conversation

ian-r-rose
Copy link
Member

This adds a way for the end-user to override the default viewer for a given file type. I waffled for a while about whether this should be implemented on the file browser, the document manager, or the document registry. I went with the latter, since that handles all the logic for deciding which factories to use normally.

I am also thinking about adding a menu item to the "Settings" or "View" menu which exposes this for the markdown viewer specifically. Any thoughts about that?
image

This is a separate question from whether to make the markdown viewer default (which I would personally be in favor of), but should make it less pressing.

References

alleviates #6442, fixes #4048

Code changes

New function on the document registry to set an override for a given file type.
New user-settings in the docmanager-extension to expose this functionality.

User-facing changes

Users can set their own default renderer for a file type.

Backwards-incompatible changes

None, as far as I can tell.

@jupyterlab-dev-mode
Copy link

Thanks for making a pull request to JupyterLab!

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

@ian-r-rose
Copy link
Member Author

Ran into an issue with old typedoc configuration, so I also updated the tdconfig.json files to use es2017. That should be mostly noise for the purposes of review.

@ian-r-rose
Copy link
Member Author

Now with an auto-generated help string for the schema using @afshin's transformer mechanism:

    // Overrides for the default viewers for file types.
    // Specify a mapping from file type name to document viewer name, for example:
    // 
    // defaultViewers: {
    //   markdown: "Markdown Preview"
    // }
    // 
    // If you specify non-existent file types or viewers, or if a viewer cannot
    // open a given file type, the override will not function.
    // 
    // Available viewers:
    // HTML Viewer    
    // Image    
    // CSVTable    
    // TSVTable    
    // JSON    
    // PDF    
    // Vega4    
    // Vega-Lite2    
    // Vega5    
    // Vega-Lite3    
    // Markdown Preview    
    // Notebook    
    // VDOM    
    // Editor
    // 
    // Available file types:
    // text    
    // notebook    
    // directory    
    // markdown    
    // python    
    // json    
    // csv    
    // tsv    
    // r    
    // yaml    
    // svg    
    // tiff    
    // jpeg    
    // gif    
    // png    
    // bmp    
    // html    
    // PDF    
    // vega4    
    // vega-lite2    
    // vega5    
    // vega-lite3    
    // vdom

@jasongrout jasongrout self-requested a review July 29, 2019 20:14
@jasongrout jasongrout assigned jasongrout and afshin and unassigned jasongrout Jul 31, 2019
Copy link
Member

@afshin afshin left a comment

Choose a reason for hiding this comment

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

This is awesome. Thanks, @ian-r-rose!

@jasongrout jasongrout removed their request for review August 22, 2019 14:48
@vidartf
Copy link
Member

vidartf commented Aug 28, 2019

Is the diff here accurate?

@lock lock bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Sep 27, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg:docmanager pkg:docregistry status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. tag:Settings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow changing default file opener
4 participants