@difizen/libro-prompt-cell 0.1.37 → 0.2.1

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.
@@ -40,7 +40,7 @@ export var LibroPromptCellCommandContribution = (_dec = singleton({
40
40
  libro.invertCell(cell, 'prompt');
41
41
  },
42
42
  isEnabled: function isEnabled(cell, libro) {
43
- if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
43
+ if (!libro || !(libro instanceof LibroView) || !libro.model.cellsEditable) {
44
44
  return false;
45
45
  }
46
46
  return true;
@@ -526,8 +526,8 @@ export var LibroPromptCellView = (_dec = transient(), _dec2 = view('prompt-edito
526
526
  editorHostId: this.parent.id + this.id,
527
527
  model: this.model,
528
528
  config: {
529
- readOnly: this.parent.model.readOnly,
530
- editable: !this.parent.model.readOnly
529
+ readOnly: !this.parent.model.inputEditable,
530
+ editable: this.parent.model.inputEditable
531
531
  }
532
532
  };
533
533
  return option;
@@ -579,9 +579,9 @@ export var LibroPromptCellView = (_dec = transient(), _dec2 = view('prompt-edito
579
579
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
580
580
  while (1) switch (_context7.prev = _context7.next) {
581
581
  case 0:
582
- watch(this.parent.model, 'readOnly', function () {
582
+ watch(this.parent.model, 'inputEditable', function () {
583
583
  var _this3$editorView;
584
- (_this3$editorView = _this3.editorView) === null || _this3$editorView === void 0 || (_this3$editorView = _this3$editorView.editor) === null || _this3$editorView === void 0 || _this3$editorView.setOption('readOnly', getOrigin(_this3.parent.model.readOnly));
584
+ (_this3$editorView = _this3.editorView) === null || _this3$editorView === void 0 || (_this3$editorView = _this3$editorView.editor) === null || _this3$editorView === void 0 || _this3$editorView.setOption('readOnly', getOrigin(!_this3.parent.model.inputEditable));
585
585
  });
586
586
  (_this$editorView3 = this.editorView) === null || _this$editorView3 === void 0 || _this$editorView3.onModalChange(function (val) {
587
587
  return _this3.hasModal = val;
@@ -610,7 +610,7 @@ export var LibroPromptCellView = (_dec = transient(), _dec2 = view('prompt-edito
610
610
  //选中cell、编辑模式、非只读时才focus
611
611
  if ((_this$editorView4 = this.editorView) !== null && _this$editorView4 !== void 0 && _this$editorView4.editor && this.editorView.editorStatus === 'ready' && ((_this$parent$model$ac2 = this.parent.model.active) === null || _this$parent$model$ac2 === void 0 ? void 0 : _this$parent$model$ac2.id) === this.id && !this.parent.model.commandMode && this.libroContextKey.commandModeEnabled === true &&
612
612
  // 排除弹窗等情况
613
- this.parent.model.readOnly === false) {
613
+ this.parent.model.inputEditable) {
614
614
  var _this$editorView5, _this$editorView6, _this$editorView7;
615
615
  (_this$editorView5 = this.editorView) === null || _this$editorView5 === void 0 || _this$editorView5.editor.setOption('styleActiveLine', true);
616
616
  (_this$editorView6 = this.editorView) === null || _this$editorView6 === void 0 || _this$editorView6.editor.setOption('highlightActiveLineGutter', true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-prompt-cell",
3
- "version": "0.1.37",
3
+ "version": "0.2.1",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "libro",
@@ -32,12 +32,12 @@
32
32
  "src"
33
33
  ],
34
34
  "dependencies": {
35
- "@difizen/libro-code-editor": "^0.1.37",
36
- "@difizen/libro-jupyter": "^0.1.37",
37
- "@difizen/libro-rendermime": "^0.1.37",
38
- "@difizen/libro-codemirror": "^0.1.37",
39
- "@difizen/libro-common": "^0.1.37",
40
- "@difizen/libro-core": "^0.1.37",
35
+ "@difizen/libro-code-editor": "^0.2.1",
36
+ "@difizen/libro-jupyter": "^0.2.1",
37
+ "@difizen/libro-rendermime": "^0.2.1",
38
+ "@difizen/libro-codemirror": "^0.2.1",
39
+ "@difizen/libro-common": "^0.2.1",
40
+ "@difizen/libro-core": "^0.2.1",
41
41
  "@ant-design/icons": "^5.1.0",
42
42
  "@difizen/mana-l10n": "latest",
43
43
  "@difizen/mana-app": "latest",
@@ -47,7 +47,7 @@ export class LibroPromptCellCommandContribution
47
47
  libro.invertCell(cell, 'prompt');
48
48
  },
49
49
  isEnabled: (cell, libro) => {
50
- if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
50
+ if (!libro || !(libro instanceof LibroView) || !libro.model.cellsEditable) {
51
51
  return false;
52
52
  }
53
53
  return true;
@@ -355,8 +355,8 @@ export class LibroPromptCellView extends LibroExecutableCellView {
355
355
  editorHostId: this.parent.id + this.id,
356
356
  model: this.model,
357
357
  config: {
358
- readOnly: this.parent.model.readOnly,
359
- editable: !this.parent.model.readOnly,
358
+ readOnly: !this.parent.model.inputEditable,
359
+ editable: this.parent.model.inputEditable,
360
360
  },
361
361
  };
362
362
  return option;
@@ -381,10 +381,10 @@ export class LibroPromptCellView extends LibroExecutableCellView {
381
381
  }
382
382
 
383
383
  protected async afterEditorReady() {
384
- watch(this.parent.model, 'readOnly', () => {
384
+ watch(this.parent.model, 'inputEditable', () => {
385
385
  this.editorView?.editor?.setOption(
386
386
  'readOnly',
387
- getOrigin(this.parent.model.readOnly),
387
+ getOrigin(!this.parent.model.inputEditable),
388
388
  );
389
389
  });
390
390
  this.editorView?.onModalChange((val) => (this.hasModal = val));
@@ -411,7 +411,7 @@ export class LibroPromptCellView extends LibroExecutableCellView {
411
411
  this.parent.model.active?.id === this.id &&
412
412
  !this.parent.model.commandMode &&
413
413
  this.libroContextKey.commandModeEnabled === true && // 排除弹窗等情况
414
- this.parent.model.readOnly === false
414
+ this.parent.model.inputEditable
415
415
  ) {
416
416
  this.editorView?.editor.setOption('styleActiveLine', true);
417
417
  this.editorView?.editor.setOption('highlightActiveLineGutter', true);