-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Issue
One cannot easily create a yjs-widgets based on Lumino. Because the node element that the Renderer provides is not yet attached:
class YJupyterCADWidget implements IJupyterYWidget {
constructor(yModel: JupyterYModel, node: HTMLElement) {
this.yModel = yModel;
this.node = node;
const widget = new LuminoWidget();
// The following does not work! Because this.node is not yet attached to the DOM
Widget.attach(widget, this.node);
}
yModel: JupyterYModel;
node: HTMLElement;
}Fix proposition
I would like to suggest modifying the JupyterYWidget to get closer to the logic we have in ipywidgets. Basically, the Widget class would be expected to have a node element that would either be a Lumino Widget:
async renderModel(mimeModel: IRenderMime.IMimeModel): Promise<void> {
const modelId = mimeModel.data[this._mimeType]!['model_id'];
this._yModel = this._modelFactory.getYModel(modelId);
if (!this._yModel) {
return;
}
const widget = this._modelFactory.createYWidget(modelId);
this.addWidget(widget.node)
}Metadata
Metadata
Assignees
Labels
No labels