-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blazor InputLargeTextArea
#34856
Blazor InputLargeTextArea
#34856
Conversation
Update Release .js files Update InputLargeTextAreaTest.cs Update InputLargeTextAreaTest.cs
531b629
to
af4f4b7
Compare
/ping @aspnet-blazor-eng, this is ready for review 😄 |
Thank you for your API proposal. I'm removing the |
src/Components/Web/src/Forms/InputLargeTextArea/InputLargeTextArea.cs
Outdated
Show resolved
Hide resolved
src/Components/Web/src/Forms/InputLargeTextArea/InputLargeTextArea.cs
Outdated
Show resolved
Hide resolved
The code changes are fairly straight forward, but I'd like to make sure this is the right API shape. |
This is now ready for review based on the new symmetric |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks great.
src/Components/Web/src/Forms/InputLargeTextArea/InputLargeTextArea.cs
Outdated
Show resolved
Hide resolved
{ | ||
// Special casing support for empty textareas. Due to security considerations | ||
// 0 length streams/textareas aren't permitted from JS->.NET Streaming Interop. | ||
if (jsException.InnerException is ArgumentOutOfRangeException) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we throw a more specific exception? Hard to say that ArgumentOutOfRange
is specifically because of a 0-length stream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm in the original context, I believe the ArgumentOutOfRange
exception may make sense, however I see your point about it still being ambiguous with other areas where that exception may be thrown.
How about this:
https://github.com/dotnet/aspnetcore/pull/34856/files#diff-30d94608ca41ec93dcbe8eb2bb646257519e86080e81ed5c246a715a8782c4b9R94-R102
Alternatively, we can decorate the Exception.Data
property with something more specific (though that may not necessarily be statically typed).
src/Components/Web/src/Forms/InputLargeTextArea/InputLargeTextArea.cs
Outdated
Show resolved
Hide resolved
src/Components/Web/src/Forms/InputLargeTextArea/InputLargeTextArea.cs
Outdated
Show resolved
Hide resolved
src/Components/Web/src/Forms/InputLargeTextArea/InputLargeTextArea.cs
Outdated
Show resolved
Hide resolved
src/Components/Web/src/Forms/InputLargeTextArea/InputLargeTextAreaInterop.cs
Outdated
Show resolved
Hide resolved
src/Components/test/testassets/BasicTestApp/FormsTest/InputLargeTextAreaComponent.razor
Show resolved
Hide resolved
// public override async Task InitializeAsync() | ||
// { | ||
// // Since the tests share interactivity with the same text area, it's easiest for each | ||
// // test to run in its own browser instance. | ||
// await base.InitializeAsync(Guid.NewGuid().ToString()); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// public override async Task InitializeAsync() | |
// { | |
// // Since the tests share interactivity with the same text area, it's easiest for each | |
// // test to run in its own browser instance. | |
// await base.InitializeAsync(Guid.NewGuid().ToString()); | |
// } | |
public override async Task InitializeAsync() | |
{ | |
// Since the tests share interactivity with the same text area, it's easiest for each | |
// test to run in its own browser instance. | |
await base.InitializeAsync(Guid.NewGuid().ToString()); | |
} |
@@ -509,7 +509,20 @@ export module DotNet { | |||
return value; | |||
}); | |||
|
|||
class DotNetStream { | |||
export interface IDotNetStreamReference { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Typescript it's idiomatic for interfaces not to have an I
prefix. I suppose the difference vs C# is that it's very meaningful to think about runtime types in .NET but not so relevant in JS.
} | ||
|
||
/// <summary> | ||
/// The textarea element for which the event was raised. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// The textarea element for which the event was raised. | |
/// The <see cref="InputLargeTextArea" /> for which the event was raised. |
/// <summary> | ||
/// Gets the length of the textarea value. | ||
/// </summary> | ||
public int Length { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the type be long
? Can it be > 2GB? I know that it would be pretty outrageous to have a 2GB textarea, but do we definitely want to preclude it?
There are concerns with API complexity from having to work with Closing this PR in favor of docs/samples of a solution for users that encounter this issue. |
Usage:
Implementation Notes:
Follows the overall pattern we have with the
InputFile
Component, communicating with the client and relaying back events.Fixes: #30291
API Proposal: #35007