Issue #7 Block non-existent tags #27

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@dfens

Added functionality of blocking tags (example attached). Also solved blur problem in a little hacky way.

@grisevg

Check out my solution. It's not perfect, but without setting timeout, which I think is better. It's checks mouse coordinates instead.

@dfens

I'm still waiting for any comment from repo owner :) I was thinking also about mouse position - but in some cases when playing with position relative & absolute it may be problematic

@grisevg

It's comparing the absolute mouse coords and absolute element coords so there should be no problems I think. Correct me if I'm wrong.

@grisevg grisevg commented on the diff Sep 6, 2011
js/tag-it.js
@@ -304,6 +323,12 @@
return false;
}
+ if(!this._tagIsAllowed(value)) {
@grisevg
grisevg Sep 6, 2011

I think you have a lot of overheat here. Suppose user want all tags to be allowed:
!this._tagIsAllowed(value) -> this.options.tagIsAllowed(value); -> return true;
Wouldn be simpler to read and faster to execute:
if (!this.options.tagIsAllowed || this.options.tagIsAllowed(value)) {

@aehlke
Owner

The blur stuff is fixed now.

I've added a really generic way to reject tags now, see the new beforeTagAdded callback which lets you return false to reject the tag from being added.

Thanks!

@aehlke aehlke closed this Nov 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment