tbonelee commented on code in PR #5080:
URL: https://github.com/apache/zeppelin/pull/5080#discussion_r2388287772
##########
zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/paragraph.component.ts:
##########
@@ -490,146 +473,46 @@ export class NotebookParagraphComponent extends
ParagraphBase implements OnInit,
constructor(
public messageService: MessageService,
private heliumService: HeliumService,
- private nzModalService: NzModalService,
+ private host: ElementRef,
private noteVarShareService: NoteVarShareService,
+ private nzModalService: NzModalService,
private shortcutService: ShortcutService,
- private host: ElementRef,
noteStatusService: NoteStatusService,
cdr: ChangeDetectorRef,
ngZService: NgZService
) {
super(messageService, noteStatusService, ngZService, cdr);
+ this.keyBinderService = new KeyBinder(this.destroy$, this.host,
this.shortcutService);
}
- ngOnInit() {
- const shortcutService =
this.shortcutService.forkByElement(this.host.nativeElement);
- const observables: Array<Observable<{
- action: ParagraphActions;
- event: KeyboardEvent;
- }>> = [];
- Object.entries(ShortcutsMap).forEach(([action, keys]) => {
- const keysArr: string[] = Array.isArray(keys) ? keys : [keys];
- keysArr.forEach(key => {
- observables.push(
- shortcutService
- .bindShortcut({
- keybindings: key
- })
- .pipe(
- takeUntil(this.destroy$),
- map(({ event }) => {
- return {
- event,
- action: action as ParagraphActions
- };
- })
- )
- );
- });
- });
+ private handleKeyEvent(action: ParagraphActions, event:
NullableKeyboardEvent) {
Review Comment:
This is for the Monaco case. `editor.addCommand()` handlers don’t receive an
event argument, so the handler could not pas `KeyboardEvent` to `events$`
property. That’s why I introduced `NullableKeyboardEvent`. You can see this in
`src/app/key-binding/key-binder.ts:initKeyBindingsOnMonaco`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]