mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 16:07:03 +08:00
FIX: Trigger autocomplete when bounded by non-word characters.
This commit is contained in:
@ -277,7 +277,7 @@ export default function(options) {
|
||||
if (options.key && e.which === options.key.charCodeAt(0)) {
|
||||
caretPosition = Discourse.Utilities.caretPosition(me[0]);
|
||||
var prevChar = me.val().charAt(caretPosition - 1);
|
||||
if (!prevChar || /\s/.test(prevChar)) {
|
||||
if (!prevChar || /\W/.test(prevChar)) {
|
||||
completeStart = completeEnd = caretPosition;
|
||||
updateAutoComplete(options.dataSource(""));
|
||||
}
|
||||
@ -331,7 +331,7 @@ export default function(options) {
|
||||
stopFound = prev === options.key;
|
||||
if (stopFound) {
|
||||
prev = me[0].value[c - 1];
|
||||
if (!prev || /\s/.test(prev)) {
|
||||
if (!prev || /\W/.test(prev)) {
|
||||
completeStart = c;
|
||||
caretPosition = completeEnd = initial;
|
||||
term = me[0].value.substring(c + 1, initial);
|
||||
|
Reference in New Issue
Block a user