Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

#270 Selectize Modifications For Pasting Delimited Values#425

Merged
brianreavis merged 10 commits into
masterfrom
unknown repository
Jan 27, 2015
Merged

#270 Selectize Modifications For Pasting Delimited Values#425
brianreavis merged 10 commits into
masterfrom
unknown repository

Conversation

@jhash
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

jhash commented May 21, 2014

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

@Scottmitch
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

@brianreavis
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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

@cbrammer
Copy link
Copy Markdown

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

@chengyin
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Member

This is now a part of 0.12.0 (just released)

@island205
Copy link
Copy Markdown

love this feature

Comment thread src/defaults.js
Selectize.defaults = {
plugins: [],
delimiter: ',',
splitOn: null, // Regex or string for splitting up values from a paste command
Copy link
Copy Markdown

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants