mirror of
https://github.com/moodle/moodle.git
synced 2025-07-09 08:29:23 +02:00
MDL-53349 Autocomplete: Support multi lingual COMMA keycode (44)
This commit is contained in:
committed by
John Okely
parent
5130953c8a
commit
e375029ea0
2
lib/amd/build/form-autocomplete.min.js
vendored
2
lib/amd/build/form-autocomplete.min.js
vendored
File diff suppressed because one or more lines are too long
@ -33,7 +33,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
|||||||
ENTER: 13,
|
ENTER: 13,
|
||||||
SPACE: 32,
|
SPACE: 32,
|
||||||
ESCAPE: 27,
|
ESCAPE: 27,
|
||||||
COMMA: 188,
|
COMMA: 44,
|
||||||
UP: 38
|
UP: 38
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -543,14 +543,6 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
|||||||
// We handled this event, so prevent it.
|
// We handled this event, so prevent it.
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
case KEYS.COMMA:
|
|
||||||
if (options.tags) {
|
|
||||||
// If we are allowing tags, comma should create a tag (or enter).
|
|
||||||
createItem(options, state, originalSelect);
|
|
||||||
}
|
|
||||||
// We handled this event, so prevent it.
|
|
||||||
e.preventDefault();
|
|
||||||
return false;
|
|
||||||
case KEYS.UP:
|
case KEYS.UP:
|
||||||
// Choose the previous active item.
|
// Choose the previous active item.
|
||||||
activatePreviousItem(state);
|
activatePreviousItem(state);
|
||||||
@ -581,6 +573,19 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
// Support multi lingual COMMA keycode (44).
|
||||||
|
inputElement.on('keypress', function(e) {
|
||||||
|
if (e.keyCode === KEYS.COMMA) {
|
||||||
|
if (options.tags) {
|
||||||
|
// If we are allowing tags, comma should create a tag (or enter).
|
||||||
|
createItem(options, state, originalSelect);
|
||||||
|
}
|
||||||
|
// We handled this event, so prevent it.
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
// Handler used to force set the value from behat.
|
// Handler used to force set the value from behat.
|
||||||
inputElement.on('behat:set-value', function() {
|
inputElement.on('behat:set-value', function() {
|
||||||
var suggestionsElement = $(document.getElementById(state.suggestionsId));
|
var suggestionsElement = $(document.getElementById(state.suggestionsId));
|
||||||
|
Reference in New Issue
Block a user