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

#270 Selectize Modifications For Pasting Delimited Values #425

Merged
merged 10 commits into from Jan 27, 2015
Merged

#270 Selectize Modifications For Pasting Delimited Values #425

merged 10 commits into from Jan 27, 2015

Conversation

jhash
Copy link
Contributor

@jhash jhash commented May 21, 2014

Simple fix for adding paste support where values are delimited by whatever regex or characters desired - does not interfere with existing delimiter functionality at all.

@jhash jhash changed the title Selectize Modifications For Pasting Delimited Values #270 Selectize Modifications For Pasting Delimited Values May 21, 2014
@jhash
Copy link
Contributor Author

jhash commented May 21, 2014

Forgot to mention that this could help with the Open Issue #270

@Scottmitch
Copy link
Contributor

Thanks for the pull request. I'm not sure if the maintainers are expecting submissions for generated/build files. I don't own the project but it seems like it would make the merge/acceptance process easier.

@Scottmitch
Copy link
Contributor

Actually the owner does request you exclude the generated files in pull requests in the readme

@brianreavis
Copy link
Member

I really like where this is going, @jhash. I think having splitOn and delimiter could create some confusion, though. Particularly if someone changes the delimiter to something like ";" and then pastes something with commas. I think a better default for splitOn is null. Then, when the control initializes set splitOn to something based on delimiter. Roughly:

if (!self.options.splitOn) {
   var delimiter_escaped = self.options.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
   self.options.splitOn = new RegExp('\s*' + delimiter_escaped + '+\s*');
}

Also, the $.proxy calls are unnecessary.

@jhash
Copy link
Contributor Author

jhash commented Aug 12, 2014

@brianreavis Thanks for the suggestions! Sorry I haven't been actively watching this pull request, I should have noticed this a while ago. Anyways, I'm not sure why I left that $.proxy in there, but it's out now. Also, I added the splitOn changes that you suggested and fixed the merge conflicts. Hope to see it go live and thanks again.

@razfriman
Copy link

Thank you for this @jhash . This pull request works perfectly.

@cbrammer
Copy link

@brianreavis Thanks for building such a great component. Any thoughts on merging this in and releasing?

@chengyin
Copy link

Thank you @jhash , @brianreavis could you please review this? Thank you!

brianreavis added a commit that referenced this pull request Jan 27, 2015
#270 Selectize Modifications For Pasting Delimited Values
@brianreavis brianreavis merged commit faf5bff into selectize:master Jan 27, 2015
@brianreavis
Copy link
Member

@jhash Sorry for the delays in getting to this. I'm going to make a few minor changes, but all in all it looks really great. Thanks!

@brianreavis
Copy link
Member

This is now a part of 0.12.0 (just released)

@island205
Copy link

love this feature

@@ -2,6 +2,7 @@ Selectize.count = 0;
Selectize.defaults = {
plugins: [],
delimiter: ',',
splitOn: null, // Regex or string for splitting up values from a paste command

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this option missing from documentation? I couldn't find it

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

Successfully merging this pull request may close these issues.

8 participants