Skip to content

Code_prettify button registration broken #1519

@achampion

Description

@achampion

Versions:

notebook                          6.1.1
jupyter-contrib-nbextensions      0.5.1
jupyter-client                    6.1.6

Looking at the console I see all of the code_prettify extensions fail to load with button registration issues:

[code_prettify] error loading: TypeError: Cannot read property 'help' of undefined
    at toolbar.js:98
    at Array.forEach (<anonymous>)
    at MainToolBar.ToolBar.add_buttons_group (toolbar.js:85)
    at KernelExecOnCells.add_toolbar_button (kernel_exec_on_cell.js?v=20200811234053:199)
    at KernelExecOnCells.setup_for_new_kernel (kernel_exec_on_cell.js?v=20200811234053:277)
    at on_success (kernel_exec_on_cell.js?v=20200811234053:337)

I changed the KernelExecOnCells.prototype.add_toolbar_button function to:

KernelExecOnCells.prototype.add_toolbar_button = function() {
    var button_group_id = this.mod_name + '_button';
    if ($('#' + button_group_id).length < 1) {
        $(Jupyter.toolbar.add_buttons_group([this.cfg.actions.process_selected.name])).find('.btn').attr('id', button_group_id);
    }
};

To get it working again and seems a simpler approach than the current implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions