@jupyterlab/console 4.0.0-alpha.8 → 4.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/foreign.js CHANGED
@@ -80,7 +80,7 @@ export class ForeignHandler {
80
80
  cell = this._newCell(parentMsgId);
81
81
  const model = cell.model;
82
82
  model.executionCount = inputMsg.content.execution_count;
83
- model.value.text = inputMsg.content.code;
83
+ model.sharedModel.setSource(inputMsg.content.code);
84
84
  model.trusted = true;
85
85
  parent.update();
86
86
  return true;
@@ -93,7 +93,10 @@ export class ForeignHandler {
93
93
  if (!cell) {
94
94
  return false;
95
95
  }
96
- const output = Object.assign(Object.assign({}, msg.content), { output_type: msgType });
96
+ const output = {
97
+ ...msg.content,
98
+ output_type: msgType
99
+ };
97
100
  cell.model.outputs.add(output);
98
101
  parent.update();
99
102
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"foreign.js","sourceRoot":"","sources":["../src/foreign.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAO3D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,kBAAkB,GAAG,4BAA4B,CAAC;AAExD;;;GAGG;AACH,MAAM,OAAO,cAAc;IACzB;;OAEG;IACH,YAAY,OAAgC;QA6HpC,aAAQ,GAAG,KAAK,CAAC;QAEjB,gBAAW,GAAG,KAAK,CAAC;QA9H1B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IACD,IAAI,OAAO,CAAC,KAAc;QACxB,IAAI,CAA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AC;gBACzC,IAAI,CAAC,IAAI,EAAE;oBACT,OAAO,KAAK,CAAC;iBACd;gBACD,MAAM,MAAM,GAAqB;oBAC/B,GAAG,GAAG,CAAC,OAAO;oBACd,WAAW,EAAE,OAAO;iBACrB,CAAC;gBACF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBAC/B,MAAM,CAAC,MAAM,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC;aACb;YACD,KAAK,cAAc,CAAC,CAAC;gBACnB,MAAM,IAAI,GAAI,GAAqC,CAAC,OAAO,CAAC,IAAI,CAAC;gBACjE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;gBACzC,IAAI,IAAI,EAAE;oBACR,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;iBAChC;gBACD,OAAO,IAAI,CAAC;aACb;YACD;gBACE,OAAO,KAAK,CAAC;SAChB;IACH,CAAC;IAED;;OAEG;IACK,QAAQ,CAAC,WAAmB;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QAC1C,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QAClC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;CAKF"}
package/lib/history.js CHANGED
@@ -37,12 +37,12 @@ export class ConsoleHistory {
37
37
  const prev = this._editor;
38
38
  if (prev) {
39
39
  prev.edgeRequested.disconnect(this.onEdgeRequest, this);
40
- prev.model.value.changed.disconnect(this.onTextChange, this);
40
+ prev.model.sharedModel.changed.disconnect(this.onTextChange, this);
41
41
  }
42
42
  this._editor = value;
43
43
  if (value) {
44
44
  value.edgeRequested.connect(this.onEdgeRequest, this);
45
- value.model.value.changed.connect(this.onTextChange, this);
45
+ value.model.sharedModel.changed.connect(this.onTextChange, this);
46
46
  }
47
47
  }
48
48
  /**
@@ -172,18 +172,18 @@ export class ConsoleHistory {
172
172
  * Handle an edge requested signal.
173
173
  */
174
174
  onEdgeRequest(editor, location) {
175
- const model = editor.model;
176
- const source = model.value.text;
175
+ const sharedModel = editor.model.sharedModel;
176
+ const source = sharedModel.getSource();
177
177
  if (location === 'top' || location === 'topLine') {
178
178
  void this.back(source).then(value => {
179
179
  if (this.isDisposed || !value) {
180
180
  return;
181
181
  }
182
- if (model.value.text === value) {
182
+ if (sharedModel.getSource() === value) {
183
183
  return;
184
184
  }
185
185
  this._setByHistory = true;
186
- model.value.text = value;
186
+ sharedModel.setSource(value);
187
187
  let columnPos = 0;
188
188
  columnPos = value.indexOf('\n');
189
189
  if (columnPos < 0) {
@@ -198,11 +198,11 @@ export class ConsoleHistory {
198
198
  return;
199
199
  }
200
200
  const text = value || this.placeholder;
201
- if (model.value.text === text) {
201
+ if (sharedModel.getSource() === text) {
202
202
  return;
203
203
  }
204
204
  this._setByHistory = true;
205
- model.value.text = text;
205
+ sharedModel.setSource(text);
206
206
  const pos = editor.getPositionAt(text.length);
207
207
  if (pos) {
208
208
  editor.setCursorPosition(pos);
@@ -1 +1 @@
1
- {"version":3,"file":"history.js","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAM3D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AA6D3C;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB;;OAEG;IACH,YAAY,OAAgC;QAmQpC,YAAO,GAAG,CAAC,CAAC;QACZ,gBAAW,GAAG,KAAK,CAAC;QACpB,aAAQ,GAAa,EAAE,CAAC;QACxB,iBAAY,GAAW,EAAE,CAAC;QAC1B,kBAAa,GAAG,KAAK,CAAC;QACtB,gBAAW,GAAG,KAAK,CAAC;QACpB,YAAO,GAA8B,IAAI,CAAC;QAC1C,cAAS,GAAa,EAAE,CAAC;QA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AAE,GAAG;KACP,CAAC;AACJ,CAAC,EAPS,OAAO,KAAP,OAAO,QAOhB"}
package/lib/panel.d.ts CHANGED
@@ -93,6 +93,10 @@ export declare namespace ConsolePanel {
93
93
  * An existing session context to use.
94
94
  */
95
95
  sessionContext?: ISessionContext;
96
+ /**
97
+ * Session dialogs to use.
98
+ */
99
+ sessionDialogs?: ISessionContext.IDialogs;
96
100
  /**
97
101
  * The model factory for the console widget.
98
102
  */
@@ -138,10 +142,6 @@ export declare namespace ConsolePanel {
138
142
  interface IOptions extends CodeConsole.ContentFactory.IOptions {
139
143
  }
140
144
  }
141
- /**
142
- * A default code console content factory.
143
- */
144
- const defaultContentFactory: IContentFactory;
145
145
  /**
146
146
  * The console renderer token.
147
147
  */
package/lib/panel.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
- import { MainAreaWidget, SessionContext, sessionContextDialogs } from '@jupyterlab/apputils';
3
+ import { MainAreaWidget, SessionContext, SessionContextDialogs } from '@jupyterlab/apputils';
4
4
  import { PathExt, Time, URLExt } from '@jupyterlab/coreutils';
5
5
  import { RenderMimeRegistry } from '@jupyterlab/rendermime';
6
6
  import { nullTranslator } from '@jupyterlab/translation';
@@ -25,27 +25,25 @@ export class ConsolePanel extends MainAreaWidget {
25
25
  this._connected = null;
26
26
  this.addClass(PANEL_CLASS);
27
27
  let { rendermime, mimeTypeService, path, basePath, name, manager, modelFactory, sessionContext, translator } = options;
28
- this.translator = translator || nullTranslator;
28
+ this.translator = translator !== null && translator !== void 0 ? translator : nullTranslator;
29
29
  const trans = this.translator.load('jupyterlab');
30
- const contentFactory = (this.contentFactory =
31
- options.contentFactory || ConsolePanel.defaultContentFactory);
30
+ const contentFactory = (this.contentFactory = options.contentFactory);
32
31
  const count = Private.count++;
33
32
  if (!path) {
34
33
  path = URLExt.join(basePath || '', `console-${count}-${UUID.uuid4()}`);
35
34
  }
36
35
  sessionContext = this._sessionContext =
37
- sessionContext ||
38
- new SessionContext({
39
- sessionManager: manager.sessions,
40
- specsManager: manager.kernelspecs,
41
- path,
42
- name: name || trans.__('Console %1', count),
43
- type: 'console',
44
- kernelPreference: options.kernelPreference,
45
- setBusy: options.setBusy
46
- });
36
+ sessionContext !== null && sessionContext !== void 0 ? sessionContext : new SessionContext({
37
+ sessionManager: manager.sessions,
38
+ specsManager: manager.kernelspecs,
39
+ path,
40
+ name: name || trans.__('Console %1', count),
41
+ type: 'console',
42
+ kernelPreference: options.kernelPreference,
43
+ setBusy: options.setBusy
44
+ });
47
45
  const resolver = new RenderMimeRegistry.UrlResolver({
48
- session: sessionContext,
46
+ path,
49
47
  contents: manager.contents
50
48
  });
51
49
  rendermime = rendermime.clone({ resolver });
@@ -54,12 +52,14 @@ export class ConsolePanel extends MainAreaWidget {
54
52
  sessionContext: sessionContext,
55
53
  mimeTypeService,
56
54
  contentFactory,
57
- modelFactory
55
+ modelFactory,
56
+ translator
58
57
  });
59
58
  this.content.addWidget(this.console);
60
59
  void sessionContext.initialize().then(async (value) => {
60
+ var _a;
61
61
  if (value) {
62
- await sessionContextDialogs.selectKernel(sessionContext);
62
+ await ((_a = options.sessionDialogs) !== null && _a !== void 0 ? _a : new SessionContextDialogs({ translator })).selectKernel(sessionContext);
63
63
  }
64
64
  this._connected = new Date();
65
65
  this._updateTitlePanel();
@@ -132,10 +132,6 @@ export class ConsolePanel extends MainAreaWidget {
132
132
  }
133
133
  }
134
134
  ConsolePanel.ContentFactory = ContentFactory;
135
- /**
136
- * A default code console content factory.
137
- */
138
- ConsolePanel.defaultContentFactory = new ContentFactory();
139
135
  /**
140
136
  * The console renderer token.
141
137
  */
package/lib/panel.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"panel.js","sourceRoot":"","sources":["../src/panel.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAEL,cAAc,EACd,cAAc,EACd,qBAAqB,EACtB,MAAM,sB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EA3CS,OAAO,KAAP,OAAO,QA2ChB"}
package/lib/widget.d.ts CHANGED
@@ -1,9 +1,11 @@
1
+ import { ISharedRawCell } from '@jupyter/ydoc';
1
2
  import { ISessionContext } from '@jupyterlab/apputils';
2
- import { Cell, CellModel, CodeCell, CodeCellModel, ICodeCellModel, IRawCellModel, RawCell } from '@jupyterlab/cells';
3
+ import { AttachmentsCellModel, Cell, CodeCell, CodeCellModel, ICodeCellModel, IRawCellModel, RawCell } from '@jupyterlab/cells';
3
4
  import { IEditorMimeTypeService } from '@jupyterlab/codeeditor';
4
5
  import * as nbformat from '@jupyterlab/nbformat';
5
6
  import { IObservableList } from '@jupyterlab/observables';
6
7
  import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
8
+ import { ITranslator } from '@jupyterlab/translation';
7
9
  import { JSONObject } from '@lumino/coreutils';
8
10
  import { Message } from '@lumino/messaging';
9
11
  import { ISignal } from '@lumino/signaling';
@@ -44,6 +46,10 @@ export declare class CodeConsole extends Widget {
44
46
  * The client session used by the console.
45
47
  */
46
48
  readonly sessionContext: ISessionContext;
49
+ /**
50
+ * The configuration options for the text editor widget.
51
+ */
52
+ editorConfig: Record<string, any>;
47
53
  /**
48
54
  * The list of content cells in the console.
49
55
  *
@@ -197,10 +203,6 @@ export declare class CodeConsole extends Widget {
197
203
  * Test whether we should execute the prompt cell.
198
204
  */
199
205
  private _shouldExecute;
200
- /**
201
- * Handle a keydown event on an editor.
202
- */
203
- private _onEditorKeydown;
204
206
  /**
205
207
  * Handle a change to the kernel.
206
208
  */
@@ -223,6 +225,7 @@ export declare class CodeConsole extends Widget {
223
225
  private _dragData;
224
226
  private _drag;
225
227
  private _focusedCell;
228
+ private _translator;
226
229
  }
227
230
  /**
228
231
  * A namespace for CodeConsole statics.
@@ -252,7 +255,15 @@ export declare namespace CodeConsole {
252
255
  * The service used to look up mime types.
253
256
  */
254
257
  mimeTypeService: IEditorMimeTypeService;
258
+ /**
259
+ * The application language translator.
260
+ */
261
+ translator?: ITranslator;
255
262
  }
263
+ /**
264
+ * Default console editor configuration
265
+ */
266
+ const defaultEditorConfig: Record<string, any>;
256
267
  /**
257
268
  * A content factory for console children.
258
269
  */
@@ -297,10 +308,6 @@ export declare namespace CodeConsole {
297
308
  interface IOptions extends Cell.IContentFactory {
298
309
  }
299
310
  }
300
- /**
301
- * A default content factory for the code console.
302
- */
303
- const defaultContentFactory: IContentFactory;
304
311
  /**
305
312
  * A model factory for a console widget.
306
313
  */
@@ -326,7 +333,7 @@ export declare namespace CodeConsole {
326
333
  * @returns A new raw cell. If a source cell is provided, the
327
334
  * new cell will be initialized with the data from the source.
328
335
  */
329
- createRawCell(options: CellModel.IOptions): IRawCellModel;
336
+ createRawCell(options: AttachmentsCellModel.IOptions<ISharedRawCell>): IRawCellModel;
330
337
  }
331
338
  /**
332
339
  * The default implementation of an `IModelFactory`.
@@ -342,24 +349,20 @@ export declare namespace CodeConsole {
342
349
  readonly codeCellContentFactory: CodeCellModel.IContentFactory;
343
350
  /**
344
351
  * Create a new code cell.
345
- *
346
- * @param source - The data to use for the original source data.
347
- *
352
+ * @param options - The data to use for the original source data.
348
353
  * @returns A new code cell. If a source cell is provided, the
349
- * new cell will be initialized with the data from the source.
350
- * If the contentFactory is not provided, the instance
351
- * `codeCellContentFactory` will be used.
354
+ new cell will be initialized with the data from the source.
355
+ If the contentFactory is not provided, the instance
356
+ `codeCellContentFactory` will be used.
352
357
  */
353
- createCodeCell(options: CodeCellModel.IOptions): ICodeCellModel;
358
+ createCodeCell(options?: CodeCellModel.IOptions): ICodeCellModel;
354
359
  /**
355
360
  * Create a new raw cell.
356
- *
357
- * @param source - The data to use for the original source data.
358
- *
361
+ * @param options - The data to use for the original source data.
359
362
  * @returns A new raw cell. If a source cell is provided, the
360
- * new cell will be initialized with the data from the source.
363
+ new cell will be initialized with the data from the source.
361
364
  */
362
- createRawCell(options: CellModel.IOptions): IRawCellModel;
365
+ createRawCell(options: AttachmentsCellModel.IOptions<ISharedRawCell>): IRawCellModel;
363
366
  }
364
367
  /**
365
368
  * The options used to initialize a `ModelFactory`.
package/lib/widget.js CHANGED
@@ -1,8 +1,11 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
+ import { Prec } from '@codemirror/state';
4
+ import { EditorView } from '@codemirror/view';
5
+ import { createStandaloneCell } from '@jupyter/ydoc';
3
6
  import { Cell, CellDragUtils, CodeCell, CodeCellModel, isCodeCellModel, RawCell, RawCellModel } from '@jupyterlab/cells';
4
7
  import { ObservableList } from '@jupyterlab/observables';
5
- import { each } from '@lumino/algorithm';
8
+ import { nullTranslator } from '@jupyterlab/translation';
6
9
  import { MimeData } from '@lumino/coreutils';
7
10
  import { Drag } from '@lumino/dragdrop';
8
11
  import { Signal } from '@lumino/signaling';
@@ -60,7 +63,12 @@ export class CodeConsole extends Widget {
60
63
  * Construct a console widget.
61
64
  */
62
65
  constructor(options) {
66
+ var _a, _b;
63
67
  super();
68
+ /**
69
+ * The configuration options for the text editor widget.
70
+ */
71
+ this.editorConfig = CodeConsole.defaultEditorConfig;
64
72
  this._banner = null;
65
73
  this._executed = new Signal(this);
66
74
  this._mimetype = 'text/x-ipython';
@@ -70,6 +78,7 @@ export class CodeConsole extends Widget {
70
78
  this._dragData = null;
71
79
  this._drag = null;
72
80
  this._focusedCell = null;
81
+ this._translator = (_a = options.translator) !== null && _a !== void 0 ? _a : nullTranslator;
73
82
  this.addClass(CONSOLE_CLASS);
74
83
  this.node.dataset[KERNEL_USER] = 'true';
75
84
  this.node.dataset[CODE_RUNNER] = 'true';
@@ -79,9 +88,8 @@ export class CodeConsole extends Widget {
79
88
  this._cells = new ObservableList();
80
89
  this._content = new Panel();
81
90
  this._input = new Panel();
82
- this.contentFactory =
83
- options.contentFactory || CodeConsole.defaultContentFactory;
84
- this.modelFactory = options.modelFactory || CodeConsole.defaultModelFactory;
91
+ this.contentFactory = options.contentFactory;
92
+ this.modelFactory = (_b = options.modelFactory) !== null && _b !== void 0 ? _b : CodeConsole.defaultModelFactory;
85
93
  this.rendermime = options.rendermime;
86
94
  this.sessionContext = options.sessionContext;
87
95
  this._mimeTypeService = options.mimeTypeService;
@@ -162,12 +170,33 @@ export class CodeConsole extends Widget {
162
170
  cell.disposed.connect(this._onCellDisposed, this);
163
171
  }
164
172
  // Create the banner.
165
- const model = this.modelFactory.createRawCell({});
166
- model.value.text = '...';
173
+ const model = this.modelFactory.createRawCell({
174
+ sharedModel: createStandaloneCell({
175
+ cell_type: 'raw',
176
+ source: '...'
177
+ })
178
+ });
167
179
  const banner = (this._banner = new RawCell({
168
180
  model,
169
181
  contentFactory: this.contentFactory,
170
- placeholder: false
182
+ placeholder: false,
183
+ editorConfig: {
184
+ autoClosingBrackets: false,
185
+ codeFolding: false,
186
+ highlightActiveLine: false,
187
+ highlightTrailingWhitespace: false,
188
+ highlightWhitespace: false,
189
+ indentUnit: '2',
190
+ lineNumbers: false,
191
+ lineWrap: true,
192
+ matchBrackets: false,
193
+ readOnly: true,
194
+ rulers: [],
195
+ scrollPastEnd: false,
196
+ smartIndent: false,
197
+ tabSize: 4,
198
+ theme: 'jupyter'
199
+ }
171
200
  })).initializeState();
172
201
  banner.addClass(BANNER_CLASS);
173
202
  banner.readOnly = true;
@@ -202,7 +231,6 @@ export class CodeConsole extends Widget {
202
231
  if (this.isDisposed) {
203
232
  return;
204
233
  }
205
- this._cells.clear();
206
234
  this._msgIdCells = null;
207
235
  this._msgIds = null;
208
236
  this._history.dispose();
@@ -267,9 +295,9 @@ export class CodeConsole extends Widget {
267
295
  */
268
296
  inject(code, metadata = {}) {
269
297
  const cell = this.createCodeCell();
270
- cell.model.value.text = code;
298
+ cell.model.sharedModel.setSource(code);
271
299
  for (const key of Object.keys(metadata)) {
272
- cell.model.metadata.set(key, metadata[key]);
300
+ cell.model.setMetadata(key, metadata[key]);
273
301
  }
274
302
  this.addCell(cell);
275
303
  return this._execute(cell);
@@ -306,12 +334,12 @@ export class CodeConsole extends Widget {
306
334
  */
307
335
  serialize() {
308
336
  const cells = [];
309
- each(this._cells, cell => {
337
+ for (const cell of this._cells) {
310
338
  const model = cell.model;
311
339
  if (isCodeCellModel(model)) {
312
340
  cells.push(model.toJSON());
313
341
  }
314
- });
342
+ }
315
343
  if (this.promptCell) {
316
344
  cells.push(this.promptCell.model.toJSON());
317
345
  }
@@ -381,7 +409,7 @@ export class CodeConsole extends Widget {
381
409
  source: this
382
410
  });
383
411
  this._drag.mimeData.setData(JUPYTER_CELL_MIME, selected);
384
- const textContent = cellModel.value.text;
412
+ const textContent = cellModel.sharedModel.getSource();
385
413
  this._drag.mimeData.setData('text/plain', textContent);
386
414
  this._focusedCell = null;
387
415
  document.removeEventListener('mousemove', this, true);
@@ -480,10 +508,7 @@ export class CodeConsole extends Widget {
480
508
  promptCell.addClass(PROMPT_CLASS);
481
509
  // Add the prompt cell to the DOM, making `this.promptCell` valid again.
482
510
  this._input.addWidget(promptCell);
483
- // Suppress the default "Enter" key handling.
484
- const editor = promptCell.editor;
485
- editor.addKeydownHandler(this._onEditorKeydown);
486
- this._history.editor = editor;
511
+ this._history.editor = promptCell.editor;
487
512
  this._promptCellCreated.emit(promptCell);
488
513
  }
489
514
  /**
@@ -524,7 +549,7 @@ export class CodeConsole extends Widget {
524
549
  * Execute the code in the current prompt cell.
525
550
  */
526
551
  _execute(cell) {
527
- const source = cell.model.value.text;
552
+ const source = cell.model.sharedModel.getSource();
528
553
  this._history.push(source);
529
554
  // If the source of the console is just "clear", clear the console as we
530
555
  // do in IPython or QtConsole.
@@ -547,16 +572,16 @@ export class CodeConsole extends Widget {
547
572
  if (setNextInput) {
548
573
  const text = setNextInput.text;
549
574
  // Ignore the `replace` value and always set the next cell.
550
- cell.model.value.text = text;
575
+ cell.model.sharedModel.setSource(text);
551
576
  }
552
577
  }
553
578
  }
554
579
  else if (value && value.content.status === 'error') {
555
- each(this._cells, (cell) => {
580
+ for (const cell of this._cells) {
556
581
  if (cell.model.executionCount === null) {
557
582
  cell.setPrompt('');
558
583
  }
559
- });
584
+ }
560
585
  }
561
586
  cell.model.contentChanged.disconnect(this.update, this);
562
587
  this.update();
@@ -576,10 +601,10 @@ export class CodeConsole extends Widget {
576
601
  */
577
602
  _handleInfo(info) {
578
603
  if (info.status !== 'ok') {
579
- this._banner.model.value.text = 'Error in getting kernel banner';
604
+ this._banner.model.sharedModel.setSource('Error in getting kernel banner');
580
605
  return;
581
606
  }
582
- this._banner.model.value.text = info.banner;
607
+ this._banner.model.sharedModel.setSource(info.banner);
583
608
  const lang = info.language_info;
584
609
  this._mimetype = this._mimeTypeService.getMimeTypeByLanguage(lang);
585
610
  if (this.promptCell) {
@@ -594,7 +619,26 @@ export class CodeConsole extends Widget {
594
619
  const modelFactory = this.modelFactory;
595
620
  const model = modelFactory.createCodeCell({});
596
621
  const rendermime = this.rendermime;
597
- return { model, rendermime, contentFactory, placeholder: false };
622
+ const editorConfig = this.editorConfig;
623
+ // Suppress the default "Enter" key handling.
624
+ const onKeyDown = EditorView.domEventHandlers({
625
+ keydown: (event, view) => {
626
+ if (event.keyCode === 13) {
627
+ event.preventDefault();
628
+ return true;
629
+ }
630
+ return false;
631
+ }
632
+ });
633
+ return {
634
+ model,
635
+ rendermime,
636
+ contentFactory,
637
+ editorConfig,
638
+ editorExtensions: [Prec.high(onKeyDown)],
639
+ placeholder: false,
640
+ translator: this._translator
641
+ };
598
642
  }
599
643
  /**
600
644
  * Handle cell disposed signals.
@@ -618,7 +662,7 @@ export class CodeConsole extends Widget {
618
662
  return Promise.resolve(false);
619
663
  }
620
664
  const model = promptCell.model;
621
- const code = model.value.text;
665
+ const code = model.sharedModel.getSource();
622
666
  return new Promise((resolve, reject) => {
623
667
  var _a;
624
668
  const timer = setTimeout(() => {
@@ -647,13 +691,6 @@ export class CodeConsole extends Widget {
647
691
  });
648
692
  });
649
693
  }
650
- /**
651
- * Handle a keydown event on an editor.
652
- */
653
- _onEditorKeydown(editor, event) {
654
- // Suppress "Enter" events.
655
- return event.keyCode === 13;
656
- }
657
694
  /**
658
695
  * Handle a change to the kernel.
659
696
  */
@@ -685,6 +722,13 @@ export class CodeConsole extends Widget {
685
722
  * A namespace for CodeConsole statics.
686
723
  */
687
724
  (function (CodeConsole) {
725
+ /**
726
+ * Default console editor configuration
727
+ */
728
+ CodeConsole.defaultEditorConfig = {
729
+ codeFolding: false,
730
+ lineNumbers: false
731
+ };
688
732
  /**
689
733
  * Default implementation of `IContentFactory`.
690
734
  */
@@ -697,9 +741,6 @@ export class CodeConsole extends Widget {
697
741
  * notebook content factory is used.
698
742
  */
699
743
  createCodeCell(options) {
700
- if (!options.contentFactory) {
701
- options.contentFactory = this;
702
- }
703
744
  return new CodeCell(options).initializeState();
704
745
  }
705
746
  /**
@@ -710,17 +751,10 @@ export class CodeConsole extends Widget {
710
751
  * notebook content factory is used.
711
752
  */
712
753
  createRawCell(options) {
713
- if (!options.contentFactory) {
714
- options.contentFactory = this;
715
- }
716
754
  return new RawCell(options).initializeState();
717
755
  }
718
756
  }
719
757
  CodeConsole.ContentFactory = ContentFactory;
720
- /**
721
- * A default content factory for the code console.
722
- */
723
- CodeConsole.defaultContentFactory = new ContentFactory();
724
758
  /**
725
759
  * The default implementation of an `IModelFactory`.
726
760
  */
@@ -734,15 +768,13 @@ export class CodeConsole extends Widget {
734
768
  }
735
769
  /**
736
770
  * Create a new code cell.
737
- *
738
- * @param source - The data to use for the original source data.
739
- *
771
+ * @param options - The data to use for the original source data.
740
772
  * @returns A new code cell. If a source cell is provided, the
741
- * new cell will be initialized with the data from the source.
742
- * If the contentFactory is not provided, the instance
743
- * `codeCellContentFactory` will be used.
773
+ new cell will be initialized with the data from the source.
774
+ If the contentFactory is not provided, the instance
775
+ `codeCellContentFactory` will be used.
744
776
  */
745
- createCodeCell(options) {
777
+ createCodeCell(options = {}) {
746
778
  if (!options.contentFactory) {
747
779
  options.contentFactory = this.codeCellContentFactory;
748
780
  }
@@ -750,11 +782,9 @@ export class CodeConsole extends Widget {
750
782
  }
751
783
  /**
752
784
  * Create a new raw cell.
753
- *
754
- * @param source - The data to use for the original source data.
755
- *
785
+ * @param options - The data to use for the original source data.
756
786
  * @returns A new raw cell. If a source cell is provided, the
757
- * new cell will be initialized with the data from the source.
787
+ new cell will be initialized with the data from the source.
758
788
  */
759
789
  createRawCell(options) {
760
790
  return new RawCellModel(options);