From e86ceddbe4ccb5497cfdccbd2d6641de39267d4d Mon Sep 17 00:00:00 2001 From: Erich Schubert Date: Fri, 15 Mar 2024 11:38:13 +0100 Subject: [PATCH] ref cannot be undefined here, and cm was just set. (#734) --- packages/thebe/src/codemirror.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/thebe/src/codemirror.ts b/packages/thebe/src/codemirror.ts index 3d96e9e0..97a745ba 100644 --- a/packages/thebe/src/codemirror.ts +++ b/packages/thebe/src/codemirror.ts @@ -132,17 +132,17 @@ export function setupCodemirror( // TODO enable loading of mode js files via configuration // see https://github.com/jupyterlab/jupyterlab/blob/3.6.x/packages/codemirror/src/mode.ts for // an example of how to do this - ref.cm?.setOption('mode', codeMirrorConfig.mode); + ref.cm.setOption('mode', codeMirrorConfig.mode); // All cells in the notebook automatically update their sources on change - ref?.cm?.on('change', () => { - const code = ref?.cm?.getValue(); + ref.cm.on('change', () => { + const code = ref.cm.getValue(); cell.source = code; - ref?.cm?.refresh(); + ref.cm.refresh(); }); if (codeMirrorConfig.readOnly) { - ref.cm?.display.lineDiv.setAttribute('data-readonly', 'true'); + ref.cm.display.lineDiv.setAttribute('data-readonly', 'true'); editorEl.setAttribute('data-readonly', 'true'); cellEl.setAttribute('data-readonly', 'true'); }