diff --git a/packages/html-manager/src/htmlmanager.ts b/packages/html-manager/src/htmlmanager.ts index 9808bcaa11..9e194532e5 100644 --- a/packages/html-manager/src/htmlmanager.ts +++ b/packages/html-manager/src/htmlmanager.ts @@ -15,7 +15,6 @@ import { import { WidgetRenderer, WIDGET_MIMETYPE } from './output_renderers'; import { WidgetModel, WidgetView, DOMWidgetView } from '@jupyter-widgets/base'; -import { requirePromise } from './utils'; export class HTMLManager extends ManagerBase { constructor(options?: { @@ -118,10 +117,10 @@ export class HTMLManager extends ManagerBase { if (best === '1.2.0') { // ipywidgets 7 model - requirePromise(['@jupyter-widgets/base7']).then(resolve); + resolve(require('@jupyter-widgets/base7')); } else { // ipywidgets 8 model - requirePromise(['@jupyter-widgets/base']).then(resolve); + resolve(require('@jupyter-widgets/base')); } } else if (moduleName === '@jupyter-widgets/controls') { const best = maxSatisfying(['1.5.0', '2.0.0'], moduleVersion); @@ -138,7 +137,7 @@ export class HTMLManager extends ManagerBase { ) { require('@jupyter-widgets/controls7/css/labvariables.css'); } - requirePromise(['@jupyter-widgets/controls7']).then(resolve); + resolve(require('@jupyter-widgets/controls7')); } else { // ipywidgets 8 controls JS and CSS require('@jupyter-widgets/controls/css/widgets-base.css'); @@ -151,7 +150,8 @@ export class HTMLManager extends ManagerBase { ) { require('@jupyter-widgets/controls/css/labvariables.css'); } - requirePromise(['@jupyter-widgets/controls']).then(resolve); + + resolve(require('@jupyter-widgets/controls')); } } else if (moduleName === '@jupyter-widgets/output') { resolve(outputWidgets); diff --git a/packages/html-manager/src/output_renderers.ts b/packages/html-manager/src/output_renderers.ts index c343aa1201..24155086ec 100644 --- a/packages/html-manager/src/output_renderers.ts +++ b/packages/html-manager/src/output_renderers.ts @@ -27,7 +27,7 @@ export class WidgetRenderer extends Widget implements IRenderMime.IRenderer { try { const wModel = await this._manager.get_model(source.model_id); const wView = await this._manager.create_view(wModel); - Widget.attach(wView.luminoWidget, this.node); + Widget.attach(wView.luminoWidget || wView.pWidget, this.node); } catch (err) { console.log('Error displaying widget'); console.log(err); diff --git a/packages/html-manager/test/src/output_test.ts b/packages/html-manager/test/src/output_test.ts index 712c58f2ab..ad1298e213 100644 --- a/packages/html-manager/test/src/output_test.ts +++ b/packages/html-manager/test/src/output_test.ts @@ -63,7 +63,6 @@ describe('Output widget', function () { expect(elt.querySelectorAll('table').length).to.equal(1); }); - it('renders widgets ipywidgets 7', async function () { const modelState = { _view_module: '@jupyter-widgets/output',