As a part of my extension, I am creating a CodeCell widget inside the widget itself (attached to the right pane). This code works fine to initialize the cell and set the contents to “Waiting for result”.
const factoryService = new CodeMirrorEditorFactory({});
this.codeCell = new CodeCell({
contentFactory: new Cell.ContentFactory({
editorFactory: factoryService.newInlineEditor.bind(factoryService)
}),
model: new CodeCellModel(),
rendermime: new RenderMimeRegistry({ initialFactories }),
}).initializeState();
...
this.codeCell.model.sharedModel.setSource('Waiting for result');
this.codeCell.model.sharedModel.setMetadata({ 'language': 'python' });
this.codeCell.inputArea?.editorWidget?.model.sharedModel.setSource('Waiting for result');
this.codeCell.activate;
layout.addWidget(this.codeCell);
this.outputGroup.append(this.codeCell.node);
Next, when I try to update the cell programmatically, the content is not changing.
this.codeCell.inputArea?.editorWidget?.model.sharedModel.setSource(this._result);
this._result
is set properly and contains the string I expect. No amount of .activate
.update
or other similar function calls that I’ve tried result in the new string being displayed in the cell. Any suggestions?