@difizen/libro-code-cell 0.1.30 → 0.1.31
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/es/code-cell-view.d.ts +2 -2
- package/es/code-cell-view.js +5 -5
- package/package.json +4 -4
- package/src/code-cell-view.tsx +3 -3
package/es/code-cell-view.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CodeEditorViewOptions, CodeEditorView } from '@difizen/libro-code-
|
|
|
3
3
|
import { CodeEditorManager } from '@difizen/libro-code-editor';
|
|
4
4
|
import type { IOutput } from '@difizen/libro-common';
|
|
5
5
|
import type { LibroCell, CellViewOptions } from '@difizen/libro-core';
|
|
6
|
-
import { CellService, EditorStatus, LibroExecutableCellView, LibroOutputArea,
|
|
6
|
+
import { CellService, EditorStatus, LibroExecutableCellView, LibroOutputArea, LibroContextKey } from '@difizen/libro-core';
|
|
7
7
|
import type { ViewSize } from '@difizen/mana-app';
|
|
8
8
|
import { DisposableCollection } from '@difizen/mana-app';
|
|
9
9
|
import { ViewManager, Deferred } from '@difizen/mana-app';
|
|
@@ -11,7 +11,7 @@ import type { LibroCodeCellModel } from './code-cell-model.js';
|
|
|
11
11
|
export declare const CellEditorMemo: import("react").NamedExoticComponent<{}>;
|
|
12
12
|
export declare class LibroCodeCellView extends LibroExecutableCellView {
|
|
13
13
|
protected toDisposeOnEditor: DisposableCollection;
|
|
14
|
-
protected readonly
|
|
14
|
+
protected readonly libroContextKey: LibroContextKey;
|
|
15
15
|
view: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
|
|
16
16
|
viewManager: ViewManager;
|
|
17
17
|
codeEditorManager: CodeEditorManager;
|
package/es/code-cell-view.js
CHANGED
|
@@ -29,7 +29,7 @@ function _initializerWarningHelper(descriptor, context) { throw new Error('Decor
|
|
|
29
29
|
|
|
30
30
|
import { CodeEditorManager } from '@difizen/libro-code-editor';
|
|
31
31
|
import { isOutput } from '@difizen/libro-common';
|
|
32
|
-
import { CellService, EditorStatus, LibroExecutableCellView, LibroOutputArea, VirtualizedManagerHelper,
|
|
32
|
+
import { CellService, EditorStatus, LibroExecutableCellView, LibroOutputArea, VirtualizedManagerHelper, LibroContextKey } from '@difizen/libro-core';
|
|
33
33
|
import { Disposable } from '@difizen/mana-app';
|
|
34
34
|
import { DisposableCollection } from '@difizen/mana-app';
|
|
35
35
|
import { getOrigin, inject, prop, transient, useInject, view, ViewInstance, ViewManager, ViewOption, ViewRender, watch, Deferred } from '@difizen/mana-app';
|
|
@@ -85,7 +85,7 @@ var CodeEditorViewComponent = /*#__PURE__*/forwardRef(function CodeEditorViewCom
|
|
|
85
85
|
children: /*#__PURE__*/_jsx(CellEditorMemo, {})
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
|
-
export var LibroCodeCellView = (_dec = transient(), _dec2 = view('code-editor-cell-view'), _dec3 = inject(
|
|
88
|
+
export var LibroCodeCellView = (_dec = transient(), _dec2 = view('code-editor-cell-view'), _dec3 = inject(LibroContextKey), _dec4 = prop(), _dec5 = prop(), _dec6 = prop(), _dec7 = prop(), _dec8 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_LibroExecutableCellV) {
|
|
89
89
|
_inherits(LibroCodeCellView, _LibroExecutableCellV);
|
|
90
90
|
var _super = _createSuper(LibroCodeCellView);
|
|
91
91
|
function LibroCodeCellView(options, cellService, viewManager, codeEditorManager) {
|
|
@@ -94,7 +94,7 @@ export var LibroCodeCellView = (_dec = transient(), _dec2 = view('code-editor-ce
|
|
|
94
94
|
_classCallCheck(this, LibroCodeCellView);
|
|
95
95
|
_this = _super.call(this, options, cellService);
|
|
96
96
|
_this.toDisposeOnEditor = new DisposableCollection();
|
|
97
|
-
_initializerDefineProperty(_this, "
|
|
97
|
+
_initializerDefineProperty(_this, "libroContextKey", _descriptor, _assertThisInitialized(_this));
|
|
98
98
|
_this.view = CodeEditorViewComponent;
|
|
99
99
|
_this.viewManager = void 0;
|
|
100
100
|
_this.codeEditorManager = void 0;
|
|
@@ -339,7 +339,7 @@ export var LibroCodeCellView = (_dec = transient(), _dec2 = view('code-editor-ce
|
|
|
339
339
|
value: function focusEditor() {
|
|
340
340
|
var _this$editorView4, _this$parent$model$ac;
|
|
341
341
|
//选中cell、编辑模式、非只读时才focus
|
|
342
|
-
if ((_this$editorView4 = this.editorView) !== null && _this$editorView4 !== void 0 && _this$editorView4.editor && this.editorView.editorStatus === 'ready' && ((_this$parent$model$ac = this.parent.model.active) === null || _this$parent$model$ac === void 0 ? void 0 : _this$parent$model$ac.id) === this.id && !this.parent.model.commandMode && this.
|
|
342
|
+
if ((_this$editorView4 = this.editorView) !== null && _this$editorView4 !== void 0 && _this$editorView4.editor && this.editorView.editorStatus === 'ready' && ((_this$parent$model$ac = this.parent.model.active) === null || _this$parent$model$ac === void 0 ? void 0 : _this$parent$model$ac.id) === this.id && !this.parent.model.commandMode && this.libroContextKey.commandModeEnabled === true &&
|
|
343
343
|
// 排除弹窗等情况
|
|
344
344
|
this.parent.model.readOnly === false) {
|
|
345
345
|
var _this$editorView5, _this$editorView6, _this$editorView7;
|
|
@@ -356,7 +356,7 @@ export var LibroCodeCellView = (_dec = transient(), _dec2 = view('code-editor-ce
|
|
|
356
356
|
}
|
|
357
357
|
}]);
|
|
358
358
|
return LibroCodeCellView;
|
|
359
|
-
}(LibroExecutableCellView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "
|
|
359
|
+
}(LibroExecutableCellView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "libroContextKey", [_dec3], {
|
|
360
360
|
configurable: true,
|
|
361
361
|
enumerable: true,
|
|
362
362
|
writable: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-code-cell",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"src"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@difizen/libro-code-editor": "^0.1.
|
|
36
|
-
"@difizen/libro-common": "^0.1.
|
|
37
|
-
"@difizen/libro-core": "^0.1.
|
|
35
|
+
"@difizen/libro-code-editor": "^0.1.31",
|
|
36
|
+
"@difizen/libro-common": "^0.1.31",
|
|
37
|
+
"@difizen/libro-core": "^0.1.31",
|
|
38
38
|
"@difizen/mana-app": "latest"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
package/src/code-cell-view.tsx
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
LibroExecutableCellView,
|
|
17
17
|
LibroOutputArea,
|
|
18
18
|
VirtualizedManagerHelper,
|
|
19
|
-
|
|
19
|
+
LibroContextKey,
|
|
20
20
|
} from '@difizen/libro-core';
|
|
21
21
|
import type { ViewSize } from '@difizen/mana-app';
|
|
22
22
|
import { Disposable } from '@difizen/mana-app';
|
|
@@ -103,7 +103,7 @@ const CodeEditorViewComponent = forwardRef<HTMLDivElement>(
|
|
|
103
103
|
@view('code-editor-cell-view')
|
|
104
104
|
export class LibroCodeCellView extends LibroExecutableCellView {
|
|
105
105
|
protected toDisposeOnEditor = new DisposableCollection();
|
|
106
|
-
@inject(
|
|
106
|
+
@inject(LibroContextKey) protected readonly libroContextKey: LibroContextKey;
|
|
107
107
|
override view = CodeEditorViewComponent;
|
|
108
108
|
|
|
109
109
|
viewManager: ViewManager;
|
|
@@ -292,7 +292,7 @@ export class LibroCodeCellView extends LibroExecutableCellView {
|
|
|
292
292
|
this.editorView.editorStatus === 'ready' &&
|
|
293
293
|
this.parent.model.active?.id === this.id &&
|
|
294
294
|
!this.parent.model.commandMode &&
|
|
295
|
-
this.
|
|
295
|
+
this.libroContextKey.commandModeEnabled === true && // 排除弹窗等情况
|
|
296
296
|
this.parent.model.readOnly === false
|
|
297
297
|
) {
|
|
298
298
|
this.editorView?.editor.setOption('styleActiveLine', true);
|