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

The letter "б" in the russian layout #324

Open
mak7iliano opened this issue Jul 9, 2015 · 2 comments
Open

The letter "б" in the russian layout #324

mak7iliano opened this issue Jul 9, 2015 · 2 comments

Comments

@mak7iliano
Copy link

The current version of jQuery UI Tag-IT is impossible to enter the letter "б" on the russian layout, as it is on the same key as the comma, but a comma separators.
Slightly rewrite the events to make it work.
Maybe someone will come in handy)


// Events.
this.tagInput
    .keypress(function(event) {
        if (
            (event.charCode == '44') ||
            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
                    )
                )
            )
        ) {
            if (!(event.which === $.ui.keyCode.ENTER && that.tagInput.val() === '')) {
                event.preventDefault();
            }

            if (!(that.options.autocomplete.autoFocus && that.tagInput.data('autocomplete-open'))) {
                that.tagInput.autocomplete('close');
                that.createTag(that._cleanedInput());
            }
        }
    }).keydown(function(e){
        if (event.which == $.ui.keyCode.BACKSPACE && that.tagInput.val() === '') {
            var tag = that._lastTag();
            if (!that.options.removeConfirmation || tag.hasClass('remove')) {
                // When backspace is pressed, the last tag is deleted.
                that.removeTag(tag);
            } else if (that.options.removeConfirmation) {
                tag.addClass('remove ui-state-highlight');
            }
        } else if (that.options.removeConfirmation) {
            that._lastTag().removeClass('remove ui-state-highlight');
        }
    }).blur(function(e){
        if (!that.tagInput.data('autocomplete-open')) {
            that.createTag(that._cleanedInput());
        }
    });

@andrewkikot
Copy link

Красаучик!

@dchaplinsky
Copy link

This one is only creates a problem in Chrome. Will stay subscribed to that issue :)

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