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

Tag it plugin doesn't work with cyrillic 'б' letter #251

Open
ilyacherevkov opened this issue Mar 16, 2014 · 2 comments
Open

Tag it plugin doesn't work with cyrillic 'б' letter #251

ilyacherevkov opened this issue Mar 16, 2014 · 2 comments

Comments

@ilyacherevkov
Copy link

Sadly, tag it plugin completely ignores 'б' letter. Is any way to fix it?

@ixti
Copy link

ixti commented Mar 31, 2014

Problems comes from chars/keys press detection. keydown does not emits event with charCode, thus which always returns keyCode. And of course keyCode for comma in russian layout different from key code of comma in us layout for example. That logic should be splitted into handling keys that generate only a key code (backspace / enter) and to handling characters:

  .keypress(function (evt) {
    if (44 == evt.charCode) {
      // this is a comma :D
    }
  })

@karmis
Copy link

karmis commented Dec 2, 2015

For Cyrillic characters I fixed so:

                    // Comma/Space/Enter are all valid delimiters for new tags,
                    // except when there is an open quote or if setting allowSpaces = true.
                    // Tab will also create a tag, unless the tag input is empty,
                    // in which case it isn't caught.
                    if (
                        (
                        // event.which === $.ui.keyCode.COMMA && event.shiftKey === false)
                        // ||
                        event.which === $.ui.keyCode.ENTER
                        )
                        ||
                        (
                            event.which == $.ui.keyCode.TAB &&
                            that.tagInput.val() !== ''
                        )
                        ||
                        (
                            event.which == $.ui.keyCode.SPACE &&
                            that.options.allowSpaces !== true &&
                            (
                                $.trim(that.tagInput.val()).replace( /^s*/, '' ).charAt(0) != '"' ||
                                (
                                    $.trim(that.tagInput.val()).charAt(0) == '"' &&
                                    $.trim(that.tagInput.val()).charAt($.trim(that.tagInput.val()).length - 1) == '"' &&
                                    $.trim(that.tagInput.val()).length - 1 !== 0
                                )
                            )
                        )
                    ) {

(in source file in tagInput.keydown function)

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

No branches or pull requests

3 participants