-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Input Large Text Area Sample #77
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
Conversation
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.
Feel free to merge this. It's a sample and we can evolve it over time
} | ||
|
||
// Make the following APIs available in global scope for invocation from JS | ||
window['InputLargeTextArea'] = InputLargeTextArea; |
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.
Out of curiosity, why would we do do this? Probably enough for a user to operate directly against the textarea
element, no?
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.
Just wanted it to be more general / following the in-framework pattern.
/// <param name="streamWriter">A <see cref="System.IO.StreamWriter"/> used to set the value of the textarea.</param> | ||
/// <param name="leaveTextAreaEnabled"><see langword="false" /> to disable the textarea while setting new content from the stream, otherwise <see langword="true" /> to allow it to be editable. Defaults to <see langword="false" />.</param> | ||
/// <param name="cancellationToken">The <see cref="System.Threading.CancellationToken"/> used to relay cancellation of the request.</param> | ||
public virtual async ValueTask SetTextAsync(StreamWriter streamWriter, bool leaveTextAreaEnabled = false, CancellationToken cancellationToken = default) |
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.
Now that it's not in the box, would we consider adding a set of string
based overloads with the caveat that says "using this might result in excessive allocations"? The nice-ish part about doing so would be that we would expose this as a Stream
based overload and let users figure out how to turn it in to readable text.
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.
consider adding a set of string based overloads
expose this as a Stream based overload
I'm assuming you mean string in both cases?
public virtual async ValueTask SetTextAsStringAsync(string textToSet, bool leaveTextAreaEnabled = false, CancellationToken cancellationToken = default);
public virtual async ValueTask<string> GetTextAsStringAsync(CancellationToken cancellationToken = default);
Merging this in now. I think the string based API should be a fairly simple addition if developers need it (should just be a matter of wrapping the StreamReader/StreamWriter usage around a function in |
Fixes: dotnet/aspnetcore#30291
Replaces: dotnet/aspnetcore#34856