Skip to content

Commit 38d0c46

Browse files
committed
chore: update code editor actions
1 parent 1a28a7a commit 38d0c46

File tree

4 files changed

+192
-182
lines changed

4 files changed

+192
-182
lines changed

zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/code-editor/code-editor.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ export class NotebookParagraphCodeEditorComponent implements OnChanges, OnDestro
115115
this.editor.addAction({
116116
id: item.icon,
117117
label: item.label,
118-
keybindings: item.keyBindings,
119118
precondition: null,
120119
keybindingContext: null,
121120
contextMenuGroupId: 'navigation',

zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/control/control.component.ts

Lines changed: 56 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -81,119 +81,114 @@ export class NotebookParagraphControlComponent implements OnInit, OnChanges {
8181
disabled: boolean;
8282
icon: string;
8383
shortCut: string;
84-
keyBindings: number[];
8584
trigger(): void;
8685
}> = [];
8786

88-
updateListOfMenu(monaco?) {
87+
updateListOfMenu() {
8988
this.listOfMenu = [
89+
{
90+
label: 'Run',
91+
show: !this.first,
92+
disabled: this.isEntireNoteRunning,
93+
icon: 'play-circle',
94+
trigger: () => this.trigger(this.runParagraph),
95+
shortCut: this.isMac ? '⇧+⌘+Enter' : 'Shift+Ctrl+Enter'
96+
},
97+
{
98+
label: 'Run all above',
99+
show: !this.first,
100+
disabled: this.isEntireNoteRunning,
101+
icon: 'up-square',
102+
trigger: () => this.trigger(this.runAllAbove),
103+
shortCut: this.isMac ? '⇧+⌘+Enter' : 'Shift+Ctrl+Enter'
104+
},
105+
{
106+
label: 'Run all below',
107+
show: !this.last,
108+
disabled: this.isEntireNoteRunning,
109+
icon: 'down-square',
110+
trigger: () => this.trigger(this.runAllBelowAndCurrent),
111+
shortCut: this.isMac ? '⇧+⌘+Enter' : 'Shift+Ctrl+Enter'
112+
},
113+
{
114+
label: 'Link this paragraph',
115+
show: true,
116+
disabled: false,
117+
icon: 'export',
118+
trigger: () => this.goToSingleParagraph(),
119+
shortCut: `Ctrl+${this.isMac ? 'Option' : 'Alt'}+W`
120+
},
121+
{
122+
label: 'Clear output',
123+
show: true,
124+
disabled: this.isEntireNoteRunning,
125+
icon: 'fire',
126+
trigger: () => this.clearParagraphOutput(),
127+
shortCut: this.isMac ? '⌥+⌘+L' : 'Alt+Ctrl+L'
128+
},
129+
{
130+
label: 'Remove',
131+
show: this.paragraphLength > 1,
132+
disabled: this.isEntireNoteRunning,
133+
icon: 'delete',
134+
trigger: () => this.onRemoveParagraph(),
135+
shortCut: this.isMac ? '⇧+Del (Command)' : 'Shift+Del (Command)'
136+
},
90137
{
91138
label: 'Move up',
92139
show: !this.first,
93140
disabled: this.isEntireNoteRunning,
94141
icon: 'up',
95142
trigger: () => this.trigger(this.moveUp),
96-
shortCut: `Ctrl+${this.isMac ? 'Option' : 'Alt'}+K`,
97-
keyBindings: monaco ? [monaco.KeyMod.WinCtrl | monaco.KeyMod.Alt | monaco.KeyCode.KEY_K] : []
143+
shortCut: `${this.isMac ? '⌘' : 'Ctrl'}+K (Command)`
98144
},
99145
{
100146
label: 'Move down',
101147
show: !this.last,
102148
disabled: this.isEntireNoteRunning,
103149
icon: 'down',
104150
trigger: () => this.trigger(this.moveDown),
105-
shortCut: `Ctrl+${this.isMac ? 'Option' : 'Alt'}+J`,
106-
keyBindings: monaco ? [monaco.KeyMod.WinCtrl | monaco.KeyMod.Alt | monaco.KeyCode.KEY_J] : []
151+
shortCut: `${this.isMac ? '⌘' : 'Ctrl'}+J (Command)`
107152
},
108153
{
109154
label: 'Insert new',
110155
show: true,
111156
disabled: this.isEntireNoteRunning,
112157
icon: 'plus',
113158
trigger: () => this.trigger(this.insertNew),
114-
shortCut: `Ctrl+${this.isMac ? 'Option' : 'Alt'}+B`,
115-
keyBindings: monaco ? [monaco.KeyMod.WinCtrl | monaco.KeyMod.Alt | monaco.KeyCode.KEY_B] : []
116-
},
117-
{
118-
label: 'Run all above',
119-
show: !this.first,
120-
disabled: this.isEntireNoteRunning,
121-
icon: 'up-square',
122-
trigger: () => this.trigger(this.runAllAbove),
123-
shortCut: `Ctrl+Shift+Enter`,
124-
keyBindings: monaco ? [monaco.KeyMod.WinCtrl | monaco.KeyMod.Shift | monaco.KeyCode.Enter] : []
125-
},
126-
{
127-
label: 'Run all below',
128-
show: !this.last,
129-
disabled: this.isEntireNoteRunning,
130-
icon: 'down-square',
131-
trigger: () => this.trigger(this.runAllBelowAndCurrent),
132-
shortCut: `Ctrl+Shift+Enter`,
133-
keyBindings: monaco ? [monaco.KeyMod.WinCtrl | monaco.KeyMod.Shift | monaco.KeyCode.Enter] : []
159+
shortCut: `B (Command)`
134160
},
135161
{
136162
label: 'Clone paragraph',
137163
show: true,
138164
disabled: this.isEntireNoteRunning,
139165
icon: 'copy',
140166
trigger: () => this.trigger(this.cloneParagraph),
141-
shortCut: `Ctrl+Shift+C`,
142-
keyBindings: monaco ? [monaco.KeyMod.WinCtrl | monaco.KeyMod.Shift | monaco.KeyCode.KEY_C] : []
167+
shortCut: `C (Command)`
143168
},
144169
{
145170
label: this.title ? 'Hide Title' : 'Show Title',
146171
show: true,
147172
disabled: false,
148173
icon: 'font-colors',
149174
trigger: () => this.toggleTitle(),
150-
shortCut: `Ctrl+${this.isMac ? 'Option' : 'Alt'}+T`,
151-
keyBindings: monaco ? [monaco.KeyMod.WinCtrl | monaco.KeyMod.Alt | monaco.KeyCode.KEY_T] : []
175+
shortCut: `T (Command)`
152176
},
153177
{
154178
label: this.lineNumbers ? 'Hide line numbers' : 'Show line numbers',
155179
show: true,
156180
disabled: false,
157181
icon: 'ordered-list',
158182
trigger: () => this.toggleLineNumbers(),
159-
shortCut: `Ctrl+${this.isMac ? 'Option' : 'Alt'}+M`,
160-
keyBindings: monaco ? [monaco.KeyMod.WinCtrl | monaco.KeyMod.Alt | monaco.KeyCode.KEY_M] : []
183+
shortCut: `L (Command)`
161184
},
162185
{
163186
label: this.enabled ? 'Disable run' : 'Enable run',
164187
show: true,
165188
disabled: this.isEntireNoteRunning,
166189
icon: 'api',
167190
trigger: () => this.toggleEnabled(),
168-
shortCut: `Ctrl+${this.isMac ? 'Option' : 'Alt'}+R`,
169-
keyBindings: monaco ? [monaco.KeyMod.WinCtrl | monaco.KeyMod.Alt | monaco.KeyCode.KEY_R] : []
170-
},
171-
{
172-
label: 'Link this paragraph',
173-
show: true,
174-
disabled: false,
175-
icon: 'export',
176-
trigger: () => this.goToSingleParagraph(),
177-
shortCut: `Ctrl+${this.isMac ? 'Option' : 'Alt'}+W`,
178-
keyBindings: monaco ? [monaco.KeyMod.WinCtrl | monaco.KeyMod.Alt | monaco.KeyCode.KEY_W] : []
179-
},
180-
{
181-
label: 'Clear output',
182-
show: true,
183-
disabled: this.isEntireNoteRunning,
184-
icon: 'fire',
185-
trigger: () => this.clearParagraphOutput(),
186-
shortCut: `Ctrl+${this.isMac ? 'Option' : 'Alt'}+L`,
187-
keyBindings: monaco ? [monaco.KeyMod.WinCtrl | monaco.KeyMod.Alt | monaco.KeyCode.KEY_L] : []
188-
},
189-
{
190-
label: 'Remove',
191-
show: this.paragraphLength > 1,
192-
disabled: this.isEntireNoteRunning,
193-
icon: 'delete',
194-
trigger: () => this.onRemoveParagraph(),
195-
shortCut: `Ctrl+${this.isMac ? 'Option' : 'Alt'}+D`,
196-
keyBindings: monaco ? [monaco.KeyMod.WinCtrl | monaco.KeyMod.Alt | monaco.KeyCode.KEY_D] : []
191+
shortCut: `R (Command)`
197192
}
198193
];
199194
}

0 commit comments

Comments
 (0)