-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
autocorrect custom UIDs - convert humancase to snakecase #3052
Comments
not a bad idea. just wondering how we can differentiate this from a manually typed text, or are we going to auto correct that too? |
manually typed text fires validation error, prevents clicking 'Save' in VSCode when you paste text eg 'my cool thing', it says it will be converted into 'my_cool_thing' when press enter i think it will be easier to code, easier to rewrite (just add info next to allowed chars) validate message, and more intuitive and you see how it looks after correction or if it is good, no need to show validation message |
Can you explain the steps you normally take to create your thing / item? Do they have names already pre-filled? If they do, then we can take that immediately without needing you to copy paste anything. |
click on '+' then write label, uid is autogenerated like 'ffd67twq7d', then I rewrite this UID - paste label and make it valid, later fill other properties and the point is to autoupdate UID during fill label (convert spaces into '_' etc), or (better) after pasting label into uid input - convert label into proper format exactly like VSCode works when I create new branch, and paste text with spaces |
there is JS event 'onPaste' maybe it helps, in react/angular there is handlers for it maybe it helps in plain JS (tested od playground) <input type="text" onpaste="myFunction()" value="Paste something here" size="40">
<p id="demo">asd</p> JS function myFunction(){
let clipboardData = event.clipboardData || window.clipboardData;
let pastedText = clipboardData.getData('text');
document.getElementById("demo").innerHTML = "text:" + pastedText;
}; but your solution is also perfect |
It seems that vue's f7-list-input doesn't support @paste event. However, I can add a paste event listener to the input element, so that part works fine. What's complicated is this:
|
it is a 'helper' feature not 'automate' ;], and it is not so often use we can autofix if it is only spaces, it is simple space->'_', but if we have more forbiddent chars we need to choose fixed proper replacements so I think not go into sophistication, if you want correct it manually, feel free, if you dont like pasted-fixed text? correct it by yourself (like now, with validations) but: eg: |
The problem
it is easy to first make descriptive label then paste it into UID input
but when i paste name of my thing/item - i need to manually valid my own uids - remove spaces etc
Your suggestion
like correcting branches name in VSCode - auto convert pasted text to snake_case (or camel case?)
The text was updated successfully, but these errors were encountered: