@difizen/libro-lab 0.1.16 → 0.1.18
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/command/lab-command.d.ts +1 -0
- package/es/command/lab-command.d.ts.map +1 -1
- package/es/command/lab-command.js +3 -2
- package/es/command/lab-menu-contribution.d.ts +4 -1
- package/es/command/lab-menu-contribution.d.ts.map +1 -1
- package/es/command/lab-menu-contribution.js +32 -3
- package/es/kernel-and-terminal-panel/panel-command.d.ts.map +1 -1
- package/es/kernel-and-terminal-panel/panel-command.js +2 -2
- package/package.json +9 -9
- package/src/command/lab-command.ts +2 -1
- package/src/command/lab-menu-contribution.ts +35 -4
- package/src/editor-viewer/code-editor-viewer.tsx +1 -1
- package/src/kernel-and-terminal-panel/panel-command.tsx +1 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lab-command.d.ts","sourceRoot":"","sources":["../../src/command/lab-command.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"lab-command.d.ts","sourceRoot":"","sources":["../../src/command/lab-command.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8IvB,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { LibroService } from '@difizen/libro-jupyter';
|
|
2
2
|
import { TerminalManager } from '@difizen/libro-terminal';
|
|
3
3
|
import type { MenuRegistry } from '@difizen/mana-app';
|
|
4
|
+
import type { KeybindingRegistry } from '@difizen/mana-app';
|
|
5
|
+
import { KeybindingContribution } from '@difizen/mana-app';
|
|
4
6
|
import { CommandContribution, CommandRegistry, MenuContribution, ViewManager } from '@difizen/mana-app';
|
|
5
7
|
import { LayoutService } from '../layout/layout-service.js';
|
|
6
8
|
export declare namespace LabMenus {
|
|
@@ -11,12 +13,13 @@ export declare namespace LabMenus {
|
|
|
11
13
|
const TERMINAL: string[];
|
|
12
14
|
const HELP: string[];
|
|
13
15
|
}
|
|
14
|
-
export declare class LabMenu implements MenuContribution, CommandContribution {
|
|
16
|
+
export declare class LabMenu implements MenuContribution, CommandContribution, KeybindingContribution {
|
|
15
17
|
protected commandRegistry: CommandRegistry;
|
|
16
18
|
protected libroService: LibroService;
|
|
17
19
|
protected layoutService: LayoutService;
|
|
18
20
|
terminalManager: TerminalManager;
|
|
19
21
|
viewManager: ViewManager;
|
|
22
|
+
registerKeybindings(keybindings: KeybindingRegistry): void;
|
|
20
23
|
registerMenus(menu: MenuRegistry): void;
|
|
21
24
|
registerCommands(commands: CommandRegistry): void;
|
|
22
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lab-menu-contribution.d.ts","sourceRoot":"","sources":["../../src/command/lab-menu-contribution.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,YAAY,EAEb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAoB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,eAAe,EAGf,gBAAgB,EAEhB,WAAW,EACZ,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"lab-menu-contribution.d.ts","sourceRoot":"","sources":["../../src/command/lab-menu-contribution.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,YAAY,EAEb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAoB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EACL,mBAAmB,EACnB,eAAe,EAGf,gBAAgB,EAEhB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAI5D,yBAAiB,QAAQ,CAAC;IACjB,MAAM,IAAI,UAA+B,CAAC;IAC1C,MAAM,IAAI,UAA+B,CAAC;IAC1C,MAAM,IAAI,UAA+B,CAAC;IAC1C,MAAM,GAAG,UAA8B,CAAC;IACxC,MAAM,QAAQ,UAAmC,CAAC;IAClD,MAAM,IAAI,UAA+B,CAAC;CAClD;AAED,qBACa,OACX,YAAW,gBAAgB,EAAE,mBAAmB,EAAE,sBAAsB;IAE/C,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAC9C,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IACrC,eAAe,EAAE,eAAe,CAAC;IACrC,WAAW,EAAE,WAAW,CAAC;IAE9C,mBAAmB,CAAC,WAAW,EAAE,kBAAkB;IAOnD,aAAa,CAAC,IAAI,EAAE,YAAY;IAkLhC,gBAAgB,CAAC,QAAQ,EAAE,eAAe;CAknB3C"}
|
|
@@ -19,7 +19,10 @@ function _applyDecoratedDescriptor(target, property, decorators, descriptor, con
|
|
|
19
19
|
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
20
20
|
import { LibroJupyterView, LibroService, NotebookCommands } from '@difizen/libro-jupyter';
|
|
21
21
|
import { TerminalCommands, TerminalManager } from '@difizen/libro-terminal';
|
|
22
|
+
import { KeybindingContribution } from '@difizen/mana-app';
|
|
23
|
+
import { Saveable } from '@difizen/mana-app';
|
|
22
24
|
import { CommandContribution, CommandRegistry, inject, MAIN_MENU_BAR, MenuContribution, singleton, ViewManager } from '@difizen/mana-app';
|
|
25
|
+
import { LibroLabLayoutSlots } from "../layout/index.js";
|
|
23
26
|
import { LayoutService } from "../layout/layout-service.js";
|
|
24
27
|
import { LabCommands } from "./lab-command.js";
|
|
25
28
|
export var LabMenus;
|
|
@@ -32,7 +35,7 @@ export var LabMenus;
|
|
|
32
35
|
var HELP = _LabMenus.HELP = [].concat(_toConsumableArray(MAIN_MENU_BAR), ['6_help']);
|
|
33
36
|
})(LabMenus || (LabMenus = {}));
|
|
34
37
|
export var LabMenu = (_dec = singleton({
|
|
35
|
-
contrib: [MenuContribution, CommandContribution]
|
|
38
|
+
contrib: [MenuContribution, CommandContribution, KeybindingContribution]
|
|
36
39
|
}), _dec2 = inject(CommandRegistry), _dec3 = inject(LibroService), _dec4 = inject(LayoutService), _dec5 = inject(TerminalManager), _dec6 = inject(ViewManager), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
37
40
|
function LabMenu() {
|
|
38
41
|
_classCallCheck(this, LabMenu);
|
|
@@ -43,6 +46,14 @@ export var LabMenu = (_dec = singleton({
|
|
|
43
46
|
_initializerDefineProperty(this, "viewManager", _descriptor5, this);
|
|
44
47
|
}
|
|
45
48
|
_createClass(LabMenu, [{
|
|
49
|
+
key: "registerKeybindings",
|
|
50
|
+
value: function registerKeybindings(keybindings) {
|
|
51
|
+
keybindings.registerKeybinding({
|
|
52
|
+
command: LabCommands.Save.id,
|
|
53
|
+
keybinding: LabCommands.Save.keybind
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
46
57
|
key: "registerMenus",
|
|
47
58
|
value: function registerMenus(menu) {
|
|
48
59
|
menu.registerSubmenu(LabMenus.FILE, {
|
|
@@ -274,12 +285,19 @@ export var LabMenu = (_dec = singleton({
|
|
|
274
285
|
return execute;
|
|
275
286
|
}()
|
|
276
287
|
});
|
|
277
|
-
commands.registerCommand(LabCommands.Save
|
|
288
|
+
commands.registerCommand(LabCommands.Save);
|
|
289
|
+
commands.registerHandler(LabCommands.Save.id, {
|
|
278
290
|
execute: function () {
|
|
279
291
|
var _execute2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
292
|
+
var contentActive;
|
|
280
293
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
281
294
|
while (1) switch (_context2.prev = _context2.next) {
|
|
282
295
|
case 0:
|
|
296
|
+
contentActive = _this.layoutService.getActiveView(LibroLabLayoutSlots.content);
|
|
297
|
+
if (contentActive && Saveable.is(contentActive)) {
|
|
298
|
+
contentActive.save();
|
|
299
|
+
}
|
|
300
|
+
case 2:
|
|
283
301
|
case "end":
|
|
284
302
|
return _context2.stop();
|
|
285
303
|
}
|
|
@@ -289,7 +307,18 @@ export var LabMenu = (_dec = singleton({
|
|
|
289
307
|
return _execute2.apply(this, arguments);
|
|
290
308
|
}
|
|
291
309
|
return execute;
|
|
292
|
-
}()
|
|
310
|
+
}(),
|
|
311
|
+
isEnabled: function isEnabled() {
|
|
312
|
+
var _contentActive$contai;
|
|
313
|
+
var contentActive = _this.layoutService.getActiveView(LibroLabLayoutSlots.content);
|
|
314
|
+
if (contentActive && (_contentActive$contai = contentActive.container) !== null && _contentActive$contai !== void 0 && _contentActive$contai.current) {
|
|
315
|
+
var contentHost = contentActive.container.current;
|
|
316
|
+
if (contentHost.contains(document.activeElement)) {
|
|
317
|
+
return true;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
293
322
|
});
|
|
294
323
|
commands.registerCommandWithContext(LabCommands.UndoCellAction, this, {
|
|
295
324
|
execute: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panel-command.d.ts","sourceRoot":"","sources":["../../src/kernel-and-terminal-panel/panel-command.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,mBAAmB,
|
|
1
|
+
{"version":3,"file":"panel-command.d.ts","sourceRoot":"","sources":["../../src/kernel-and-terminal-panel/panel-command.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,mBAAmB,EAGnB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,eAAO,MAAM,YAAY;;;;;CAKxB,CAAC;AAEF,qBAGa,wBACX,YAAW,mBAAmB,EAAE,mBAAmB;IAEnD,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IAGnC,0BAA0B,EAAE,0BAA0B,CAAC;gBAEtB,WAAW,EAAE,WAAW;IAIzD,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAahD,oBAAoB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;CAQ7D"}
|
|
@@ -13,7 +13,7 @@ function _applyDecoratedDescriptor(target, property, decorators, descriptor, con
|
|
|
13
13
|
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
14
14
|
import { ReloadOutlined } from '@ant-design/icons';
|
|
15
15
|
import { ViewManager } from '@difizen/mana-app';
|
|
16
|
-
import { CommandContribution, inject,
|
|
16
|
+
import { CommandContribution, inject, singleton, ToolbarContribution } from '@difizen/mana-app';
|
|
17
17
|
import { KernelAndTerminalPanelView } from "./kernel-and-terminal-panel-view.js";
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
export var PanelCommand = {
|
|
@@ -23,7 +23,7 @@ export var PanelCommand = {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
export var PanelCommandContribution = (_dec = singleton({
|
|
26
|
-
contrib: [CommandContribution,
|
|
26
|
+
contrib: [CommandContribution, ToolbarContribution]
|
|
27
27
|
}), _dec2 = inject(KernelAndTerminalPanelView), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
28
28
|
function PanelCommandContribution(viewManager) {
|
|
29
29
|
_classCallCheck(this, PanelCommandContribution);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-lab",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@ant-design/icons": "^5.1.0",
|
|
37
|
-
"@difizen/libro-core": "^0.1.
|
|
38
|
-
"@difizen/libro-jupyter": "^0.1.
|
|
39
|
-
"@difizen/libro-kernel": "^0.1.
|
|
40
|
-
"@difizen/libro-prompt-cell": "^0.1.
|
|
41
|
-
"@difizen/libro-terminal": "^0.1.
|
|
42
|
-
"@difizen/libro-lsp": "^0.1.
|
|
43
|
-
"@difizen/libro-toc": "^0.1.
|
|
44
|
-
"@difizen/libro-cofine-editor-core": "^0.1.
|
|
37
|
+
"@difizen/libro-core": "^0.1.18",
|
|
38
|
+
"@difizen/libro-jupyter": "^0.1.18",
|
|
39
|
+
"@difizen/libro-kernel": "^0.1.18",
|
|
40
|
+
"@difizen/libro-prompt-cell": "^0.1.18",
|
|
41
|
+
"@difizen/libro-terminal": "^0.1.18",
|
|
42
|
+
"@difizen/libro-lsp": "^0.1.18",
|
|
43
|
+
"@difizen/libro-toc": "^0.1.18",
|
|
44
|
+
"@difizen/libro-cofine-editor-core": "^0.1.18",
|
|
45
45
|
"@difizen/mana-app": "latest",
|
|
46
46
|
"@difizen/mana-react": "latest",
|
|
47
47
|
"classnames": "^2.3.2",
|
|
@@ -6,6 +6,9 @@ import {
|
|
|
6
6
|
} from '@difizen/libro-jupyter';
|
|
7
7
|
import { TerminalCommands, TerminalManager } from '@difizen/libro-terminal';
|
|
8
8
|
import type { MenuRegistry } from '@difizen/mana-app';
|
|
9
|
+
import type { KeybindingRegistry } from '@difizen/mana-app';
|
|
10
|
+
import { KeybindingContribution } from '@difizen/mana-app';
|
|
11
|
+
import { Saveable } from '@difizen/mana-app';
|
|
9
12
|
import {
|
|
10
13
|
CommandContribution,
|
|
11
14
|
CommandRegistry,
|
|
@@ -16,6 +19,7 @@ import {
|
|
|
16
19
|
ViewManager,
|
|
17
20
|
} from '@difizen/mana-app';
|
|
18
21
|
|
|
22
|
+
import { LibroLabLayoutSlots } from '../layout/index.js';
|
|
19
23
|
import { LayoutService } from '../layout/layout-service.js';
|
|
20
24
|
|
|
21
25
|
import { LabCommands } from './lab-command.js';
|
|
@@ -29,14 +33,23 @@ export namespace LabMenus {
|
|
|
29
33
|
export const HELP = [...MAIN_MENU_BAR, '6_help'];
|
|
30
34
|
}
|
|
31
35
|
|
|
32
|
-
@singleton({ contrib: [MenuContribution, CommandContribution] })
|
|
33
|
-
export class LabMenu
|
|
36
|
+
@singleton({ contrib: [MenuContribution, CommandContribution, KeybindingContribution] })
|
|
37
|
+
export class LabMenu
|
|
38
|
+
implements MenuContribution, CommandContribution, KeybindingContribution
|
|
39
|
+
{
|
|
34
40
|
@inject(CommandRegistry) protected commandRegistry: CommandRegistry;
|
|
35
41
|
@inject(LibroService) protected libroService: LibroService;
|
|
36
42
|
@inject(LayoutService) protected layoutService: LayoutService;
|
|
37
43
|
@inject(TerminalManager) terminalManager: TerminalManager;
|
|
38
44
|
@inject(ViewManager) viewManager: ViewManager;
|
|
39
45
|
|
|
46
|
+
registerKeybindings(keybindings: KeybindingRegistry) {
|
|
47
|
+
keybindings.registerKeybinding({
|
|
48
|
+
command: LabCommands.Save.id,
|
|
49
|
+
keybinding: LabCommands.Save.keybind,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
40
53
|
registerMenus(menu: MenuRegistry) {
|
|
41
54
|
menu.registerSubmenu(LabMenus.FILE, { label: '文件' });
|
|
42
55
|
menu.registerSubmenu(LabMenus.EDIT, { label: '编辑' });
|
|
@@ -240,9 +253,27 @@ export class LabMenu implements MenuContribution, CommandContribution {
|
|
|
240
253
|
//TODO: 关于
|
|
241
254
|
},
|
|
242
255
|
});
|
|
243
|
-
commands.registerCommand(LabCommands.Save
|
|
256
|
+
commands.registerCommand(LabCommands.Save);
|
|
257
|
+
commands.registerHandler(LabCommands.Save.id, {
|
|
244
258
|
execute: async () => {
|
|
245
|
-
|
|
259
|
+
const contentActive = this.layoutService.getActiveView(
|
|
260
|
+
LibroLabLayoutSlots.content,
|
|
261
|
+
);
|
|
262
|
+
if (contentActive && Saveable.is(contentActive)) {
|
|
263
|
+
contentActive.save();
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
isEnabled: () => {
|
|
267
|
+
const contentActive = this.layoutService.getActiveView(
|
|
268
|
+
LibroLabLayoutSlots.content,
|
|
269
|
+
);
|
|
270
|
+
if (contentActive && contentActive.container?.current) {
|
|
271
|
+
const contentHost = contentActive.container.current;
|
|
272
|
+
if (contentHost.contains(document.activeElement)) {
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return false;
|
|
246
277
|
},
|
|
247
278
|
});
|
|
248
279
|
commands.registerCommandWithContext(LabCommands.UndoCellAction, this, {
|
|
@@ -137,8 +137,8 @@ export class CodeEditorViewer extends BaseView implements NavigatableView, Savea
|
|
|
137
137
|
uri,
|
|
138
138
|
value: content,
|
|
139
139
|
};
|
|
140
|
-
|
|
141
140
|
this.e2Editor = editorPorvider.create(this.codeRef.current, options);
|
|
141
|
+
|
|
142
142
|
this.toDispose.push(
|
|
143
143
|
getOrigin(this.e2Editor.codeEditor).onDidChangeModelContent(() => {
|
|
144
144
|
this.dirty = true;
|
|
@@ -4,7 +4,6 @@ import { ViewManager } from '@difizen/mana-app';
|
|
|
4
4
|
import {
|
|
5
5
|
CommandContribution,
|
|
6
6
|
inject,
|
|
7
|
-
MenuContribution,
|
|
8
7
|
singleton,
|
|
9
8
|
ToolbarContribution,
|
|
10
9
|
} from '@difizen/mana-app';
|
|
@@ -19,7 +18,7 @@ export const PanelCommand = {
|
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
@singleton({
|
|
22
|
-
contrib: [CommandContribution,
|
|
21
|
+
contrib: [CommandContribution, ToolbarContribution],
|
|
23
22
|
})
|
|
24
23
|
export class PanelCommandContribution
|
|
25
24
|
implements CommandContribution, ToolbarContribution
|