I am developing an extension including a little function that could create a code cell from the widget. I am trying to use the
const nbContent = this.notebookTracker.currentWidget?.content;
const codeCell = nbContent.contentFactory.createCodeCell({
cell: {
cell_type: 'code',
source: ['some code line 1', 'some code line 2'],
metadata: {}
}
});
const cells = nbContent.model.cells;
cells.insert(cells.length, codeCell);
But having an error. When I console.log(‘New Cell:’, codeCell), it says cannot read ‘metadataChanged’. I guess there is something wrong in the createCodeCell options. Does anyone have any ideas?