@difizen/libro-lab 0.1.7 → 0.1.8
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/editor-viewer/code-editor-viewer.js +1 -1
- package/es/layout/footer/index.less +5 -0
- package/es/layout/layout-service.d.ts +4 -0
- package/es/layout/layout-service.d.ts.map +1 -1
- package/es/layout/layout-service.js +55 -13
- package/es/layout/layout.d.ts.map +1 -1
- package/es/layout/layout.js +1 -1
- package/es/menu/menu-contribution.d.ts.map +1 -1
- package/es/menu/menu-contribution.js +192 -45
- package/es/welcome/entry-point-view.js +1 -32
- package/package.json +8 -8
- package/src/editor-viewer/code-editor-viewer.tsx +1 -1
- package/src/layout/footer/index.less +5 -0
- package/src/layout/layout-service.ts +33 -1
- package/src/layout/layout.tsx +29 -31
- package/src/menu/menu-contribution.ts +171 -24
- package/src/welcome/entry-point-view.tsx +3 -3
|
@@ -178,7 +178,7 @@ export var CodeEditorViewer = (_dec = transient(), _dec2 = view(CodeEditorViewer
|
|
|
178
178
|
* language ia an uri:
|
|
179
179
|
*/
|
|
180
180
|
theme: 'libro-light',
|
|
181
|
-
language: this.languageSpec.language,
|
|
181
|
+
language: this.languageSpec.language || 'markdown',
|
|
182
182
|
uri: uri,
|
|
183
183
|
value: content
|
|
184
184
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { LibroService } from '@difizen/libro-jupyter';
|
|
1
2
|
import type { View, ViewOpenHandlerOptions } from '@difizen/mana-app';
|
|
2
3
|
import { SlotViewManager } from '@difizen/mana-app';
|
|
3
4
|
import type { LibroLabLayoutSlotsType, StatusType } from './protocol.js';
|
|
4
5
|
export type VisibilityMap = Record<LibroLabLayoutSlotsType, boolean>;
|
|
5
6
|
export declare class LayoutService {
|
|
6
7
|
protected readonly slotViewManager: SlotViewManager;
|
|
8
|
+
protected readonly libroService: LibroService;
|
|
9
|
+
constructor(slotViewManager: SlotViewManager, libroService: LibroService);
|
|
7
10
|
serverSatus: StatusType;
|
|
8
11
|
visibilityMap: VisibilityMap;
|
|
9
12
|
isAreaVisible(slot: LibroLabLayoutSlotsType): boolean;
|
|
@@ -11,5 +14,6 @@ export declare class LayoutService {
|
|
|
11
14
|
addView(view: View, option?: ViewOpenHandlerOptions): Promise<void>;
|
|
12
15
|
getActiveView(slot: LibroLabLayoutSlotsType): View | undefined;
|
|
13
16
|
onSlotActiveChange(slot: LibroLabLayoutSlotsType, handler: () => void): import("@difizen/mana-app").Disposable | undefined;
|
|
17
|
+
onOpenSlotActiveChange(): Promise<void>;
|
|
14
18
|
}
|
|
15
19
|
//# sourceMappingURL=layout-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-service.d.ts","sourceRoot":"","sources":["../../src/layout/layout-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"layout-service.d.ts","sourceRoot":"","sources":["../../src/layout/layout-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,KAAK,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,EAKL,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGzE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;AAErE,qBACa,aAAa;IACxB,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IACpD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;gBAGnB,eAAe,EAAE,eAAe,EACnC,YAAY,EAAE,YAAY;IAQlD,WAAW,EAAE,UAAU,CAAa;IAEpC,aAAa,EAAE,aAAa,CAS1B;IAEF,aAAa,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO;IAIrD,cAAc,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,OAAO;IAIxD,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzE,aAAa,CAAC,IAAI,EAAE,uBAAuB;IAU3C,kBAAkB,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,IAAI;IAU/D,sBAAsB;CAmB7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["slot"];
|
|
3
|
-
var _dec, _dec2, _dec3,
|
|
3
|
+
var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
6
6
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
@@ -15,15 +15,21 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
15
15
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
16
|
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
17
17
|
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.'); }
|
|
18
|
+
import { LibroNavigatableView, LibroService } from '@difizen/libro-jupyter';
|
|
19
|
+
import { observable } from '@difizen/mana-app';
|
|
18
20
|
import { DefaultSlotView, inject, prop, singleton, SlotViewManager } from '@difizen/mana-app';
|
|
19
21
|
import { LibroLabLayoutSlots } from "./protocol.js";
|
|
20
|
-
export var LayoutService = (_dec = singleton(), _dec2 =
|
|
21
|
-
function LayoutService() {
|
|
22
|
+
export var LayoutService = (_dec = singleton(), _dec2 = prop(), _dec3 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
23
|
+
function LayoutService(slotViewManager, libroService) {
|
|
22
24
|
_classCallCheck(this, LayoutService);
|
|
23
|
-
_initializerDefineProperty(this, "
|
|
24
|
-
_initializerDefineProperty(this, "
|
|
25
|
-
|
|
25
|
+
_initializerDefineProperty(this, "serverSatus", _descriptor, this);
|
|
26
|
+
_initializerDefineProperty(this, "visibilityMap", _descriptor2, this);
|
|
27
|
+
this.slotViewManager = slotViewManager;
|
|
28
|
+
this.libroService = libroService;
|
|
29
|
+
this.onOpenSlotActiveChange();
|
|
26
30
|
}
|
|
31
|
+
LayoutService = inject(LibroService)(LayoutService, undefined, 1) || LayoutService;
|
|
32
|
+
LayoutService = inject(SlotViewManager)(LayoutService, undefined, 0) || LayoutService;
|
|
27
33
|
_createClass(LayoutService, [{
|
|
28
34
|
key: "isAreaVisible",
|
|
29
35
|
value: function isAreaVisible(slot) {
|
|
@@ -78,21 +84,57 @@ export var LayoutService = (_dec = singleton(), _dec2 = inject(SlotViewManager),
|
|
|
78
84
|
}
|
|
79
85
|
return undefined;
|
|
80
86
|
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "onOpenSlotActiveChange",
|
|
89
|
+
value: function () {
|
|
90
|
+
var _onOpenSlotActiveChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
91
|
+
var _this = this;
|
|
92
|
+
var slotView;
|
|
93
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
94
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
95
|
+
case 0:
|
|
96
|
+
if (!this.isAreaVisible(LibroLabLayoutSlots.content)) {
|
|
97
|
+
_context2.next = 6;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
_context2.next = 3;
|
|
101
|
+
return this.slotViewManager.getOrCreateSlotView(LibroLabLayoutSlots.content);
|
|
102
|
+
case 3:
|
|
103
|
+
slotView = _context2.sent;
|
|
104
|
+
observable(slotView);
|
|
105
|
+
if (slotView instanceof DefaultSlotView) {
|
|
106
|
+
slotView.onActiveChange(function () {
|
|
107
|
+
var active = slotView.active;
|
|
108
|
+
if (active instanceof LibroNavigatableView) {
|
|
109
|
+
var _active$libroView;
|
|
110
|
+
(_active$libroView = active.libroView) === null || _active$libroView === void 0 || _active$libroView.focus();
|
|
111
|
+
_this.libroService.active = active.libroView;
|
|
112
|
+
} else {
|
|
113
|
+
_this.libroService.active = undefined;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
case 6:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context2.stop();
|
|
120
|
+
}
|
|
121
|
+
}, _callee2, this);
|
|
122
|
+
}));
|
|
123
|
+
function onOpenSlotActiveChange() {
|
|
124
|
+
return _onOpenSlotActiveChange.apply(this, arguments);
|
|
125
|
+
}
|
|
126
|
+
return onOpenSlotActiveChange;
|
|
127
|
+
}()
|
|
81
128
|
}]);
|
|
82
129
|
return LayoutService;
|
|
83
|
-
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "
|
|
84
|
-
configurable: true,
|
|
85
|
-
enumerable: true,
|
|
86
|
-
writable: true,
|
|
87
|
-
initializer: null
|
|
88
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "serverSatus", [_dec3], {
|
|
130
|
+
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "serverSatus", [_dec2], {
|
|
89
131
|
configurable: true,
|
|
90
132
|
enumerable: true,
|
|
91
133
|
writable: true,
|
|
92
134
|
initializer: function initializer() {
|
|
93
135
|
return 'loading';
|
|
94
136
|
}
|
|
95
|
-
}),
|
|
137
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "visibilityMap", [_dec3], {
|
|
96
138
|
configurable: true,
|
|
97
139
|
enumerable: true,
|
|
98
140
|
writable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/layout/layout.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAO7C,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/layout/layout.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAO7C,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,eAAO,MAAM,uBAAuB,mFA4BlC,CAAC;AAEH,qBAEa,kBAAmB,SAAQ,QAAQ;IACrC,IAAI,oFAA2B;IAEjB,aAAa,EAAE,aAAa,CAAC;IAEpD,UAAU,IAAI,MAAM;IAIpB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAQrC"}
|
package/es/layout/layout.js
CHANGED
|
@@ -41,7 +41,7 @@ export var LibroLabLayoutComponent = /*#__PURE__*/forwardRef(function LibroLabLa
|
|
|
41
41
|
name: LibroLabLayoutSlots.header
|
|
42
42
|
})
|
|
43
43
|
}), layoutService.isAreaVisible(LibroLabLayoutSlots.alert) && /*#__PURE__*/_jsx(Alert, {
|
|
44
|
-
message: "\u670D\u52A1\u542F\u52A8\u4E2D\uFF0C\u8BF7\u7A0D\u540E\uFF0C\u5F85\
|
|
44
|
+
message: "\u670D\u52A1\u542F\u52A8\u4E2D\uFF0C\u8BF7\u7A0D\u540E\uFF0C\u5F85\u670D\u52A1\u542F\u52A8\u5B8C\u6210\u540E\u5373\u53EF\u7F16\u8F91\u6587\u4EF6\u3002",
|
|
45
45
|
type: "info",
|
|
46
46
|
banner: true,
|
|
47
47
|
closable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-contribution.d.ts","sourceRoot":"","sources":["../../src/menu/menu-contribution.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,YAAY,EAEb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAqB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,eAAe,EAGf,gBAAgB,EAEhB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,yBAAiB,WAAW,CAAC;IACpB,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,UAAW,YAAW,gBAAgB,EAAE,mBAAmB;IAC7C,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,aAAa,CAAC,IAAI,EAAE,YAAY;IAkLhC,gBAAgB,CAAC,QAAQ,EAAE,eAAe;
|
|
1
|
+
{"version":3,"file":"menu-contribution.d.ts","sourceRoot":"","sources":["../../src/menu/menu-contribution.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,YAAY,EAEb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAqB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,eAAe,EAGf,gBAAgB,EAEhB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,yBAAiB,WAAW,CAAC;IACpB,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,UAAW,YAAW,gBAAgB,EAAE,mBAAmB;IAC7C,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,aAAa,CAAC,IAAI,EAAE,YAAY;IAkLhC,gBAAgB,CAAC,QAAQ,EAAE,eAAe;CAgmB3C"}
|
|
@@ -290,7 +290,7 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
290
290
|
return execute;
|
|
291
291
|
}()
|
|
292
292
|
});
|
|
293
|
-
commands.
|
|
293
|
+
commands.registerCommandWithContext(MenuCommands.UndoCellAction, this, {
|
|
294
294
|
execute: function () {
|
|
295
295
|
var _execute3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
296
296
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -309,9 +309,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
309
309
|
return _execute3.apply(this, arguments);
|
|
310
310
|
}
|
|
311
311
|
return execute;
|
|
312
|
-
}()
|
|
312
|
+
}(),
|
|
313
|
+
isEnabled: function isEnabled(ctx) {
|
|
314
|
+
var libro = ctx.libroService.active;
|
|
315
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
313
320
|
});
|
|
314
|
-
commands.
|
|
321
|
+
commands.registerCommandWithContext(MenuCommands.RedoCellAction, this, {
|
|
315
322
|
execute: function () {
|
|
316
323
|
var _execute4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
317
324
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
@@ -330,9 +337,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
330
337
|
return _execute4.apply(this, arguments);
|
|
331
338
|
}
|
|
332
339
|
return execute;
|
|
333
|
-
}()
|
|
340
|
+
}(),
|
|
341
|
+
isEnabled: function isEnabled(ctx) {
|
|
342
|
+
var libro = ctx.libroService.active;
|
|
343
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
334
348
|
});
|
|
335
|
-
commands.
|
|
349
|
+
commands.registerCommandWithContext(MenuCommands.CutCell, this, {
|
|
336
350
|
execute: function () {
|
|
337
351
|
var _execute5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
338
352
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
@@ -351,9 +365,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
351
365
|
return _execute5.apply(this, arguments);
|
|
352
366
|
}
|
|
353
367
|
return execute;
|
|
354
|
-
}()
|
|
368
|
+
}(),
|
|
369
|
+
isEnabled: function isEnabled(ctx) {
|
|
370
|
+
var libro = ctx.libroService.active;
|
|
371
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
372
|
+
return true;
|
|
373
|
+
}
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
355
376
|
});
|
|
356
|
-
commands.
|
|
377
|
+
commands.registerCommandWithContext(MenuCommands.CopyCell, this, {
|
|
357
378
|
execute: function () {
|
|
358
379
|
var _execute6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
359
380
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
@@ -372,9 +393,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
372
393
|
return _execute6.apply(this, arguments);
|
|
373
394
|
}
|
|
374
395
|
return execute;
|
|
375
|
-
}()
|
|
396
|
+
}(),
|
|
397
|
+
isEnabled: function isEnabled(ctx) {
|
|
398
|
+
var libro = ctx.libroService.active;
|
|
399
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
376
404
|
});
|
|
377
|
-
commands.
|
|
405
|
+
commands.registerCommandWithContext(MenuCommands.DeleteCell, this, {
|
|
378
406
|
execute: function () {
|
|
379
407
|
var _execute7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
380
408
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
@@ -393,9 +421,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
393
421
|
return _execute7.apply(this, arguments);
|
|
394
422
|
}
|
|
395
423
|
return execute;
|
|
396
|
-
}()
|
|
424
|
+
}(),
|
|
425
|
+
isEnabled: function isEnabled(ctx) {
|
|
426
|
+
var libro = ctx.libroService.active;
|
|
427
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
428
|
+
return true;
|
|
429
|
+
}
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
397
432
|
});
|
|
398
|
-
commands.
|
|
433
|
+
commands.registerCommandWithContext(MenuCommands.PasteCellBelow, this, {
|
|
399
434
|
execute: function () {
|
|
400
435
|
var _execute8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
401
436
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
@@ -414,9 +449,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
414
449
|
return _execute8.apply(this, arguments);
|
|
415
450
|
}
|
|
416
451
|
return execute;
|
|
417
|
-
}()
|
|
452
|
+
}(),
|
|
453
|
+
isEnabled: function isEnabled(ctx) {
|
|
454
|
+
var libro = ctx.libroService.active;
|
|
455
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
456
|
+
return true;
|
|
457
|
+
}
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
418
460
|
});
|
|
419
|
-
commands.
|
|
461
|
+
commands.registerCommandWithContext(MenuCommands.PasteCellAbove, this, {
|
|
420
462
|
execute: function () {
|
|
421
463
|
var _execute9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
422
464
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
@@ -435,9 +477,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
435
477
|
return _execute9.apply(this, arguments);
|
|
436
478
|
}
|
|
437
479
|
return execute;
|
|
438
|
-
}()
|
|
480
|
+
}(),
|
|
481
|
+
isEnabled: function isEnabled(ctx) {
|
|
482
|
+
var libro = ctx.libroService.active;
|
|
483
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
484
|
+
return true;
|
|
485
|
+
}
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
439
488
|
});
|
|
440
|
-
commands.
|
|
489
|
+
commands.registerCommandWithContext(MenuCommands.PasteAndReplaceCell, this, {
|
|
441
490
|
execute: function () {
|
|
442
491
|
var _execute10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
443
492
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
@@ -456,9 +505,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
456
505
|
return _execute10.apply(this, arguments);
|
|
457
506
|
}
|
|
458
507
|
return execute;
|
|
459
|
-
}()
|
|
508
|
+
}(),
|
|
509
|
+
isEnabled: function isEnabled(ctx) {
|
|
510
|
+
var libro = ctx.libroService.active;
|
|
511
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
return false;
|
|
515
|
+
}
|
|
460
516
|
});
|
|
461
|
-
commands.
|
|
517
|
+
commands.registerCommandWithContext(MenuCommands.SelectAll, this, {
|
|
462
518
|
execute: function () {
|
|
463
519
|
var _execute11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
464
520
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
@@ -477,19 +533,26 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
477
533
|
return _execute11.apply(this, arguments);
|
|
478
534
|
}
|
|
479
535
|
return execute;
|
|
480
|
-
}()
|
|
536
|
+
}(),
|
|
537
|
+
isEnabled: function isEnabled(ctx) {
|
|
538
|
+
var libro = ctx.libroService.active;
|
|
539
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
540
|
+
return true;
|
|
541
|
+
}
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
481
544
|
});
|
|
482
545
|
// commands.registerCommand(MenuCommands.DeselectAll, {
|
|
483
546
|
// execute: async () => {
|
|
484
|
-
// if (
|
|
547
|
+
// if (libro)
|
|
485
548
|
// this.commandRegistry.executeCommand(
|
|
486
549
|
// NotebookCommands.DeselectAll.id,
|
|
487
|
-
//
|
|
488
|
-
//
|
|
550
|
+
// libro.activeCell,
|
|
551
|
+
// libro,
|
|
489
552
|
// );
|
|
490
553
|
// },
|
|
491
554
|
// });
|
|
492
|
-
commands.
|
|
555
|
+
commands.registerCommandWithContext(MenuCommands.MoveCellUp, this, {
|
|
493
556
|
execute: function () {
|
|
494
557
|
var _execute12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
495
558
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
@@ -508,9 +571,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
508
571
|
return _execute12.apply(this, arguments);
|
|
509
572
|
}
|
|
510
573
|
return execute;
|
|
511
|
-
}()
|
|
574
|
+
}(),
|
|
575
|
+
isEnabled: function isEnabled(ctx) {
|
|
576
|
+
var libro = ctx.libroService.active;
|
|
577
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
578
|
+
return true;
|
|
579
|
+
}
|
|
580
|
+
return false;
|
|
581
|
+
}
|
|
512
582
|
});
|
|
513
|
-
commands.
|
|
583
|
+
commands.registerCommandWithContext(MenuCommands.MoveCellDown, this, {
|
|
514
584
|
execute: function () {
|
|
515
585
|
var _execute13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
516
586
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
@@ -529,9 +599,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
529
599
|
return _execute13.apply(this, arguments);
|
|
530
600
|
}
|
|
531
601
|
return execute;
|
|
532
|
-
}()
|
|
602
|
+
}(),
|
|
603
|
+
isEnabled: function isEnabled(ctx) {
|
|
604
|
+
var libro = ctx.libroService.active;
|
|
605
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
606
|
+
return true;
|
|
607
|
+
}
|
|
608
|
+
return false;
|
|
609
|
+
}
|
|
533
610
|
});
|
|
534
|
-
commands.
|
|
611
|
+
commands.registerCommandWithContext(MenuCommands.SplitCellAntCursor, this, {
|
|
535
612
|
execute: function () {
|
|
536
613
|
var _execute14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
537
614
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
@@ -550,9 +627,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
550
627
|
return _execute14.apply(this, arguments);
|
|
551
628
|
}
|
|
552
629
|
return execute;
|
|
553
|
-
}()
|
|
630
|
+
}(),
|
|
631
|
+
isEnabled: function isEnabled(ctx) {
|
|
632
|
+
var libro = ctx.libroService.active;
|
|
633
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
634
|
+
return true;
|
|
635
|
+
}
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
554
638
|
});
|
|
555
|
-
commands.
|
|
639
|
+
commands.registerCommandWithContext(MenuCommands.MergeCells, this, {
|
|
556
640
|
execute: function () {
|
|
557
641
|
var _execute15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
558
642
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
@@ -571,9 +655,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
571
655
|
return _execute15.apply(this, arguments);
|
|
572
656
|
}
|
|
573
657
|
return execute;
|
|
574
|
-
}()
|
|
658
|
+
}(),
|
|
659
|
+
isEnabled: function isEnabled(ctx) {
|
|
660
|
+
var libro = ctx.libroService.active;
|
|
661
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
662
|
+
return true;
|
|
663
|
+
}
|
|
664
|
+
return false;
|
|
665
|
+
}
|
|
575
666
|
});
|
|
576
|
-
commands.
|
|
667
|
+
commands.registerCommandWithContext(MenuCommands.MergeCellAbove, this, {
|
|
577
668
|
execute: function () {
|
|
578
669
|
var _execute16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
579
670
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
@@ -592,9 +683,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
592
683
|
return _execute16.apply(this, arguments);
|
|
593
684
|
}
|
|
594
685
|
return execute;
|
|
595
|
-
}()
|
|
686
|
+
}(),
|
|
687
|
+
isEnabled: function isEnabled(ctx) {
|
|
688
|
+
var libro = ctx.libroService.active;
|
|
689
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
690
|
+
return true;
|
|
691
|
+
}
|
|
692
|
+
return false;
|
|
693
|
+
}
|
|
596
694
|
});
|
|
597
|
-
commands.
|
|
695
|
+
commands.registerCommandWithContext(MenuCommands.MergeCellBelow, this, {
|
|
598
696
|
execute: function () {
|
|
599
697
|
var _execute17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
600
698
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
@@ -613,9 +711,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
613
711
|
return _execute17.apply(this, arguments);
|
|
614
712
|
}
|
|
615
713
|
return execute;
|
|
616
|
-
}()
|
|
714
|
+
}(),
|
|
715
|
+
isEnabled: function isEnabled(ctx) {
|
|
716
|
+
var libro = ctx.libroService.active;
|
|
717
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
718
|
+
return true;
|
|
719
|
+
}
|
|
720
|
+
return false;
|
|
721
|
+
}
|
|
617
722
|
});
|
|
618
|
-
commands.
|
|
723
|
+
commands.registerCommandWithContext(MenuCommands.ClearCellOutput, this, {
|
|
619
724
|
execute: function () {
|
|
620
725
|
var _execute18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
621
726
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
@@ -634,9 +739,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
634
739
|
return _execute18.apply(this, arguments);
|
|
635
740
|
}
|
|
636
741
|
return execute;
|
|
637
|
-
}()
|
|
742
|
+
}(),
|
|
743
|
+
isEnabled: function isEnabled(ctx) {
|
|
744
|
+
var libro = ctx.libroService.active;
|
|
745
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
746
|
+
return true;
|
|
747
|
+
}
|
|
748
|
+
return false;
|
|
749
|
+
}
|
|
638
750
|
});
|
|
639
|
-
commands.
|
|
751
|
+
commands.registerCommandWithContext(MenuCommands.ClearAllCellOutput, this, {
|
|
640
752
|
execute: function () {
|
|
641
753
|
var _execute19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
642
754
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
@@ -655,9 +767,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
655
767
|
return _execute19.apply(this, arguments);
|
|
656
768
|
}
|
|
657
769
|
return execute;
|
|
658
|
-
}()
|
|
770
|
+
}(),
|
|
771
|
+
isEnabled: function isEnabled(ctx) {
|
|
772
|
+
var libro = ctx.libroService.active;
|
|
773
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
774
|
+
return true;
|
|
775
|
+
}
|
|
776
|
+
return false;
|
|
777
|
+
}
|
|
659
778
|
});
|
|
660
|
-
commands.
|
|
779
|
+
commands.registerCommandWithContext(MenuCommands.HideOrShowCellCode, this, {
|
|
661
780
|
execute: function () {
|
|
662
781
|
var _execute20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
663
782
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
@@ -676,9 +795,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
676
795
|
return _execute20.apply(this, arguments);
|
|
677
796
|
}
|
|
678
797
|
return execute;
|
|
679
|
-
}()
|
|
798
|
+
}(),
|
|
799
|
+
isEnabled: function isEnabled(ctx) {
|
|
800
|
+
var libro = ctx.libroService.active;
|
|
801
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
802
|
+
return true;
|
|
803
|
+
}
|
|
804
|
+
return false;
|
|
805
|
+
}
|
|
680
806
|
});
|
|
681
|
-
commands.
|
|
807
|
+
commands.registerCommandWithContext(MenuCommands.HideOrShowOutputs, this, {
|
|
682
808
|
execute: function () {
|
|
683
809
|
var _execute21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
684
810
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
@@ -697,9 +823,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
697
823
|
return _execute21.apply(this, arguments);
|
|
698
824
|
}
|
|
699
825
|
return execute;
|
|
700
|
-
}()
|
|
826
|
+
}(),
|
|
827
|
+
isEnabled: function isEnabled(ctx) {
|
|
828
|
+
var libro = ctx.libroService.active;
|
|
829
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
830
|
+
return true;
|
|
831
|
+
}
|
|
832
|
+
return false;
|
|
833
|
+
}
|
|
701
834
|
});
|
|
702
|
-
commands.
|
|
835
|
+
commands.registerCommandWithContext(MenuCommands.EnableOutputScrolling, this, {
|
|
703
836
|
execute: function () {
|
|
704
837
|
var _execute22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
705
838
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
@@ -718,9 +851,16 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
718
851
|
return _execute22.apply(this, arguments);
|
|
719
852
|
}
|
|
720
853
|
return execute;
|
|
721
|
-
}()
|
|
854
|
+
}(),
|
|
855
|
+
isEnabled: function isEnabled(ctx) {
|
|
856
|
+
var libro = ctx.libroService.active;
|
|
857
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
858
|
+
return true;
|
|
859
|
+
}
|
|
860
|
+
return false;
|
|
861
|
+
}
|
|
722
862
|
});
|
|
723
|
-
commands.
|
|
863
|
+
commands.registerCommandWithContext(MenuCommands.DisableOutputScrolling, this, {
|
|
724
864
|
execute: function () {
|
|
725
865
|
var _execute23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
726
866
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
@@ -739,7 +879,14 @@ export var HeaderMenu = (_dec = singleton({
|
|
|
739
879
|
return _execute23.apply(this, arguments);
|
|
740
880
|
}
|
|
741
881
|
return execute;
|
|
742
|
-
}()
|
|
882
|
+
}(),
|
|
883
|
+
isEnabled: function isEnabled(ctx) {
|
|
884
|
+
var libro = ctx.libroService.active;
|
|
885
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
886
|
+
return true;
|
|
887
|
+
}
|
|
888
|
+
return false;
|
|
889
|
+
}
|
|
743
890
|
});
|
|
744
891
|
commands.registerCommandWithContext(MenuCommands.RunCell, this, {
|
|
745
892
|
execute: function () {
|
|
@@ -23,7 +23,7 @@ import { CommandRegistry, ModalService, singleton, useInject, view, ViewManager
|
|
|
23
23
|
import { BaseView } from '@difizen/mana-app';
|
|
24
24
|
import { Col, Row } from 'antd';
|
|
25
25
|
import { forwardRef, useEffect, useState } from 'react';
|
|
26
|
-
import {
|
|
26
|
+
import { TerminalIcon } from "../common/icon.js";
|
|
27
27
|
import { MenuCommands } from "../menu/index.js";
|
|
28
28
|
import "./index.less";
|
|
29
29
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -154,37 +154,6 @@ export var EntryPointComponent = /*#__PURE__*/forwardRef(function EntryPointComp
|
|
|
154
154
|
})]
|
|
155
155
|
})
|
|
156
156
|
})
|
|
157
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
158
|
-
className: "libro-lab-entry-point-item-title",
|
|
159
|
-
children: "\u7CFB\u7EDF\u8BBE\u7F6E"
|
|
160
|
-
}), /*#__PURE__*/_jsxs(Row, {
|
|
161
|
-
children: [/*#__PURE__*/_jsx(Col, {
|
|
162
|
-
className: "gutter-row",
|
|
163
|
-
style: {
|
|
164
|
-
paddingLeft: 'unset',
|
|
165
|
-
paddingRight: '24px'
|
|
166
|
-
},
|
|
167
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
168
|
-
className: "libro-lab-entry-point-item-config",
|
|
169
|
-
children: [/*#__PURE__*/_jsx(PreferenceIcon, {}), /*#__PURE__*/_jsx("span", {
|
|
170
|
-
className: "libro-lab-entry-point-item-config-text",
|
|
171
|
-
children: "\u504F\u597D\u8BBE\u7F6E"
|
|
172
|
-
})]
|
|
173
|
-
})
|
|
174
|
-
}), /*#__PURE__*/_jsx(Col, {
|
|
175
|
-
className: "gutter-row",
|
|
176
|
-
style: {
|
|
177
|
-
paddingLeft: 'unset',
|
|
178
|
-
paddingRight: '24px'
|
|
179
|
-
},
|
|
180
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
181
|
-
className: "libro-lab-entry-point-item-config",
|
|
182
|
-
children: [/*#__PURE__*/_jsx(KeybindIcon, {}), /*#__PURE__*/_jsx("span", {
|
|
183
|
-
className: "libro-lab-entry-point-item-config-text",
|
|
184
|
-
children: "\u5FEB\u6377\u952E\u8BBE\u7F6E"
|
|
185
|
-
})]
|
|
186
|
-
})
|
|
187
|
-
})]
|
|
188
157
|
})]
|
|
189
158
|
});
|
|
190
159
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-lab",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -34,13 +34,13 @@
|
|
|
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-toc": "^0.1.
|
|
43
|
-
"@difizen/libro-cofine-editor-core": "^0.1.
|
|
37
|
+
"@difizen/libro-core": "^0.1.8",
|
|
38
|
+
"@difizen/libro-jupyter": "^0.1.8",
|
|
39
|
+
"@difizen/libro-kernel": "^0.1.8",
|
|
40
|
+
"@difizen/libro-prompt-cell": "^0.1.8",
|
|
41
|
+
"@difizen/libro-terminal": "^0.1.8",
|
|
42
|
+
"@difizen/libro-toc": "^0.1.8",
|
|
43
|
+
"@difizen/libro-cofine-editor-core": "^0.1.8",
|
|
44
44
|
"@difizen/mana-app": "latest",
|
|
45
45
|
"@difizen/mana-react": "latest",
|
|
46
46
|
"classnames": "^2.3.2",
|
|
@@ -133,7 +133,7 @@ export class CodeEditorViewer extends BaseView implements NavigatableView, Savea
|
|
|
133
133
|
* language ia an uri:
|
|
134
134
|
*/
|
|
135
135
|
theme: 'libro-light',
|
|
136
|
-
language: this.languageSpec.language,
|
|
136
|
+
language: this.languageSpec.language || 'markdown',
|
|
137
137
|
uri,
|
|
138
138
|
value: content,
|
|
139
139
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { LibroNavigatableView, LibroService } from '@difizen/libro-jupyter';
|
|
1
2
|
import type { View, ViewOpenHandlerOptions } from '@difizen/mana-app';
|
|
3
|
+
import { observable } from '@difizen/mana-app';
|
|
2
4
|
import {
|
|
3
5
|
DefaultSlotView,
|
|
4
6
|
inject,
|
|
@@ -14,7 +16,17 @@ export type VisibilityMap = Record<LibroLabLayoutSlotsType, boolean>;
|
|
|
14
16
|
|
|
15
17
|
@singleton()
|
|
16
18
|
export class LayoutService {
|
|
17
|
-
|
|
19
|
+
protected readonly slotViewManager: SlotViewManager;
|
|
20
|
+
protected readonly libroService: LibroService;
|
|
21
|
+
|
|
22
|
+
constructor(
|
|
23
|
+
@inject(SlotViewManager) slotViewManager: SlotViewManager,
|
|
24
|
+
@inject(LibroService) libroService: LibroService,
|
|
25
|
+
) {
|
|
26
|
+
this.slotViewManager = slotViewManager;
|
|
27
|
+
this.libroService = libroService;
|
|
28
|
+
this.onOpenSlotActiveChange();
|
|
29
|
+
}
|
|
18
30
|
|
|
19
31
|
@prop()
|
|
20
32
|
serverSatus: StatusType = 'loading';
|
|
@@ -62,4 +74,24 @@ export class LayoutService {
|
|
|
62
74
|
}
|
|
63
75
|
return undefined;
|
|
64
76
|
}
|
|
77
|
+
|
|
78
|
+
async onOpenSlotActiveChange() {
|
|
79
|
+
if (this.isAreaVisible(LibroLabLayoutSlots.content)) {
|
|
80
|
+
const slotView = await this.slotViewManager.getOrCreateSlotView(
|
|
81
|
+
LibroLabLayoutSlots.content,
|
|
82
|
+
);
|
|
83
|
+
observable(slotView);
|
|
84
|
+
if (slotView instanceof DefaultSlotView) {
|
|
85
|
+
slotView.onActiveChange(() => {
|
|
86
|
+
const active = slotView.active;
|
|
87
|
+
if (active instanceof LibroNavigatableView) {
|
|
88
|
+
active.libroView?.focus();
|
|
89
|
+
this.libroService.active = active.libroView;
|
|
90
|
+
} else {
|
|
91
|
+
this.libroService.active = undefined;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
65
97
|
}
|
package/src/layout/layout.tsx
CHANGED
|
@@ -11,37 +11,35 @@ import type { VisibilityMap } from './layout-service.js';
|
|
|
11
11
|
import { LayoutService } from './layout-service.js';
|
|
12
12
|
import { LibroLabLayoutSlots } from './protocol.js';
|
|
13
13
|
|
|
14
|
-
export const LibroLabLayoutComponent = forwardRef(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
);
|
|
14
|
+
export const LibroLabLayoutComponent = forwardRef(function LibroLabLayoutComponent() {
|
|
15
|
+
const layoutService = useInject(LayoutService);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className="libro-lab-layout">
|
|
19
|
+
<BoxPanel direction="top-to-bottom">
|
|
20
|
+
{layoutService.isAreaVisible(LibroLabLayoutSlots.header) && (
|
|
21
|
+
<BoxPanel.Pane className="libro-lab-layout-header">
|
|
22
|
+
<Slot name={LibroLabLayoutSlots.header} />
|
|
23
|
+
</BoxPanel.Pane>
|
|
24
|
+
)}
|
|
25
|
+
{layoutService.isAreaVisible(LibroLabLayoutSlots.alert) && (
|
|
26
|
+
<Alert
|
|
27
|
+
message="服务启动中,请稍后,待服务启动完成后即可编辑文件。"
|
|
28
|
+
type="info"
|
|
29
|
+
banner
|
|
30
|
+
closable
|
|
31
|
+
icon={<Loadding className="libro-lab-loadding" />}
|
|
32
|
+
/>
|
|
33
|
+
)}
|
|
34
|
+
{layoutService.isAreaVisible(LibroLabLayoutSlots.container) && (
|
|
35
|
+
<BoxPanel.Pane className="libro-lab-layout-container" flex={1}>
|
|
36
|
+
<Slot name={LibroLabLayoutSlots.container} />
|
|
37
|
+
</BoxPanel.Pane>
|
|
38
|
+
)}
|
|
39
|
+
</BoxPanel>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
});
|
|
45
43
|
|
|
46
44
|
@singleton()
|
|
47
45
|
@view('libro-lab-layout')
|
|
@@ -247,7 +247,7 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
247
247
|
//TODO: 保存
|
|
248
248
|
},
|
|
249
249
|
});
|
|
250
|
-
commands.
|
|
250
|
+
commands.registerCommandWithContext(MenuCommands.UndoCellAction, this, {
|
|
251
251
|
execute: async () => {
|
|
252
252
|
if (this.libroService.active) {
|
|
253
253
|
this.commandRegistry.executeCommand(
|
|
@@ -257,8 +257,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
257
257
|
);
|
|
258
258
|
}
|
|
259
259
|
},
|
|
260
|
+
isEnabled: (ctx) => {
|
|
261
|
+
const libro = ctx.libroService.active;
|
|
262
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
return false;
|
|
266
|
+
},
|
|
260
267
|
});
|
|
261
|
-
commands.
|
|
268
|
+
commands.registerCommandWithContext(MenuCommands.RedoCellAction, this, {
|
|
262
269
|
execute: async () => {
|
|
263
270
|
if (this.libroService.active) {
|
|
264
271
|
this.commandRegistry.executeCommand(
|
|
@@ -268,8 +275,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
268
275
|
);
|
|
269
276
|
}
|
|
270
277
|
},
|
|
278
|
+
isEnabled: (ctx) => {
|
|
279
|
+
const libro = ctx.libroService.active;
|
|
280
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
return false;
|
|
284
|
+
},
|
|
271
285
|
});
|
|
272
|
-
commands.
|
|
286
|
+
commands.registerCommandWithContext(MenuCommands.CutCell, this, {
|
|
273
287
|
execute: async () => {
|
|
274
288
|
if (this.libroService.active) {
|
|
275
289
|
this.commandRegistry.executeCommand(
|
|
@@ -279,8 +293,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
279
293
|
);
|
|
280
294
|
}
|
|
281
295
|
},
|
|
296
|
+
isEnabled: (ctx) => {
|
|
297
|
+
const libro = ctx.libroService.active;
|
|
298
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
return false;
|
|
302
|
+
},
|
|
282
303
|
});
|
|
283
|
-
commands.
|
|
304
|
+
commands.registerCommandWithContext(MenuCommands.CopyCell, this, {
|
|
284
305
|
execute: async () => {
|
|
285
306
|
if (this.libroService.active) {
|
|
286
307
|
this.commandRegistry.executeCommand(
|
|
@@ -290,8 +311,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
290
311
|
);
|
|
291
312
|
}
|
|
292
313
|
},
|
|
314
|
+
isEnabled: (ctx) => {
|
|
315
|
+
const libro = ctx.libroService.active;
|
|
316
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
317
|
+
return true;
|
|
318
|
+
}
|
|
319
|
+
return false;
|
|
320
|
+
},
|
|
293
321
|
});
|
|
294
|
-
commands.
|
|
322
|
+
commands.registerCommandWithContext(MenuCommands.DeleteCell, this, {
|
|
295
323
|
execute: async () => {
|
|
296
324
|
if (this.libroService.active) {
|
|
297
325
|
this.commandRegistry.executeCommand(
|
|
@@ -301,8 +329,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
301
329
|
);
|
|
302
330
|
}
|
|
303
331
|
},
|
|
332
|
+
isEnabled: (ctx) => {
|
|
333
|
+
const libro = ctx.libroService.active;
|
|
334
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
return false;
|
|
338
|
+
},
|
|
304
339
|
});
|
|
305
|
-
commands.
|
|
340
|
+
commands.registerCommandWithContext(MenuCommands.PasteCellBelow, this, {
|
|
306
341
|
execute: async () => {
|
|
307
342
|
if (this.libroService.active) {
|
|
308
343
|
this.commandRegistry.executeCommand(
|
|
@@ -312,8 +347,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
312
347
|
);
|
|
313
348
|
}
|
|
314
349
|
},
|
|
350
|
+
isEnabled: (ctx) => {
|
|
351
|
+
const libro = ctx.libroService.active;
|
|
352
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
353
|
+
return true;
|
|
354
|
+
}
|
|
355
|
+
return false;
|
|
356
|
+
},
|
|
315
357
|
});
|
|
316
|
-
commands.
|
|
358
|
+
commands.registerCommandWithContext(MenuCommands.PasteCellAbove, this, {
|
|
317
359
|
execute: async () => {
|
|
318
360
|
if (this.libroService.active) {
|
|
319
361
|
this.commandRegistry.executeCommand(
|
|
@@ -323,8 +365,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
323
365
|
);
|
|
324
366
|
}
|
|
325
367
|
},
|
|
368
|
+
isEnabled: (ctx) => {
|
|
369
|
+
const libro = ctx.libroService.active;
|
|
370
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
373
|
+
return false;
|
|
374
|
+
},
|
|
326
375
|
});
|
|
327
|
-
commands.
|
|
376
|
+
commands.registerCommandWithContext(MenuCommands.PasteAndReplaceCell, this, {
|
|
328
377
|
execute: async () => {
|
|
329
378
|
if (this.libroService.active) {
|
|
330
379
|
this.commandRegistry.executeCommand(
|
|
@@ -334,8 +383,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
334
383
|
);
|
|
335
384
|
}
|
|
336
385
|
},
|
|
386
|
+
isEnabled: (ctx) => {
|
|
387
|
+
const libro = ctx.libroService.active;
|
|
388
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
return false;
|
|
392
|
+
},
|
|
337
393
|
});
|
|
338
|
-
commands.
|
|
394
|
+
commands.registerCommandWithContext(MenuCommands.SelectAll, this, {
|
|
339
395
|
execute: async () => {
|
|
340
396
|
if (this.libroService.active) {
|
|
341
397
|
this.commandRegistry.executeCommand(
|
|
@@ -345,18 +401,25 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
345
401
|
);
|
|
346
402
|
}
|
|
347
403
|
},
|
|
404
|
+
isEnabled: (ctx) => {
|
|
405
|
+
const libro = ctx.libroService.active;
|
|
406
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
407
|
+
return true;
|
|
408
|
+
}
|
|
409
|
+
return false;
|
|
410
|
+
},
|
|
348
411
|
});
|
|
349
412
|
// commands.registerCommand(MenuCommands.DeselectAll, {
|
|
350
413
|
// execute: async () => {
|
|
351
|
-
// if (
|
|
414
|
+
// if (libro)
|
|
352
415
|
// this.commandRegistry.executeCommand(
|
|
353
416
|
// NotebookCommands.DeselectAll.id,
|
|
354
|
-
//
|
|
355
|
-
//
|
|
417
|
+
// libro.activeCell,
|
|
418
|
+
// libro,
|
|
356
419
|
// );
|
|
357
420
|
// },
|
|
358
421
|
// });
|
|
359
|
-
commands.
|
|
422
|
+
commands.registerCommandWithContext(MenuCommands.MoveCellUp, this, {
|
|
360
423
|
execute: async () => {
|
|
361
424
|
if (this.libroService.active) {
|
|
362
425
|
this.commandRegistry.executeCommand(
|
|
@@ -366,8 +429,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
366
429
|
);
|
|
367
430
|
}
|
|
368
431
|
},
|
|
432
|
+
isEnabled: (ctx) => {
|
|
433
|
+
const libro = ctx.libroService.active;
|
|
434
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
437
|
+
return false;
|
|
438
|
+
},
|
|
369
439
|
});
|
|
370
|
-
commands.
|
|
440
|
+
commands.registerCommandWithContext(MenuCommands.MoveCellDown, this, {
|
|
371
441
|
execute: async () => {
|
|
372
442
|
if (this.libroService.active) {
|
|
373
443
|
this.commandRegistry.executeCommand(
|
|
@@ -377,8 +447,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
377
447
|
);
|
|
378
448
|
}
|
|
379
449
|
},
|
|
450
|
+
isEnabled: (ctx) => {
|
|
451
|
+
const libro = ctx.libroService.active;
|
|
452
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
453
|
+
return true;
|
|
454
|
+
}
|
|
455
|
+
return false;
|
|
456
|
+
},
|
|
380
457
|
});
|
|
381
|
-
commands.
|
|
458
|
+
commands.registerCommandWithContext(MenuCommands.SplitCellAntCursor, this, {
|
|
382
459
|
execute: async () => {
|
|
383
460
|
if (this.libroService.active) {
|
|
384
461
|
this.commandRegistry.executeCommand(
|
|
@@ -388,8 +465,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
388
465
|
);
|
|
389
466
|
}
|
|
390
467
|
},
|
|
468
|
+
isEnabled: (ctx) => {
|
|
469
|
+
const libro = ctx.libroService.active;
|
|
470
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
return false;
|
|
474
|
+
},
|
|
391
475
|
});
|
|
392
|
-
commands.
|
|
476
|
+
commands.registerCommandWithContext(MenuCommands.MergeCells, this, {
|
|
393
477
|
execute: async () => {
|
|
394
478
|
if (this.libroService.active) {
|
|
395
479
|
this.commandRegistry.executeCommand(
|
|
@@ -399,8 +483,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
399
483
|
);
|
|
400
484
|
}
|
|
401
485
|
},
|
|
486
|
+
isEnabled: (ctx) => {
|
|
487
|
+
const libro = ctx.libroService.active;
|
|
488
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
489
|
+
return true;
|
|
490
|
+
}
|
|
491
|
+
return false;
|
|
492
|
+
},
|
|
402
493
|
});
|
|
403
|
-
commands.
|
|
494
|
+
commands.registerCommandWithContext(MenuCommands.MergeCellAbove, this, {
|
|
404
495
|
execute: async () => {
|
|
405
496
|
if (this.libroService.active) {
|
|
406
497
|
this.commandRegistry.executeCommand(
|
|
@@ -410,8 +501,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
410
501
|
);
|
|
411
502
|
}
|
|
412
503
|
},
|
|
504
|
+
isEnabled: (ctx) => {
|
|
505
|
+
const libro = ctx.libroService.active;
|
|
506
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
507
|
+
return true;
|
|
508
|
+
}
|
|
509
|
+
return false;
|
|
510
|
+
},
|
|
413
511
|
});
|
|
414
|
-
commands.
|
|
512
|
+
commands.registerCommandWithContext(MenuCommands.MergeCellBelow, this, {
|
|
415
513
|
execute: async () => {
|
|
416
514
|
if (this.libroService.active) {
|
|
417
515
|
this.commandRegistry.executeCommand(
|
|
@@ -421,8 +519,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
421
519
|
);
|
|
422
520
|
}
|
|
423
521
|
},
|
|
522
|
+
isEnabled: (ctx) => {
|
|
523
|
+
const libro = ctx.libroService.active;
|
|
524
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
return false;
|
|
528
|
+
},
|
|
424
529
|
});
|
|
425
|
-
commands.
|
|
530
|
+
commands.registerCommandWithContext(MenuCommands.ClearCellOutput, this, {
|
|
426
531
|
execute: async () => {
|
|
427
532
|
if (this.libroService.active) {
|
|
428
533
|
this.commandRegistry.executeCommand(
|
|
@@ -432,8 +537,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
432
537
|
);
|
|
433
538
|
}
|
|
434
539
|
},
|
|
540
|
+
isEnabled: (ctx) => {
|
|
541
|
+
const libro = ctx.libroService.active;
|
|
542
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
543
|
+
return true;
|
|
544
|
+
}
|
|
545
|
+
return false;
|
|
546
|
+
},
|
|
435
547
|
});
|
|
436
|
-
commands.
|
|
548
|
+
commands.registerCommandWithContext(MenuCommands.ClearAllCellOutput, this, {
|
|
437
549
|
execute: async () => {
|
|
438
550
|
if (this.libroService.active) {
|
|
439
551
|
this.commandRegistry.executeCommand(
|
|
@@ -443,8 +555,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
443
555
|
);
|
|
444
556
|
}
|
|
445
557
|
},
|
|
558
|
+
isEnabled: (ctx) => {
|
|
559
|
+
const libro = ctx.libroService.active;
|
|
560
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
561
|
+
return true;
|
|
562
|
+
}
|
|
563
|
+
return false;
|
|
564
|
+
},
|
|
446
565
|
});
|
|
447
|
-
commands.
|
|
566
|
+
commands.registerCommandWithContext(MenuCommands.HideOrShowCellCode, this, {
|
|
448
567
|
execute: async () => {
|
|
449
568
|
if (this.libroService.active) {
|
|
450
569
|
this.commandRegistry.executeCommand(
|
|
@@ -454,8 +573,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
454
573
|
);
|
|
455
574
|
}
|
|
456
575
|
},
|
|
576
|
+
isEnabled: (ctx) => {
|
|
577
|
+
const libro = ctx.libroService.active;
|
|
578
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
579
|
+
return true;
|
|
580
|
+
}
|
|
581
|
+
return false;
|
|
582
|
+
},
|
|
457
583
|
});
|
|
458
|
-
commands.
|
|
584
|
+
commands.registerCommandWithContext(MenuCommands.HideOrShowOutputs, this, {
|
|
459
585
|
execute: async () => {
|
|
460
586
|
if (this.libroService.active) {
|
|
461
587
|
this.commandRegistry.executeCommand(
|
|
@@ -465,8 +591,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
465
591
|
);
|
|
466
592
|
}
|
|
467
593
|
},
|
|
594
|
+
isEnabled: (ctx) => {
|
|
595
|
+
const libro = ctx.libroService.active;
|
|
596
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
597
|
+
return true;
|
|
598
|
+
}
|
|
599
|
+
return false;
|
|
600
|
+
},
|
|
468
601
|
});
|
|
469
|
-
commands.
|
|
602
|
+
commands.registerCommandWithContext(MenuCommands.EnableOutputScrolling, this, {
|
|
470
603
|
execute: async () => {
|
|
471
604
|
if (this.libroService.active) {
|
|
472
605
|
this.commandRegistry.executeCommand(
|
|
@@ -476,8 +609,15 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
476
609
|
);
|
|
477
610
|
}
|
|
478
611
|
},
|
|
612
|
+
isEnabled: (ctx) => {
|
|
613
|
+
const libro = ctx.libroService.active;
|
|
614
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
615
|
+
return true;
|
|
616
|
+
}
|
|
617
|
+
return false;
|
|
618
|
+
},
|
|
479
619
|
});
|
|
480
|
-
commands.
|
|
620
|
+
commands.registerCommandWithContext(MenuCommands.DisableOutputScrolling, this, {
|
|
481
621
|
execute: async () => {
|
|
482
622
|
if (this.libroService.active) {
|
|
483
623
|
this.commandRegistry.executeCommand(
|
|
@@ -487,6 +627,13 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
|
|
|
487
627
|
);
|
|
488
628
|
}
|
|
489
629
|
},
|
|
630
|
+
isEnabled: (ctx) => {
|
|
631
|
+
const libro = ctx.libroService.active;
|
|
632
|
+
if (libro && libro instanceof LibroJupyterView) {
|
|
633
|
+
return true;
|
|
634
|
+
}
|
|
635
|
+
return false;
|
|
636
|
+
},
|
|
490
637
|
});
|
|
491
638
|
commands.registerCommandWithContext(MenuCommands.RunCell, this, {
|
|
492
639
|
execute: async (ctx) => {
|
|
@@ -18,7 +18,7 @@ import { BaseView } from '@difizen/mana-app';
|
|
|
18
18
|
import { Col, Row } from 'antd';
|
|
19
19
|
import { forwardRef, useEffect, useState } from 'react';
|
|
20
20
|
|
|
21
|
-
import {
|
|
21
|
+
import { TerminalIcon } from '../common/icon.js';
|
|
22
22
|
import { MenuCommands } from '../menu/index.js';
|
|
23
23
|
|
|
24
24
|
import './index.less';
|
|
@@ -145,7 +145,7 @@ export const EntryPointComponent = forwardRef(function EntryPointComponent() {
|
|
|
145
145
|
</div>
|
|
146
146
|
</Col>
|
|
147
147
|
</Row> */}
|
|
148
|
-
<div className="libro-lab-entry-point-item-title">系统设置</div>
|
|
148
|
+
{/* <div className="libro-lab-entry-point-item-title">系统设置</div>
|
|
149
149
|
<Row>
|
|
150
150
|
<Col
|
|
151
151
|
className="gutter-row"
|
|
@@ -165,7 +165,7 @@ export const EntryPointComponent = forwardRef(function EntryPointComponent() {
|
|
|
165
165
|
<span className="libro-lab-entry-point-item-config-text">快捷键设置</span>
|
|
166
166
|
</div>
|
|
167
167
|
</Col>
|
|
168
|
-
</Row>
|
|
168
|
+
</Row> */}
|
|
169
169
|
</div>
|
|
170
170
|
);
|
|
171
171
|
});
|