LuckPermsWeb
LuckPermsWeb copied to clipboard
Allow for spaces between quotes in nodes
When trying to add prefixes to already created ranks on the LuckPerms editor, it doesn't allow spaces. Not sure if there is anyway you can fix this, as it sets anything after a space as another permission.
Maybe you could add a separate option for prefixes, or maybe allow " ".
Is this for the new version of the editor? I need to figure out a good way to handle this.
Is this for the new version of the editor? I need to figure out a good way to handle this.
Yes.
For anyone who wants to help with this (I am not an expert in regex):
Currently when entering new permissions, this regex is used to check for multiple permissions being added - /,\s*|,|\s+|\s*-{1}\s+/
This works perfectly for any cases where there are multiple permissions separated by space, or multiple spaces and hyphens (as if it were copied from a yaml file). The regex needs to also check for quotes " "
and make sure the quotes are kept intact, no matter how many spaces are added inside of them.
Here's an example on regexr: https://regexr.com/4smc5
Basically it needs to keep the same behaviour but not split the permission with quotes.
Hoping that someone will have a solution for this :)
Maybe only split on comma (similar to how tags on various sites work)?
But then users can't paste multiple permissions from various sources. It is almost always spaces, or spaces with hyphens.
\s*(?:,|-)?\s+
That alone is an improvement. Working on one that handles those cases properly.
After a bit of discussion the question came up as to why you don't just split at the newline?
That leaves no room for speculation where the nodes are separated.
And to trim them, always trim the left side and if it's then not a prefix or suffix node, also trim the right side.
Because new lines aren't supported in a text input, they are converted to spaces.
I feel like it should be a requirement that prefixes/suffixes which include spaces should be wrapped in quotes.
I did some searching and found \s+(?=([^"]*"[^"]*")*[^"]*$)
https://regexr.com/54d2o