Skip to content

Commit

Permalink
Fix for #8 (#9)
Browse files Browse the repository at this point in the history
* produce source maps for debugging

* loading bug fixed

* reset local changes in examples

* Lint the code

---------

Co-authored-by: AnotherCodeArtist <peter.salhofer@fh-joanneumat>
Co-authored-by: Frédéric Collonval <fcollonval@gmail.com>
  • Loading branch information
3 people authored Feb 16, 2023
1 parent 4148b05 commit 9cbf71d
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 31 deletions.
4 changes: 3 additions & 1 deletion app/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,10 @@ module.exports = [
type: 'var',
name: ['_JUPYTERLAB', 'CORE_OUTPUT']
},
filename: 'bundle.js'
filename: 'bundle.js',
sourceMapFilename: '[name].js.map'
},
devtool: 'source-map',
plugins: [
new ModuleFederationPlugin({
library: {
Expand Down
9 changes: 2 additions & 7 deletions app/webpack.config.watch.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
const base = require('./webpack.config');
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
//const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');

module.exports = [
{
...base[0],
bail: false,
watch: true,
plugins: [
...base[0].plugins,
new ExtraWatchWebpackPlugin({
files: ['../packages/application/tsconfig.tsbuildinfo']
})
]
plugins: [...base[0].plugins]
},
...base.slice(1)
];
28 changes: 9 additions & 19 deletions packages/application/src/plugins/rise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export const plugin: JupyterFrontEndPlugin<void> = {
app.started,
app.restored
]).then(async ([settings]) => {
let rendered: boolean | null = null;
const notebookPath = PageConfig.getOption('notebookPath');
const notebookPanel = documentManager.open(notebookPath) as NotebookPanel;

Expand Down Expand Up @@ -112,11 +111,9 @@ export const plugin: JupyterFrontEndPlugin<void> = {
change.name === 'dirty' &&
change.newValue === false &&
// if rendered = null || true
!!rendered
!!change.oldValue
) {
console.log(`Convert notebook ${notebookPath} to slideshow.`);
notebookPanel.content.fullyRendered.disconnect(setRendered, this);
notebookPanel.model?.stateChanged.disconnect(initializeReveal, this);

// Set the active cell index
notebookPanel.content.activeCellIndex = activeCellIndex;
Expand All @@ -134,21 +131,14 @@ export const plugin: JupyterFrontEndPlugin<void> = {
}
};

const setRendered = (notebook: Notebook, fullyRendered: boolean) => {
rendered = fullyRendered;
if (rendered) {
initializeReveal(null, {
name: 'dirty',
newValue: notebook.model?.dirty ?? true,
oldValue: true
});
}
};

// Deal with virtual rendering
notebookPanel.content.fullyRendered.connect(setRendered, this);

notebookPanel.model?.stateChanged.connect(initializeReveal, this);
// Wait until the context is fully loaded
notebookPanel.context.ready.then(() =>
initializeReveal(null, {
name: 'dirty',
newValue: notebookPanel.model?.dirty ?? true,
oldValue: true
})
);

// Remove the toolbar - fail due to the dynamic load of the toolbar items
// notebookPanel.toolbar.dispose();
Expand Down
3 changes: 2 additions & 1 deletion packages/application/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": "../../tsconfigbase",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
"rootDir": "src",
"sourceMap": true
},
"include": ["src/**/*"]
}
2 changes: 1 addition & 1 deletion packages/lab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"watch": "run-p watch:src watch:labextension",
"watch:labextension": "jupyter labextension watch .",
"watch:src": "tsc -w"
"watch:src": "tsc -w -d"
},
"dependencies": {
"@jupyterlab/application": "^3.2.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/lab/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": "../../tsconfigbase",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
"rootDir": "src",
"sourceMap": true
},
"include": ["src/*"]
}
3 changes: 2 additions & 1 deletion tsconfigbase.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"strict": true,
"strictNullChecks": true,
"target": "es2017",
"types": ["jest"]
"types": ["jest"],
"sourceMap": true
},
"include": ["src/*"]
}

0 comments on commit 9cbf71d

Please sign in to comment.