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

Textarea @var config type #1636

Open
Xuerian opened this issue Aug 3, 2023 · 4 comments
Open

Textarea @var config type #1636

Xuerian opened this issue Aug 3, 2023 · 4 comments

Comments

@Xuerian
Copy link

Xuerian commented Aug 3, 2023

Use case:

  • Entering a list of items

For example, https://userstyles.world/style/9719 provides a 'text' var to generate a set of title match rules. Using 'text' means that list looks like 'Game Name 1, Game Name 2, Game Name 3' in a small single line entry.

From what I could tell, supporting a textarea type would be the most expedient way to improve this situation.

I tried to do it myself and got some of the way there, but could not wrap my head around the parser rules and how to handle an unquoted list with newlines. I might be able to finish it if there was some reference for that I could read or explanation of the surrounding system.

Side note, I didn't even know style var/configs existed before now, that's cool.

@tophf
Copy link
Member

tophf commented Dec 27, 2024

I think a more universal/compatible solution is to always show a textarea in the config and a button nearby that opens it in a new bigger modal. It'll support and preserve linebreaks, which in other userstyle extensions would be converted into normal whitespace by the <input> element automatically.

@eight04?

@eight04
Copy link
Collaborator

eight04 commented Dec 28, 2024

It'll support and preserve linebreaks

This may break the compiler. The compiler probably won't work with variables containing \n.

@tophf
Copy link
Member

tophf commented Dec 28, 2024

Well, then we'll save them in an escaped form or by replacing with some special character so that it doesn't break other tools/extensions.

@tophf
Copy link
Member

tophf commented Dec 28, 2024

OTOH this seems to be already handled correctly in usercss-meta: parseStringToEnd calls unquote() that unescapes as well.

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

No branches or pull requests

3 participants