diff --git a/app/index.js b/app/index.js index b817e9fb8..7c2b97a89 100644 --- a/app/index.js +++ b/app/index.js @@ -68,6 +68,7 @@ async function main() { const App = require('@jupyterlab-classic/application').App; const app = new App(); + const disabled = []; // TODO: formalize the way the set of initial extensions and plugins are specified let mods = [ // @jupyterlab-classic plugins @@ -150,6 +151,32 @@ async function main() { ]); } + /** + * Iterate over active plugins in an extension. + * + * #### Notes + * This also populates the disabled + */ + function* activePlugins(extension) { + // Handle commonjs or es2015 modules + let exports; + if (Object.prototype.hasOwnProperty.call(extension, '__esModule')) { + exports = extension.default; + } else { + // CommonJS exports. + exports = extension; + } + + let plugins = Array.isArray(exports) ? exports : [exports]; + for (let plugin of plugins) { + if (PageConfig.Extension.isDisabled(plugin.id)) { + disabled.push(plugin.id); + continue; + } + yield plugin; + } + } + const extension_data = JSON.parse( PageConfig.getOption('federated_extensions') ); @@ -200,7 +227,9 @@ async function main() { ); federatedExtensions.forEach(p => { if (p.status === 'fulfilled') { - mods.push(p.value); + for (let plugin of activePlugins(p.value)) { + mods.push(plugin); + } } else { console.error(p.reason); } diff --git a/packages/application-extension/style/base.css b/packages/application-extension/style/base.css index 1c814d5cd..20233875b 100644 --- a/packages/application-extension/style/base.css +++ b/packages/application-extension/style/base.css @@ -9,11 +9,6 @@ flex-shrink: 1; } -/* TODO: move to edit-extension */ -.jp-Document { - height: 100%; -} - .jp-MainAreaWidget { height: 100%; } diff --git a/packages/docmanager-extension/style/base.css b/packages/docmanager-extension/style/base.css index e69de29bb..2c9c509f0 100644 --- a/packages/docmanager-extension/style/base.css +++ b/packages/docmanager-extension/style/base.css @@ -0,0 +1,3 @@ +.jp-Document { + height: 100%; +} diff --git a/packages/notebook-extension/package.json b/packages/notebook-extension/package.json index f54347860..1407bd2db 100644 --- a/packages/notebook-extension/package.json +++ b/packages/notebook-extension/package.json @@ -44,6 +44,7 @@ "@jupyterlab/apputils": "^3.0.0", "@jupyterlab/docmanager": "^3.0.0", "@jupyterlab/notebook": "^3.0.0", + "@lumino/polling": "^1.3.3", "@lumino/widgets": "^1.14.0" }, "devDependencies": { diff --git a/packages/notebook-extension/src/index.ts b/packages/notebook-extension/src/index.ts index c50fcb873..72adc3c11 100644 --- a/packages/notebook-extension/src/index.ts +++ b/packages/notebook-extension/src/index.ts @@ -20,6 +20,8 @@ import { IClassicShell } from '@jupyterlab-classic/application'; +import { Poll } from '@lumino/polling'; + import { Widget } from '@lumino/widgets'; /** @@ -84,9 +86,16 @@ const checkpoints: JupyterFrontEndPlugin = { if (classicShell) { classicShell.currentChanged.connect(onChange); } - // TODO: replace by a Poll - onChange(); - setInterval(onChange, 2000); + + new Poll({ + auto: true, + factory: () => onChange(), + frequency: { + interval: 2000, + backoff: false + }, + standby: 'when-hidden' + }); } }; diff --git a/packages/notebook-extension/style/base.css b/packages/notebook-extension/style/base.css index 1fd02e8c2..c6296bfc6 100644 --- a/packages/notebook-extension/style/base.css +++ b/packages/notebook-extension/style/base.css @@ -19,8 +19,7 @@ } .jp-ClassicKernelStatus { - /* TODO: replace with lab variable */ - font-size: 12px; + font-size: var(--jp-ui-font-size1); margin: 0; font-weight: normal; color: var(--jp-ui-font-color0);