@difizen/libro-core 0.2.35 → 0.2.36
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/kernel-command.js +1 -1
- package/es/command/notebook-commands.js +3 -3
- package/es/components/dnd-cell-item-render.d.ts.map +1 -1
- package/es/components/dnd-cell-item-render.js +2 -1
- package/es/index.less +1 -1
- package/es/libro-model.js +1 -1
- package/es/libro-setting.js +2 -2
- package/es/settings/settings-modal.d.ts.map +1 -1
- package/es/settings/settings-modal.js +2 -1
- package/es/toolbar/libro-toolbar.js +132 -108
- package/es/toolbar/side-toolar-more-select.d.ts.map +1 -1
- package/es/toolbar/side-toolar-more-select.js +80 -80
- package/package.json +1 -1
- package/src/command/kernel-command.ts +1 -1
- package/src/command/notebook-commands.ts +3 -3
- package/src/components/dnd-cell-item-render.tsx +3 -2
- package/src/index.less +1 -1
- package/src/libro-model.ts +1 -1
- package/src/libro-setting.ts +2 -2
- package/src/settings/settings-modal.tsx +2 -1
- package/src/toolbar/libro-toolbar.tsx +12 -12
- package/src/toolbar/side-toolar-more-select.tsx +75 -76
|
@@ -335,16 +335,16 @@ export var NotebookCommands = {
|
|
|
335
335
|
},
|
|
336
336
|
RestartAndRunToSelected: {
|
|
337
337
|
id: 'notebook:restart-and-run-to-selected',
|
|
338
|
-
label: l10n.t('Restart and Run up to Selected Cell
|
|
338
|
+
label: l10n.t('Restart and Run up to Selected Cell')
|
|
339
339
|
},
|
|
340
340
|
RestartClearOutput: {
|
|
341
341
|
id: 'notebook:restart-clear-output',
|
|
342
|
-
label: l10n.t('Restart and Clear Outputs of All Cells
|
|
342
|
+
label: l10n.t('Restart and Clear Outputs of All Cells'),
|
|
343
343
|
icon: Reload
|
|
344
344
|
},
|
|
345
345
|
RestartRunAll: {
|
|
346
346
|
id: 'notebook:restart-run-all',
|
|
347
|
-
label: l10n.t('Restart and Run All Cells
|
|
347
|
+
label: l10n.t('Restart and Run All Cells')
|
|
348
348
|
},
|
|
349
349
|
RunAllAbove: {
|
|
350
350
|
id: 'notebook:run-all-above',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dnd-cell-item-render.d.ts","sourceRoot":"","sources":["../../src/components/dnd-cell-item-render.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dnd-cell-item-render.d.ts","sourceRoot":"","sources":["../../src/components/dnd-cell-item-render.tsx"],"names":[],"mappings":"AAeA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAUlF,OAAO,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAkBnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,8BAA8B,EAC/B,MAAM,oBAAoB,CAAC;AAuE5B,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CA4C1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,yBAIpC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,4BAIvC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,6BAIxC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,8BAIpC,CAAC;AAyJF,eAAO,MAAM,kBAAkB;UACvB,QAAQ;EA+Bd,CAAC;AAEH,eAAO,MAAM,oBAAoB,0CAgD/B,CAAC;AAyCH,eAAO,MAAM,iBAAiB,gHAA+B,CAAC"}
|
|
@@ -6,6 +6,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
8
8
|
import { useConfigurationValue, CommandRegistry, equals, ToolbarRender, useInject, useObserve, ViewInstance, ViewRender } from '@difizen/mana-app';
|
|
9
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
9
10
|
import { Tooltip } from 'antd';
|
|
10
11
|
import classnames from 'classnames';
|
|
11
12
|
import React, { forwardRef, memo, useLayoutEffect, useMemo, useRef } from 'react';
|
|
@@ -196,7 +197,7 @@ var CellOutput = /*#__PURE__*/forwardRef(function CellOutput(props, ref) {
|
|
|
196
197
|
}), outputScrollBtnVisiable && cell.outputArea.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
197
198
|
className: "libro-cell-output-scroll",
|
|
198
199
|
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
199
|
-
title: "".concat(cell.model.hasOutputsScrolled ? '取消固定 Output 高度' : '固定 Output 高度'),
|
|
200
|
+
title: "".concat(cell.model.hasOutputsScrolled ? l10n.t('取消固定 Output 高度') : l10n.t('固定 Output 高度')),
|
|
200
201
|
children: /*#__PURE__*/_jsx("div", {
|
|
201
202
|
className: "libro-cell-output-scroll-button ",
|
|
202
203
|
onClick: handleOutputScroll,
|
package/es/index.less
CHANGED
package/es/libro-model.js
CHANGED
|
@@ -212,7 +212,7 @@ export var LibroModel = (_dec = transient(), _dec2 = inject(NotebookOption), _de
|
|
|
212
212
|
getOrigin(_this.sharedModel).deleteCell(position);
|
|
213
213
|
getOrigin(_this.sharedModel).insertCells(position, cellData);
|
|
214
214
|
});
|
|
215
|
-
//切分
|
|
215
|
+
//切分 Cell操作结束后进入编辑态
|
|
216
216
|
_this.enterEditMode();
|
|
217
217
|
};
|
|
218
218
|
this.insertCellsView = function (cell, position) {
|
package/es/libro-setting.js
CHANGED
|
@@ -81,8 +81,8 @@ export var RightContentFixed = {
|
|
|
81
81
|
};
|
|
82
82
|
export var OutputScrollBtnVisiable = {
|
|
83
83
|
id: 'libro.cell.output.scroll.button.visiable',
|
|
84
|
-
description: l10n.t('
|
|
85
|
-
title: l10n.t('
|
|
84
|
+
description: l10n.t('Cell 输出区域高度固定按钮是否显示'),
|
|
85
|
+
title: l10n.t('Cell 输出区域高度固定按钮是否显示'),
|
|
86
86
|
type: 'checkbox',
|
|
87
87
|
defaultValue: true,
|
|
88
88
|
schema: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-modal.d.ts","sourceRoot":"","sources":["../../src/settings/settings-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"settings-modal.d.ts","sourceRoot":"","sources":["../../src/settings/settings-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AASnE,OAAO,uBAAuB,CAAC;AAE/B,wBAAgB,sBAAsB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,2CAkC9E;AAED,eAAO,MAAM,aAAa,EAAE,SAG3B,CAAC"}
|
|
@@ -6,6 +6,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { ConfigurationRegistry } from '@difizen/mana-app';
|
|
8
8
|
import { useInject, ViewManager, ViewRender } from '@difizen/mana-app';
|
|
9
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
9
10
|
import { Modal } from 'antd';
|
|
10
11
|
import { useEffect, useState } from 'react';
|
|
11
12
|
import { ConfigurationPanelView } from "./setting-editor/index.js";
|
|
@@ -33,7 +34,7 @@ export function SettingsModalComponent(_ref) {
|
|
|
33
34
|
});
|
|
34
35
|
}, [configRegistry, viewManager]);
|
|
35
36
|
return /*#__PURE__*/_jsx(Modal, {
|
|
36
|
-
title:
|
|
37
|
+
title: l10n.t('设置'),
|
|
37
38
|
open: visible,
|
|
38
39
|
onOk: function onOk() {
|
|
39
40
|
return close();
|
|
@@ -49,29 +49,33 @@ export var LibroToolbarContribution = (_dec = singleton({
|
|
|
49
49
|
id: DocumentCommands['Save'].id,
|
|
50
50
|
command: DocumentCommands['Save'].id,
|
|
51
51
|
icon: SaveIcon,
|
|
52
|
-
tooltip:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
tooltip: function tooltip() {
|
|
53
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
54
|
+
className: "libro-tooltip",
|
|
55
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
56
|
+
className: "libro-tooltip-text",
|
|
57
|
+
children: l10n.t('保存')
|
|
58
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
59
|
+
className: "libro-tooltip-keybind",
|
|
60
|
+
children: "".concat(isMacintosh ? 'Cmd' : 'Ctrl', " + S")
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
},
|
|
62
64
|
group: ['group1'],
|
|
63
65
|
order: '1'
|
|
64
66
|
});
|
|
65
67
|
registry.registerItem({
|
|
66
68
|
id: NotebookCommands['Interrupt'].id,
|
|
67
69
|
command: NotebookCommands['Interrupt'].id,
|
|
68
|
-
tooltip:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
tooltip: function tooltip() {
|
|
71
|
+
return /*#__PURE__*/_jsx("div", {
|
|
72
|
+
className: "libro-tooltip",
|
|
73
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
74
|
+
className: "libro-tooltip-text",
|
|
75
|
+
children: l10n.t('中断')
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
},
|
|
75
79
|
showLabelInline: true,
|
|
76
80
|
group: ['group2'],
|
|
77
81
|
order: 'b-all'
|
|
@@ -79,13 +83,15 @@ export var LibroToolbarContribution = (_dec = singleton({
|
|
|
79
83
|
registry.registerItem({
|
|
80
84
|
id: NotebookCommands['CloseAndShutdown'].id,
|
|
81
85
|
command: NotebookCommands['CloseAndShutdown'].id,
|
|
82
|
-
tooltip:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
tooltip: function tooltip() {
|
|
87
|
+
return /*#__PURE__*/_jsx("div", {
|
|
88
|
+
className: "libro-tooltip",
|
|
89
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
90
|
+
className: "libro-tooltip-text",
|
|
91
|
+
children: l10n.t('关闭内核')
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
},
|
|
89
95
|
showLabelInline: true,
|
|
90
96
|
group: ['group2'],
|
|
91
97
|
order: 'b-all'
|
|
@@ -93,13 +99,15 @@ export var LibroToolbarContribution = (_dec = singleton({
|
|
|
93
99
|
registry.registerItem({
|
|
94
100
|
id: NotebookCommands['RestartClearOutput'].id,
|
|
95
101
|
command: NotebookCommands['RestartClearOutput'].id,
|
|
96
|
-
tooltip:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
tooltip: function tooltip() {
|
|
103
|
+
return /*#__PURE__*/_jsx("div", {
|
|
104
|
+
className: "libro-tooltip",
|
|
105
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
106
|
+
className: "libro-tooltip-text",
|
|
107
|
+
children: l10n.t('重启并清空输出')
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
},
|
|
103
111
|
showLabelInline: true,
|
|
104
112
|
group: ['group2'],
|
|
105
113
|
order: 'c-all'
|
|
@@ -107,112 +115,126 @@ export var LibroToolbarContribution = (_dec = singleton({
|
|
|
107
115
|
registry.registerItem({
|
|
108
116
|
id: DocumentCommands['FormatCell'].id,
|
|
109
117
|
command: DocumentCommands['FormatCell'].id,
|
|
110
|
-
tooltip:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
tooltip: function tooltip() {
|
|
119
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
120
|
+
className: "libro-side-tooltip",
|
|
121
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
122
|
+
className: "libro-tooltip-text",
|
|
123
|
+
children: l10n.t('格式化代码')
|
|
124
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
125
|
+
className: "libro-tooltip-keybind",
|
|
126
|
+
children: "Shift+".concat(isMacintosh ? 'Option' : 'Alt', "+F")
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
129
|
+
},
|
|
120
130
|
group: ['sidetoolbar1'],
|
|
121
131
|
order: 'd'
|
|
122
132
|
});
|
|
123
133
|
registry.registerItem({
|
|
124
134
|
id: NotebookCommands['MoveCellUp'].id,
|
|
125
135
|
command: NotebookCommands['MoveCellUp'].id,
|
|
126
|
-
tooltip:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
tooltip: function tooltip() {
|
|
137
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
138
|
+
className: "libro-side-tooltip",
|
|
139
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
140
|
+
className: "libro-tooltip-text",
|
|
141
|
+
children: l10n.t('上移')
|
|
142
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
143
|
+
className: "libro-tooltip-keybind",
|
|
144
|
+
children: "Up"
|
|
145
|
+
})]
|
|
146
|
+
});
|
|
147
|
+
},
|
|
136
148
|
group: ['sidetoolbar1'],
|
|
137
149
|
order: 'e'
|
|
138
150
|
});
|
|
139
151
|
registry.registerItem({
|
|
140
152
|
id: NotebookCommands['MoveCellDown'].id,
|
|
141
153
|
command: NotebookCommands['MoveCellDown'].id,
|
|
142
|
-
tooltip:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
154
|
+
tooltip: function tooltip() {
|
|
155
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
156
|
+
className: "libro-side-tooltip",
|
|
157
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
158
|
+
className: "libro-tooltip-text",
|
|
159
|
+
children: l10n.t('下移')
|
|
160
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
161
|
+
className: "libro-tooltip-keybind",
|
|
162
|
+
children: "Down"
|
|
163
|
+
})]
|
|
164
|
+
});
|
|
165
|
+
},
|
|
152
166
|
group: ['sidetoolbar1'],
|
|
153
167
|
order: 'f'
|
|
154
168
|
});
|
|
155
169
|
registry.registerItem({
|
|
156
170
|
id: NotebookCommands['InsertCellBelow'].id,
|
|
157
171
|
command: NotebookCommands['InsertCellBelow'].id,
|
|
158
|
-
tooltip:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
172
|
+
tooltip: function tooltip() {
|
|
173
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
174
|
+
className: "libro-side-tooltip",
|
|
175
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
176
|
+
className: "libro-tooltip-text",
|
|
177
|
+
children: l10n.t('增加')
|
|
178
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
179
|
+
className: "libro-tooltip-keybind",
|
|
180
|
+
children: "B"
|
|
181
|
+
})]
|
|
182
|
+
});
|
|
183
|
+
},
|
|
168
184
|
group: ['sidetoolbar2'],
|
|
169
185
|
order: 'g1'
|
|
170
186
|
});
|
|
171
187
|
registry.registerItem({
|
|
172
188
|
id: NotebookCommands['DeleteCell'].id,
|
|
173
189
|
command: NotebookCommands['DeleteCell'].id,
|
|
174
|
-
tooltip:
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
190
|
+
tooltip: function tooltip() {
|
|
191
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
192
|
+
className: "libro-side-tooltip",
|
|
193
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
194
|
+
className: "libro-tooltip-text",
|
|
195
|
+
children: l10n.t('删除')
|
|
196
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
197
|
+
className: "libro-tooltip-keybind",
|
|
198
|
+
children: "D D"
|
|
199
|
+
})]
|
|
200
|
+
});
|
|
201
|
+
},
|
|
184
202
|
group: ['sidetoolbar2'],
|
|
185
203
|
order: 'g2'
|
|
186
204
|
});
|
|
187
205
|
registry.registerItem({
|
|
188
206
|
id: NotebookCommands['UndoCellAction'].id,
|
|
189
207
|
command: NotebookCommands['UndoCellAction'].id,
|
|
190
|
-
tooltip:
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
208
|
+
tooltip: function tooltip() {
|
|
209
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
210
|
+
className: "libro-tooltip",
|
|
211
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
212
|
+
className: "libro-tooltip-text",
|
|
213
|
+
children: l10n.t('撤销')
|
|
214
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
215
|
+
className: "libro-tooltip-keybind",
|
|
216
|
+
children: "Z"
|
|
217
|
+
})]
|
|
218
|
+
});
|
|
219
|
+
},
|
|
200
220
|
group: ['group3'],
|
|
201
221
|
order: 'h1'
|
|
202
222
|
});
|
|
203
223
|
registry.registerItem({
|
|
204
224
|
id: NotebookCommands['RedoCellAction'].id,
|
|
205
225
|
command: NotebookCommands['RedoCellAction'].id,
|
|
206
|
-
tooltip:
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
226
|
+
tooltip: function tooltip() {
|
|
227
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
228
|
+
className: "libro-tooltip",
|
|
229
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
230
|
+
className: "libro-tooltip-text",
|
|
231
|
+
children: l10n.t('重做')
|
|
232
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
233
|
+
className: "libro-tooltip-keybind",
|
|
234
|
+
children: "Shift + Z"
|
|
235
|
+
})]
|
|
236
|
+
});
|
|
237
|
+
},
|
|
216
238
|
group: ['group3'],
|
|
217
239
|
order: 'h2'
|
|
218
240
|
});
|
|
@@ -236,13 +258,15 @@ export var LibroToolbarContribution = (_dec = singleton({
|
|
|
236
258
|
registry.registerItem({
|
|
237
259
|
id: NotebookCommands['ClearAllCellOutput'].id,
|
|
238
260
|
command: NotebookCommands['ClearAllCellOutput'].id,
|
|
239
|
-
tooltip:
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
261
|
+
tooltip: function tooltip() {
|
|
262
|
+
return /*#__PURE__*/_jsx("div", {
|
|
263
|
+
className: "libro-tooltip",
|
|
264
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
265
|
+
className: "libro-tooltip-text",
|
|
266
|
+
children: l10n.t('清空输出')
|
|
267
|
+
})
|
|
268
|
+
});
|
|
269
|
+
},
|
|
246
270
|
group: ['group3'],
|
|
247
271
|
order: 'j'
|
|
248
272
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-toolar-more-select.d.ts","sourceRoot":"","sources":["../../src/toolbar/side-toolar-more-select.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"side-toolar-more-select.d.ts","sourceRoot":"","sources":["../../src/toolbar/side-toolar-more-select.tsx"],"names":[],"mappings":";AAoBA,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EA6I5C,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAazC,CAAC"}
|
|
@@ -15,86 +15,6 @@ import { MoreOutlined } from "../material-from-designer.js";
|
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
-
var codeItems = [{
|
|
19
|
-
id: NotebookCommands['HideCellCode'].id,
|
|
20
|
-
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
21
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
22
|
-
className: "libro-menu-item-label",
|
|
23
|
-
children: l10n.t('隐藏 Code')
|
|
24
|
-
}), /*#__PURE__*/_jsxs("span", {
|
|
25
|
-
className: "libro-menu-item-keybind",
|
|
26
|
-
children: ["".concat(isMacintosh ? 'Cmd' : 'Ctrl', " + "), "'"]
|
|
27
|
-
})]
|
|
28
|
-
})
|
|
29
|
-
}, {
|
|
30
|
-
id: NotebookCommands['ShowCellCode'].id,
|
|
31
|
-
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
32
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
33
|
-
className: "libro-menu-item-label",
|
|
34
|
-
children: l10n.t('显示 Code')
|
|
35
|
-
}), /*#__PURE__*/_jsxs("span", {
|
|
36
|
-
className: "libro-menu-item-keybind",
|
|
37
|
-
children: ["".concat(isMacintosh ? 'Cmd' : 'Ctrl', " + "), "'"]
|
|
38
|
-
})]
|
|
39
|
-
})
|
|
40
|
-
}];
|
|
41
|
-
var outputItems = [{
|
|
42
|
-
id: NotebookCommands['HideCellOutputs'].id,
|
|
43
|
-
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
44
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
45
|
-
className: "libro-menu-item-label",
|
|
46
|
-
children: l10n.t('隐藏 Output')
|
|
47
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
48
|
-
className: "libro-menu-item-keybind",
|
|
49
|
-
children: "".concat(isMacintosh ? 'Cmd' : 'Ctrl', " + O")
|
|
50
|
-
})]
|
|
51
|
-
})
|
|
52
|
-
}, {
|
|
53
|
-
id: NotebookCommands['ShowCellOutputs'].id,
|
|
54
|
-
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
55
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
56
|
-
className: "libro-menu-item-label",
|
|
57
|
-
children: l10n.t('显示 Output')
|
|
58
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
59
|
-
className: "libro-menu-item-keybind",
|
|
60
|
-
children: "".concat(isMacintosh ? 'Cmd' : 'Ctrl', " + O")
|
|
61
|
-
})]
|
|
62
|
-
})
|
|
63
|
-
}];
|
|
64
|
-
var moreItems = [{
|
|
65
|
-
id: NotebookCommands['CopyCell'].id,
|
|
66
|
-
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
67
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
68
|
-
className: "libro-menu-item-label",
|
|
69
|
-
children: l10n.t('复制')
|
|
70
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
71
|
-
className: "libro-menu-item-keybind",
|
|
72
|
-
children: "C"
|
|
73
|
-
})]
|
|
74
|
-
})
|
|
75
|
-
}, {
|
|
76
|
-
id: NotebookCommands['CutCell'].id,
|
|
77
|
-
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
78
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
79
|
-
className: "libro-menu-item-label",
|
|
80
|
-
children: l10n.t('剪切')
|
|
81
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
82
|
-
className: "libro-menu-item-keybind",
|
|
83
|
-
children: "X"
|
|
84
|
-
})]
|
|
85
|
-
})
|
|
86
|
-
}, {
|
|
87
|
-
id: NotebookCommands['PasteCellBelow'].id,
|
|
88
|
-
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
89
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
90
|
-
className: "libro-menu-item-label",
|
|
91
|
-
children: l10n.t('粘贴')
|
|
92
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
93
|
-
className: "libro-menu-item-keybind",
|
|
94
|
-
children: "V"
|
|
95
|
-
})]
|
|
96
|
-
})
|
|
97
|
-
}];
|
|
98
18
|
export var LibroSideToolbarMoreMenu = function LibroSideToolbarMoreMenu() {
|
|
99
19
|
var _cell$outputArea;
|
|
100
20
|
var command = useInject(CommandRegistry);
|
|
@@ -102,6 +22,86 @@ export var LibroSideToolbarMoreMenu = function LibroSideToolbarMoreMenu() {
|
|
|
102
22
|
var data = toolbar.currentArgs;
|
|
103
23
|
var args = getOrigin(data) || [];
|
|
104
24
|
var cell = useObserve(args[0]);
|
|
25
|
+
var codeItems = [{
|
|
26
|
+
id: NotebookCommands['HideCellCode'].id,
|
|
27
|
+
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
28
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
29
|
+
className: "libro-menu-item-label",
|
|
30
|
+
children: l10n.t('隐藏 Code')
|
|
31
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
32
|
+
className: "libro-menu-item-keybind",
|
|
33
|
+
children: ["".concat(isMacintosh ? 'Cmd' : 'Ctrl', " + "), "'"]
|
|
34
|
+
})]
|
|
35
|
+
})
|
|
36
|
+
}, {
|
|
37
|
+
id: NotebookCommands['ShowCellCode'].id,
|
|
38
|
+
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
39
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
40
|
+
className: "libro-menu-item-label",
|
|
41
|
+
children: l10n.t('显示 Code')
|
|
42
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
43
|
+
className: "libro-menu-item-keybind",
|
|
44
|
+
children: ["".concat(isMacintosh ? 'Cmd' : 'Ctrl', " + "), "'"]
|
|
45
|
+
})]
|
|
46
|
+
})
|
|
47
|
+
}];
|
|
48
|
+
var outputItems = [{
|
|
49
|
+
id: NotebookCommands['HideCellOutputs'].id,
|
|
50
|
+
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
51
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
52
|
+
className: "libro-menu-item-label",
|
|
53
|
+
children: l10n.t('隐藏 Output')
|
|
54
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
55
|
+
className: "libro-menu-item-keybind",
|
|
56
|
+
children: "".concat(isMacintosh ? 'Cmd' : 'Ctrl', " + O")
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
59
|
+
}, {
|
|
60
|
+
id: NotebookCommands['ShowCellOutputs'].id,
|
|
61
|
+
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
62
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
63
|
+
className: "libro-menu-item-label",
|
|
64
|
+
children: l10n.t('显示 Output')
|
|
65
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
66
|
+
className: "libro-menu-item-keybind",
|
|
67
|
+
children: "".concat(isMacintosh ? 'Cmd' : 'Ctrl', " + O")
|
|
68
|
+
})]
|
|
69
|
+
})
|
|
70
|
+
}];
|
|
71
|
+
var moreItems = [{
|
|
72
|
+
id: NotebookCommands['CopyCell'].id,
|
|
73
|
+
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
74
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
75
|
+
className: "libro-menu-item-label",
|
|
76
|
+
children: l10n.t('复制')
|
|
77
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
78
|
+
className: "libro-menu-item-keybind",
|
|
79
|
+
children: "C"
|
|
80
|
+
})]
|
|
81
|
+
})
|
|
82
|
+
}, {
|
|
83
|
+
id: NotebookCommands['CutCell'].id,
|
|
84
|
+
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
85
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
86
|
+
className: "libro-menu-item-label",
|
|
87
|
+
children: l10n.t('剪切')
|
|
88
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
89
|
+
className: "libro-menu-item-keybind",
|
|
90
|
+
children: "X"
|
|
91
|
+
})]
|
|
92
|
+
})
|
|
93
|
+
}, {
|
|
94
|
+
id: NotebookCommands['PasteCellBelow'].id,
|
|
95
|
+
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
96
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
97
|
+
className: "libro-menu-item-label",
|
|
98
|
+
children: l10n.t('粘贴')
|
|
99
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
100
|
+
className: "libro-menu-item-keybind",
|
|
101
|
+
children: "V"
|
|
102
|
+
})]
|
|
103
|
+
})
|
|
104
|
+
}];
|
|
105
105
|
if (!cell) {
|
|
106
106
|
return null;
|
|
107
107
|
}
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ export const KernelCommands: Record<string, Command & { keybind?: string }> = {
|
|
|
25
25
|
},
|
|
26
26
|
RestartKernel: {
|
|
27
27
|
id: 'notebook:restart-kernel',
|
|
28
|
-
label: l10n.t('Restart Kernel
|
|
28
|
+
label: l10n.t('Restart Kernel'),
|
|
29
29
|
},
|
|
30
30
|
ShutdownKernel: {
|
|
31
31
|
id: 'notebook:shutdown-kernel',
|
|
@@ -365,16 +365,16 @@ export const NotebookCommands: Record<
|
|
|
365
365
|
},
|
|
366
366
|
RestartAndRunToSelected: {
|
|
367
367
|
id: 'notebook:restart-and-run-to-selected',
|
|
368
|
-
label: l10n.t('Restart and Run up to Selected Cell
|
|
368
|
+
label: l10n.t('Restart and Run up to Selected Cell'),
|
|
369
369
|
},
|
|
370
370
|
RestartClearOutput: {
|
|
371
371
|
id: 'notebook:restart-clear-output',
|
|
372
|
-
label: l10n.t('Restart and Clear Outputs of All Cells
|
|
372
|
+
label: l10n.t('Restart and Clear Outputs of All Cells'),
|
|
373
373
|
icon: Reload,
|
|
374
374
|
},
|
|
375
375
|
RestartRunAll: {
|
|
376
376
|
id: 'notebook:restart-run-all',
|
|
377
|
-
label: l10n.t('Restart and Run All Cells
|
|
377
|
+
label: l10n.t('Restart and Run All Cells'),
|
|
378
378
|
},
|
|
379
379
|
RunAllAbove: {
|
|
380
380
|
id: 'notebook:run-all-above',
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
ViewInstance,
|
|
10
10
|
ViewRender,
|
|
11
11
|
} from '@difizen/mana-app';
|
|
12
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
12
13
|
import { Tooltip } from 'antd';
|
|
13
14
|
import classnames from 'classnames';
|
|
14
15
|
import type { FC } from 'react';
|
|
@@ -267,8 +268,8 @@ const CellOutput: React.FC<{ cell: CellView }> = forwardRef(function CellOutput(
|
|
|
267
268
|
<Tooltip
|
|
268
269
|
title={`${
|
|
269
270
|
cell.model.hasOutputsScrolled
|
|
270
|
-
? '取消固定 Output 高度'
|
|
271
|
-
: '固定 Output 高度'
|
|
271
|
+
? l10n.t('取消固定 Output 高度')
|
|
272
|
+
: l10n.t('固定 Output 高度')
|
|
272
273
|
}`}
|
|
273
274
|
>
|
|
274
275
|
<div
|
package/src/index.less
CHANGED
package/src/libro-model.ts
CHANGED
|
@@ -493,7 +493,7 @@ export class LibroModel implements NotebookModel, DndListModel {
|
|
|
493
493
|
getOrigin(this.sharedModel).deleteCell(position);
|
|
494
494
|
getOrigin(this.sharedModel).insertCells(position, cellData);
|
|
495
495
|
});
|
|
496
|
-
//切分
|
|
496
|
+
//切分 Cell操作结束后进入编辑态
|
|
497
497
|
this.enterEditMode();
|
|
498
498
|
};
|
|
499
499
|
|
package/src/libro-setting.ts
CHANGED
|
@@ -89,8 +89,8 @@ export const RightContentFixed: ConfigurationNode<boolean> = {
|
|
|
89
89
|
|
|
90
90
|
export const OutputScrollBtnVisiable: ConfigurationNode<boolean> = {
|
|
91
91
|
id: 'libro.cell.output.scroll.button.visiable',
|
|
92
|
-
description: l10n.t('
|
|
93
|
-
title: l10n.t('
|
|
92
|
+
description: l10n.t('Cell 输出区域高度固定按钮是否显示'),
|
|
93
|
+
title: l10n.t('Cell 输出区域高度固定按钮是否显示'),
|
|
94
94
|
type: 'checkbox',
|
|
95
95
|
defaultValue: true,
|
|
96
96
|
schema: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ModalItem, ModalItemProps } from '@difizen/mana-app';
|
|
2
2
|
import { ConfigurationRegistry } from '@difizen/mana-app';
|
|
3
3
|
import { useInject, ViewManager, ViewRender } from '@difizen/mana-app';
|
|
4
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
4
5
|
import { Modal } from 'antd';
|
|
5
6
|
import { useEffect, useState } from 'react';
|
|
6
7
|
|
|
@@ -33,7 +34,7 @@ export function SettingsModalComponent({ visible, close }: ModalItemProps<void>)
|
|
|
33
34
|
|
|
34
35
|
return (
|
|
35
36
|
<Modal
|
|
36
|
-
title=
|
|
37
|
+
title={l10n.t('设置')}
|
|
37
38
|
open={visible}
|
|
38
39
|
onOk={() => close()}
|
|
39
40
|
onCancel={() => close()}
|
|
@@ -46,7 +46,7 @@ export class LibroToolbarContribution implements ToolbarContribution {
|
|
|
46
46
|
id: DocumentCommands['Save'].id,
|
|
47
47
|
command: DocumentCommands['Save'].id,
|
|
48
48
|
icon: SaveIcon,
|
|
49
|
-
tooltip: (
|
|
49
|
+
tooltip: () => (
|
|
50
50
|
<div className="libro-tooltip">
|
|
51
51
|
<span className="libro-tooltip-text">{l10n.t('保存')}</span>
|
|
52
52
|
<span className="libro-tooltip-keybind">{`${isMacintosh ? 'Cmd' : 'Ctrl'} + S`}</span>
|
|
@@ -59,7 +59,7 @@ export class LibroToolbarContribution implements ToolbarContribution {
|
|
|
59
59
|
registry.registerItem({
|
|
60
60
|
id: NotebookCommands['Interrupt'].id,
|
|
61
61
|
command: NotebookCommands['Interrupt'].id,
|
|
62
|
-
tooltip: (
|
|
62
|
+
tooltip: () => (
|
|
63
63
|
<div className="libro-tooltip">
|
|
64
64
|
<span className="libro-tooltip-text">{l10n.t('中断')}</span>
|
|
65
65
|
</div>
|
|
@@ -72,7 +72,7 @@ export class LibroToolbarContribution implements ToolbarContribution {
|
|
|
72
72
|
registry.registerItem({
|
|
73
73
|
id: NotebookCommands['CloseAndShutdown'].id,
|
|
74
74
|
command: NotebookCommands['CloseAndShutdown'].id,
|
|
75
|
-
tooltip: (
|
|
75
|
+
tooltip: () => (
|
|
76
76
|
<div className="libro-tooltip">
|
|
77
77
|
<span className="libro-tooltip-text">{l10n.t('关闭内核')}</span>
|
|
78
78
|
</div>
|
|
@@ -85,7 +85,7 @@ export class LibroToolbarContribution implements ToolbarContribution {
|
|
|
85
85
|
registry.registerItem({
|
|
86
86
|
id: NotebookCommands['RestartClearOutput'].id,
|
|
87
87
|
command: NotebookCommands['RestartClearOutput'].id,
|
|
88
|
-
tooltip: (
|
|
88
|
+
tooltip: () => (
|
|
89
89
|
<div className="libro-tooltip">
|
|
90
90
|
<span className="libro-tooltip-text">{l10n.t('重启并清空输出')}</span>
|
|
91
91
|
</div>
|
|
@@ -98,7 +98,7 @@ export class LibroToolbarContribution implements ToolbarContribution {
|
|
|
98
98
|
registry.registerItem({
|
|
99
99
|
id: DocumentCommands['FormatCell'].id,
|
|
100
100
|
command: DocumentCommands['FormatCell'].id,
|
|
101
|
-
tooltip: (
|
|
101
|
+
tooltip: () => (
|
|
102
102
|
<div className="libro-side-tooltip">
|
|
103
103
|
<span className="libro-tooltip-text">{l10n.t('格式化代码')}</span>
|
|
104
104
|
<span className="libro-tooltip-keybind">{`Shift+${isMacintosh ? 'Option' : 'Alt'}+F`}</span>
|
|
@@ -111,7 +111,7 @@ export class LibroToolbarContribution implements ToolbarContribution {
|
|
|
111
111
|
registry.registerItem({
|
|
112
112
|
id: NotebookCommands['MoveCellUp'].id,
|
|
113
113
|
command: NotebookCommands['MoveCellUp'].id,
|
|
114
|
-
tooltip: (
|
|
114
|
+
tooltip: () => (
|
|
115
115
|
<div className="libro-side-tooltip">
|
|
116
116
|
<span className="libro-tooltip-text">{l10n.t('上移')}</span>
|
|
117
117
|
<span className="libro-tooltip-keybind">Up</span>
|
|
@@ -124,7 +124,7 @@ export class LibroToolbarContribution implements ToolbarContribution {
|
|
|
124
124
|
registry.registerItem({
|
|
125
125
|
id: NotebookCommands['MoveCellDown'].id,
|
|
126
126
|
command: NotebookCommands['MoveCellDown'].id,
|
|
127
|
-
tooltip: (
|
|
127
|
+
tooltip: () => (
|
|
128
128
|
<div className="libro-side-tooltip">
|
|
129
129
|
<span className="libro-tooltip-text">{l10n.t('下移')}</span>
|
|
130
130
|
<span className="libro-tooltip-keybind">Down</span>
|
|
@@ -137,7 +137,7 @@ export class LibroToolbarContribution implements ToolbarContribution {
|
|
|
137
137
|
registry.registerItem({
|
|
138
138
|
id: NotebookCommands['InsertCellBelow'].id,
|
|
139
139
|
command: NotebookCommands['InsertCellBelow'].id,
|
|
140
|
-
tooltip: (
|
|
140
|
+
tooltip: () => (
|
|
141
141
|
<div className="libro-side-tooltip">
|
|
142
142
|
<span className="libro-tooltip-text">{l10n.t('增加')}</span>
|
|
143
143
|
<span className="libro-tooltip-keybind">B</span>
|
|
@@ -150,7 +150,7 @@ export class LibroToolbarContribution implements ToolbarContribution {
|
|
|
150
150
|
registry.registerItem({
|
|
151
151
|
id: NotebookCommands['DeleteCell'].id,
|
|
152
152
|
command: NotebookCommands['DeleteCell'].id,
|
|
153
|
-
tooltip: (
|
|
153
|
+
tooltip: () => (
|
|
154
154
|
<div className="libro-side-tooltip">
|
|
155
155
|
<span className="libro-tooltip-text">{l10n.t('删除')}</span>
|
|
156
156
|
<span className="libro-tooltip-keybind">D D</span>
|
|
@@ -163,7 +163,7 @@ export class LibroToolbarContribution implements ToolbarContribution {
|
|
|
163
163
|
registry.registerItem({
|
|
164
164
|
id: NotebookCommands['UndoCellAction'].id,
|
|
165
165
|
command: NotebookCommands['UndoCellAction'].id,
|
|
166
|
-
tooltip: (
|
|
166
|
+
tooltip: () => (
|
|
167
167
|
<div className="libro-tooltip">
|
|
168
168
|
<span className="libro-tooltip-text">{l10n.t('撤销')}</span>
|
|
169
169
|
<span className="libro-tooltip-keybind">Z</span>
|
|
@@ -176,7 +176,7 @@ export class LibroToolbarContribution implements ToolbarContribution {
|
|
|
176
176
|
registry.registerItem({
|
|
177
177
|
id: NotebookCommands['RedoCellAction'].id,
|
|
178
178
|
command: NotebookCommands['RedoCellAction'].id,
|
|
179
|
-
tooltip: (
|
|
179
|
+
tooltip: () => (
|
|
180
180
|
<div className="libro-tooltip">
|
|
181
181
|
<span className="libro-tooltip-text">{l10n.t('重做')}</span>
|
|
182
182
|
<span className="libro-tooltip-keybind">Shift + Z</span>
|
|
@@ -204,7 +204,7 @@ export class LibroToolbarContribution implements ToolbarContribution {
|
|
|
204
204
|
registry.registerItem({
|
|
205
205
|
id: NotebookCommands['ClearAllCellOutput'].id,
|
|
206
206
|
command: NotebookCommands['ClearAllCellOutput'].id,
|
|
207
|
-
tooltip: (
|
|
207
|
+
tooltip: () => (
|
|
208
208
|
<div className="libro-tooltip">
|
|
209
209
|
<span className="libro-tooltip-text">{l10n.t('清空输出')}</span>
|
|
210
210
|
</div>
|
|
@@ -18,88 +18,87 @@ import { MoreOutlined } from '../material-from-designer.js';
|
|
|
18
18
|
|
|
19
19
|
import type { LibroToolbarArags } from './libro-toolbar-protocol.js';
|
|
20
20
|
|
|
21
|
-
const codeItems: LibroSideToolbarMenuItemType[] = [
|
|
22
|
-
{
|
|
23
|
-
id: NotebookCommands['HideCellCode'].id,
|
|
24
|
-
label: (
|
|
25
|
-
<>
|
|
26
|
-
<span className="libro-menu-item-label">{l10n.t('隐藏 Code')}</span>
|
|
27
|
-
<span className="libro-menu-item-keybind">
|
|
28
|
-
{`${isMacintosh ? 'Cmd' : 'Ctrl'} + `}'
|
|
29
|
-
</span>
|
|
30
|
-
</>
|
|
31
|
-
),
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: NotebookCommands['ShowCellCode'].id,
|
|
35
|
-
label: (
|
|
36
|
-
<>
|
|
37
|
-
<span className="libro-menu-item-label">{l10n.t('显示 Code')}</span>
|
|
38
|
-
<span className="libro-menu-item-keybind">
|
|
39
|
-
{`${isMacintosh ? 'Cmd' : 'Ctrl'} + `}'
|
|
40
|
-
</span>
|
|
41
|
-
</>
|
|
42
|
-
),
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
const outputItems: LibroSideToolbarMenuItemType[] = [
|
|
47
|
-
{
|
|
48
|
-
id: NotebookCommands['HideCellOutputs'].id,
|
|
49
|
-
label: (
|
|
50
|
-
<>
|
|
51
|
-
<span className="libro-menu-item-label">{l10n.t('隐藏 Output')}</span>
|
|
52
|
-
<span className="libro-menu-item-keybind">{`${isMacintosh ? 'Cmd' : 'Ctrl'} + O`}</span>
|
|
53
|
-
</>
|
|
54
|
-
),
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
id: NotebookCommands['ShowCellOutputs'].id,
|
|
58
|
-
label: (
|
|
59
|
-
<>
|
|
60
|
-
<span className="libro-menu-item-label">{l10n.t('显示 Output')}</span>
|
|
61
|
-
<span className="libro-menu-item-keybind">{`${isMacintosh ? 'Cmd' : 'Ctrl'} + O`}</span>
|
|
62
|
-
</>
|
|
63
|
-
),
|
|
64
|
-
},
|
|
65
|
-
];
|
|
66
|
-
|
|
67
|
-
const moreItems: LibroSideToolbarMenuItemType[] = [
|
|
68
|
-
{
|
|
69
|
-
id: NotebookCommands['CopyCell'].id,
|
|
70
|
-
label: (
|
|
71
|
-
<>
|
|
72
|
-
<span className="libro-menu-item-label">{l10n.t('复制')}</span>
|
|
73
|
-
<span className="libro-menu-item-keybind">C</span>
|
|
74
|
-
</>
|
|
75
|
-
),
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
id: NotebookCommands['CutCell'].id,
|
|
79
|
-
label: (
|
|
80
|
-
<>
|
|
81
|
-
<span className="libro-menu-item-label">{l10n.t('剪切')}</span>
|
|
82
|
-
<span className="libro-menu-item-keybind">X</span>
|
|
83
|
-
</>
|
|
84
|
-
),
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
id: NotebookCommands['PasteCellBelow'].id,
|
|
88
|
-
label: (
|
|
89
|
-
<>
|
|
90
|
-
<span className="libro-menu-item-label">{l10n.t('粘贴')}</span>
|
|
91
|
-
<span className="libro-menu-item-keybind">V</span>
|
|
92
|
-
</>
|
|
93
|
-
),
|
|
94
|
-
},
|
|
95
|
-
];
|
|
96
|
-
|
|
97
21
|
export const LibroSideToolbarMoreMenu: React.FC = () => {
|
|
98
22
|
const command = useInject(CommandRegistry);
|
|
99
23
|
const toolbar = useInject<Toolbar>(ToolbarInstance);
|
|
100
24
|
const data = toolbar.currentArgs as LibroToolbarArags;
|
|
101
25
|
const args = getOrigin(data) || [];
|
|
102
26
|
const cell = useObserve(args[0]);
|
|
27
|
+
const codeItems: LibroSideToolbarMenuItemType[] = [
|
|
28
|
+
{
|
|
29
|
+
id: NotebookCommands['HideCellCode'].id,
|
|
30
|
+
label: (
|
|
31
|
+
<>
|
|
32
|
+
<span className="libro-menu-item-label">{l10n.t('隐藏 Code')}</span>
|
|
33
|
+
<span className="libro-menu-item-keybind">
|
|
34
|
+
{`${isMacintosh ? 'Cmd' : 'Ctrl'} + `}'
|
|
35
|
+
</span>
|
|
36
|
+
</>
|
|
37
|
+
),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: NotebookCommands['ShowCellCode'].id,
|
|
41
|
+
label: (
|
|
42
|
+
<>
|
|
43
|
+
<span className="libro-menu-item-label">{l10n.t('显示 Code')}</span>
|
|
44
|
+
<span className="libro-menu-item-keybind">
|
|
45
|
+
{`${isMacintosh ? 'Cmd' : 'Ctrl'} + `}'
|
|
46
|
+
</span>
|
|
47
|
+
</>
|
|
48
|
+
),
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
const outputItems: LibroSideToolbarMenuItemType[] = [
|
|
53
|
+
{
|
|
54
|
+
id: NotebookCommands['HideCellOutputs'].id,
|
|
55
|
+
label: (
|
|
56
|
+
<>
|
|
57
|
+
<span className="libro-menu-item-label">{l10n.t('隐藏 Output')}</span>
|
|
58
|
+
<span className="libro-menu-item-keybind">{`${isMacintosh ? 'Cmd' : 'Ctrl'} + O`}</span>
|
|
59
|
+
</>
|
|
60
|
+
),
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: NotebookCommands['ShowCellOutputs'].id,
|
|
64
|
+
label: (
|
|
65
|
+
<>
|
|
66
|
+
<span className="libro-menu-item-label">{l10n.t('显示 Output')}</span>
|
|
67
|
+
<span className="libro-menu-item-keybind">{`${isMacintosh ? 'Cmd' : 'Ctrl'} + O`}</span>
|
|
68
|
+
</>
|
|
69
|
+
),
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
const moreItems: LibroSideToolbarMenuItemType[] = [
|
|
74
|
+
{
|
|
75
|
+
id: NotebookCommands['CopyCell'].id,
|
|
76
|
+
label: (
|
|
77
|
+
<>
|
|
78
|
+
<span className="libro-menu-item-label">{l10n.t('复制')}</span>
|
|
79
|
+
<span className="libro-menu-item-keybind">C</span>
|
|
80
|
+
</>
|
|
81
|
+
),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: NotebookCommands['CutCell'].id,
|
|
85
|
+
label: (
|
|
86
|
+
<>
|
|
87
|
+
<span className="libro-menu-item-label">{l10n.t('剪切')}</span>
|
|
88
|
+
<span className="libro-menu-item-keybind">X</span>
|
|
89
|
+
</>
|
|
90
|
+
),
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: NotebookCommands['PasteCellBelow'].id,
|
|
94
|
+
label: (
|
|
95
|
+
<>
|
|
96
|
+
<span className="libro-menu-item-label">{l10n.t('粘贴')}</span>
|
|
97
|
+
<span className="libro-menu-item-keybind">V</span>
|
|
98
|
+
</>
|
|
99
|
+
),
|
|
100
|
+
},
|
|
101
|
+
];
|
|
103
102
|
if (!cell) {
|
|
104
103
|
return null;
|
|
105
104
|
}
|