Extend XtermBlazor to load addons
This commit is contained in:
parent
e85eeb01db
commit
9b515623df
2 changed files with 28 additions and 0 deletions
19
LANCommander.UI/Components/Terminal/Terminal.cs
Normal file
19
LANCommander.UI/Components/Terminal/Terminal.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using LANCommander.UI.Extensions;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using XtermBlazor;
|
||||
|
||||
namespace LANCommander.UI.Components;
|
||||
|
||||
public partial class Terminal : Xterm
|
||||
{
|
||||
[Inject]
|
||||
IJSRuntime JS { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await JS.ExecuteVoidAsync("RegisterXtermAddons");
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
}
|
||||
9
LANCommander.UI/Components/Terminal/XtermAddons.ts
Normal file
9
LANCommander.UI/Components/Terminal/XtermAddons.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { Readline } from "xterm-readline"
|
||||
import { FitAddon } from "@xterm/addon-fit"
|
||||
|
||||
export function RegisterXtermAddons() {
|
||||
(<any>window).XtermBlazor.registerAddons({
|
||||
"readline": new Readline(),
|
||||
"addon-fit": new FitAddon(),
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue