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

Blank page: fails to load xterm.js #45

Closed
liffiton opened this issue Jun 9, 2018 · 1 comment
Closed

Blank page: fails to load xterm.js #45

liffiton opened this issue Jun 9, 2018 · 1 comment

Comments

@liffiton
Copy link

liffiton commented Jun 9, 2018

I installed nbgitpuller following the instructions in the README, and when I access an nbgitpuller URL, I just end up at a blank page. Looking at the browser console shows that xterm.js is failing to load (both the JS and the CSS). My guess is that this is related to the updated version of xterm.js included with jupyterhub/notebook v5.5.0.

I can get it to load the JS by changing index.js:4 to 'static/components/xterm.js/index.js'.

Then there is an error in the vendored _fitTerm() function due to changes in xterm.js. I changed it to:

    GitSyncView.prototype._fitTerm = function() {
        // Vendored in from the xterm.js fit addon
        // Because I can't for the life of me get the addon to be
        // actually included here as an require.js thing.
        // And life is too short.
        var term = this.term;
        if (!term.element.parentElement) {
            return null;
        }
        var parentElementStyle = window.getComputedStyle(term.element.parentElement),
            parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')),
            parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')) - 17),
            elementStyle = window.getComputedStyle(term.element),
            elementPaddingVer = parseInt(elementStyle.getPropertyValue('padding-top')) + parseInt(elementStyle.getPropertyValue('padding-bottom')),
            elementPaddingHor = parseInt(elementStyle.getPropertyValue('padding-right')) + parseInt(elementStyle.getPropertyValue('padding-left')),
            availableHeight = parentElementHeight - elementPaddingVer,
            availableWidth = parentElementWidth - elementPaddingHor;

        rows = parseInt(availableHeight / term.renderer.dimensions.actualCellHeight);
        cols = parseInt(availableWidth / term.renderer.dimensions.actualCellWidth);

        term.resize(cols, rows);
    };

I don't know if these are the best fixes, but they seem to work. I haven't corrected the CSS URL, though, as I'm not quite sure where that is now.

@ryanlovett
Copy link
Contributor

Thanks for catching this! Looks like this would be the fix for the css:

-<link rel="stylesheet" href="{{ static_url("components/xterm.js/dist/xterm.css") }}" type="text/css" />
+<link rel="stylesheet" href="{{ static_url("components/xterm.js-css/index.css") }}" type="text/css" />

I'll test your fixes soon...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants