Skip to content

Commit

Permalink
Merge pull request #67 from martinRenou/beakerx_global_var
Browse files Browse the repository at this point in the history
Try to fix the beakerx global variable issue
  • Loading branch information
ildipo authored Jun 21, 2021
2 parents 6fcf1b5 + 26c9c85 commit c988c0a
Showing 1 changed file with 6 additions and 3 deletions.
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) {
return false;
}

Expand Down

0 comments on commit c988c0a

Please sign in to comment.