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
Allow pasting multiple lines into the search field for tokenization #5806
Conversation
I was trying to make an easy way for clients to copy and paste tags from a spreadsheet, but I was unable to do this because select2's use of a 'search' input would remove all newline characters from the pasted input. replacing the search text input with a textarea removes this limitation.
Release Select2 4.0.8
Release Select2 4.0.9
Release Select2 4.0.10
stalebot closed my previous PR |
Not Stale. |
Hey @kevin-brown I've noticed that you keep touching the piece of code that this does, and while I'm happy to keep this updated on my end, do you think that it might be a good time to merge it in? Are there any apprehensions you have to merging it? is there anything you want me to change? |
Also I see with your latest changes I'm no longer allowed to reference 'this' can you advise on how exactly I should access the options in that context? |
reopened form #4795 |
Hi again, it's been a while. I haven't merged this in yet because I have some hesitations around side-effects. And I honestly haven't been in the mood to try to walk through this manually and get it running locally.
|
@kevin-brown Thanks for the response, I'll change this patch back into a change rather than a configurable and work on some modeling to show if it effects css. |
@denodster I give you credit for following this patch through for 3 years (and counting) and I apologize for that. I can help you out a bit with the styling if we can get the functional parts of it nailed down (keyboard accessibility + shortcuts). |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not Stale. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still not stale. |
Any chance of this getting attention? |
@Apezdr I need to put together some testing of some kind, though I've got other stuff going on right now, if you are inclined to put together a side by side where you compare this version with the main trunk that would be helpful. we need to show that this changes doesn't break screen readers and css. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not Stale |
Still watching this, thanks for keeping it not stale. 👍 |
This still has an issue with overflows and how the browser will completely shift focus rather than slowly move it character by character, but this is something which we can work out at a later time and shouldn't break things for now.
These tests currently fail in the automated test runner because they are checking the `autocomplete` property on the `<textarea>` DOM element. This attribute is widely supported across our supported browsers, but the property on the JS DOM element has only recently started to be supported. As a result, the virtual browser used by the test runner does not support this property and cannot read it for the tests.
I pushed up a handful of commits but there is still a failing test around sizing where the text box is now a few pixels too wide all of a sudden. I don't currently have the time to look into this (it's getting late) but I'm planning on tackling this next time, since I want to get this into the next beta of Select2 4.1.0. |
@kevin-brown thanks for doing that, I've been swamped lately with other things at my company but I still intend to return to this, I'll try to take a look as soon as my schedule gives me the opportunity. |
The width was incorrect for the placeholders because it was using the default browser style instead of the ones from Select2. As a result, it was coming back with a width of 104 because it was at 100% of 100px with the default 2px padding all around that is browser by the browser user style sheets. Now that it is being placed inside of the proper container, we can see that the expected styles are being applied.
This new class allows us to not have to apply the padding for the clear icon when the clear icon is not being displayed.
No worries, I was busy for the last few months so I totally understand. I think I figured out what was causing the failing test and corrected that issue. I'm going to let this stay open for a little longer (not sure if minutes or days) so eyes can check it out and then I'll merge it in for the next release. |
…elect2#5806) * Fixes select2#3712 Allowing Pasting tags from spreadsheet I was trying to make an easy way for clients to copy and paste tags from a spreadsheet, but I was unable to do this because select2's use of a 'search' input would remove all newline characters from the pasted input. replacing the search text input with a textarea removes this limitation. * Fixes bug and broken tests * Missed one spot * Fixes tests posibly? * reformat long lines * Reference options instead of searchElement directly * make input come first in selector * Make textarea the default rather than a configurable * fix weird whitespace * missing a quote * Fix styling to be closer to the default for search boxes This still has an issue with overflows and how the browser will completely shift focus rather than slowly move it character by character, but this is something which we can work out at a later time and shouldn't break things for now. * Fix tests expecting to find an input * Skip autocomplete property tests These tests currently fail in the automated test runner because they are checking the `autocomplete` property on the `<textarea>` DOM element. This attribute is widely supported across our supported browsers, but the property on the JS DOM element has only recently started to be supported. As a result, the virtual browser used by the test runner does not support this property and cannot read it for the tests. * Fix placeholder test returning incorrect width The width was incorrect for the placeholders because it was using the default browser style instead of the ones from Select2. As a result, it was coming back with a width of 104 because it was at 100% of 100px with the default 2px padding all around that is browser by the browser user style sheets. Now that it is being placed inside of the proper container, we can see that the expected styles are being applied. * Introduce new class to better handle the clear button This new class allows us to not have to apply the padding for the clear icon when the clear icon is not being displayed. * Update test with proper width of the search box Co-authored-by: Kevin Brown <kevin-brown@users.noreply.github.com> Co-authored-by: Andrew Colchagoff <andrew@tryskillo.com> Co-authored-by: Kevin Brown <kevin@kevin-brown.com>
This pull request includes a
The following changes were made
-Changes input to select
If this is related to an existing ticket, include a link to it as well.