File tree Expand file tree Collapse file tree
samples/KristofferStrube.Blazor.FileSystemAccess.WasmExample/Pages Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5858 if (! eventArgs .Repeat && fileHandle is not null && eventArgs .Key is { Length : 1 } key && allowedChars .Contains (char .Parse (key )))
5959 {
6060 var file = await fileHandle .GetFileAsync ();
61- var writable = await fileHandle .CreateWritableAsync ();
62- if (fileText is not null )
61+ await using (var writable = await fileHandle .CreateWritableAsync (new () { KeepExistingData = true }))
6362 {
64- await writable .WriteAsync (fileText );
63+ await writable .SeekAsync ((ulong )cursorPosition );
64+ await writable .WriteAsync (key );
6565 }
66- await writable .SeekAsync ((ulong )cursorPosition );
67- await writable .WriteAsync (key );
68- await writable .CloseAsync ();
6966 file = await fileHandle .GetFileAsync ();
7067 fileText = await file .TextAsync ();
7168 keyInput = key ;
You can’t perform that action at this time.
0 commit comments