From 189c3b2b6b55aee99905539da6af72adca376935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20Dupont-Foisy?= Date: Thu, 5 Sep 2024 13:12:42 -0400 Subject: [PATCH 1/2] Patch .call --- XtermBlazor/src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/XtermBlazor/src/index.ts b/XtermBlazor/src/index.ts index 19b17f7..3bfebd0 100644 --- a/XtermBlazor/src/index.ts +++ b/XtermBlazor/src/index.ts @@ -44,7 +44,7 @@ class XtermBlazor { } catch { // Asynchronous for both Blazor Server and Blazor WebAssembly apps. DotNet.invokeMethodAsync(this._ASSEMBLY_NAME, 'AttachCustomKeyEventHandler', id, this.parseKeyboardEvent(event)); - return this.getTerminalObjectById(id).customKeyEventHandler?.call(event) ?? true; + return this.getTerminalObjectById(id).customKeyEventHandler?.call(terminal, event) ?? true; } }); terminal.attachCustomWheelEventHandler(event => { @@ -54,7 +54,7 @@ class XtermBlazor { } catch { // Asynchronous for both Blazor Server and Blazor WebAssembly apps. DotNet.invokeMethodAsync(this._ASSEMBLY_NAME, 'AttachCustomWheelEventHandler', id, event); - return this.getTerminalObjectById(id).customWheelEventHandler?.call(event) ?? true; + return this.getTerminalObjectById(id).customWheelEventHandler?.call(terminal, event) ?? true; } }); From 0bbf613a398cf36ad056a46b2e5198e0f91f178d Mon Sep 17 00:00:00 2001 From: TatLead Date: Tue, 17 Sep 2024 14:52:08 +0800 Subject: [PATCH 2/2] Update index.ts --- XtermBlazor/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/XtermBlazor/src/index.ts b/XtermBlazor/src/index.ts index 3bfebd0..fedb541 100644 --- a/XtermBlazor/src/index.ts +++ b/XtermBlazor/src/index.ts @@ -44,7 +44,7 @@ class XtermBlazor { } catch { // Asynchronous for both Blazor Server and Blazor WebAssembly apps. DotNet.invokeMethodAsync(this._ASSEMBLY_NAME, 'AttachCustomKeyEventHandler', id, this.parseKeyboardEvent(event)); - return this.getTerminalObjectById(id).customKeyEventHandler?.call(terminal, event) ?? true; + return this.getTerminalObjectById(id).customKeyEventHandler(event); } }); terminal.attachCustomWheelEventHandler(event => { @@ -54,7 +54,7 @@ class XtermBlazor { } catch { // Asynchronous for both Blazor Server and Blazor WebAssembly apps. DotNet.invokeMethodAsync(this._ASSEMBLY_NAME, 'AttachCustomWheelEventHandler', id, event); - return this.getTerminalObjectById(id).customWheelEventHandler?.call(terminal, event) ?? true; + return this.getTerminalObjectById(id).customWheelEventHandler(event); } }); @@ -73,8 +73,8 @@ class XtermBlazor { this._terminals.set(id, { terminal: terminal, addons: addons, - customKeyEventHandler: undefined, - customWheelEventHandler: undefined + customKeyEventHandler: (event: KeyboardEvent) => true, + customWheelEventHandler: (event: WheelEvent) => true, }); }