Skip to content
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

Can't type or paste parens or brackets into Text field #303

Closed
kapily opened this issue May 30, 2023 · 4 comments
Closed

Can't type or paste parens or brackets into Text field #303

kapily opened this issue May 30, 2023 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@kapily
Copy link
Contributor

kapily commented May 30, 2023

Repro is pretty simple. Just create a text field:

name = mr.Text(value="John", label="What is your name?", rows=1)

And try pasting or type one of the following characters: ) ( ] [

@pplonski
Copy link
Contributor

It is on purpose, I disabled selected set of characters in the Text widget. Here is a function to sanitize input

const sanitizeString = (input_string: string) => {
return input_string.replace(/["'(){}[\]`^]/gim, "");
};

@kapily
Copy link
Contributor Author

kapily commented May 30, 2023

Could you add a parameter to allow for disabling the sanitization? There are good reasons to want to use those characters in an input string and any sort of database sanitization should be done on the server anyway

@pplonski
Copy link
Contributor

You are right. I can add parameter to disable sanitization.

To be precise, right now sanitization is applied in the frontend and in the backend - we check input strings two times.

@pplonski pplonski added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels May 30, 2023
@pplonski
Copy link
Contributor

@spamsch added sanitize parameter in Text widget, thank you! I've added small fixes in fd0021b and it should be working. I've released version 2.3.8 right now and updated docs https://runmercury.com/docs/input-widgets/text/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants