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

Try to fix the beakerx global variable issue #67

Merged
merged 1 commit into from
Jun 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions beakerx_widgets/js/src/lab/BeakerxWidgetExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class BeakerxWidgetExtension implements DocumentRegistry.WidgetExtension
const app = this.app;
const settings = this.settings;
const labShell = this.labShell;

Promise.all([panel.sessionContext.ready, context.ready]).then(function () {
extendHighlightModes(panel);
enableInitializationCellsFeature(panel);
Expand All @@ -57,14 +58,16 @@ export class BeakerxWidgetExtension implements DocumentRegistry.WidgetExtension
plotApiList.setActiveLabPanel(panel);
labShell.activeChanged.connect((sender, args) => {
if (args.newValue == panel) {
window.beakerx = window.beakerxHolder[panel.context.sessionContext.session.kernel.id];
plotApiList.setActiveLabPanel(panel);
panel.sessionContext.ready.then(() => {
window.beakerx = window.beakerxHolder[panel.context.sessionContext.session.kernel.id];
plotApiList.setActiveLabPanel(panel);
});
}
});

const originalProcessFn = app.commands.processKeydownEvent;
app.commands.processKeydownEvent = (event) => {
if (window.beakerx.tableFocused) {
if (window.beakerx && window.beakerx.tableFocused) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just an extra check, but shouldn't be needed?

return false;
}

Expand Down