Skip to content

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

Merged
merged 3 commits into from
Aug 25, 2021
Merged

Conversation

TanayParikh
Copy link
Contributor

Copy link
Contributor

@pranavkm pranavkm left a 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;
Copy link
Contributor

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?

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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);

@TanayParikh
Copy link
Contributor Author

Feel free to merge this. It's a sample and we can evolve it over time

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 InputLargeTextArea.cs). 😄

@TanayParikh TanayParikh merged commit 716ddf3 into main Aug 25, 2021
@TanayParikh TanayParikh deleted the taparik/InputLargeTextArea branch August 25, 2021 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specific component for dealing with large amounts of text data (InputTextArea)
2 participants