Skip to content

Commit 4a2c407

Browse files
dbg
1 parent 5fa32e4 commit 4a2c407

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

kernel/src/components/Dialog.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class Dialog {
4848
// create an arrow function that calls the save method on the serviceContainer but first iterates over all cells and gathers their code content if they are code cells
4949
async () => {
5050
// TODO: current widget might not be correct at this level, need to check and possibly change how we're getting this
51-
const notebook = props.app?.shell.currentWidget as NotebookPanel | null;
51+
const notebook = (props.app?.shell as { currentWidget?: unknown })?.currentWidget as NotebookPanel | null;
5252
var allCellContent : string = '';
5353

5454
console.log("[Dialog] saveCard: Saving notebook content...");
@@ -57,12 +57,10 @@ export class Dialog {
5757
console.log("[Dialog] saveCard: Found notebook:", notebook.title.label);
5858
notebook.revealed.then(() => {
5959

60-
6160
for (const cell of notebook.content.model.cells) {
62-
// TODO: nbformat has this property as 'cell_type' not 'type'
63-
// but it seems from the JupyterLab direct docs that it should be 'type'
64-
if (cell.type === 'code') {
65-
allCellContent += cell.source + '\n\n';
61+
const shared_cell_mapping = cell.sharedModel;
62+
if (shared_cell_mapping.cell_type === 'code') {
63+
allCellContent += shared_cell_mapping.getSource() + '\n\n';
6664
}
6765
}
6866

0 commit comments

Comments
 (0)