diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-11-30 20:43:24 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-11-30 20:43:24 +0000 |
commit | 7de68c8b7a317fa60ef4d4223399000606d9abbc (patch) | |
tree | 9ce66df8d95e67d4274097b0a291293ade656d13 /app/assets | |
parent | 2adc6568a6f94b2844c95a0b699a0be9bb8980d1 (diff) | |
parent | 34053a49703613d08bab7010a970b0ea8096ebad (diff) | |
download | gitlab-ce-7de68c8b7a317fa60ef4d4223399000606d9abbc.tar.gz |
Merge branch 'autocomplete-stays-open' into 'master'
Fixed GFM autocomplete regex
## What does this MR do?
Their was a bug in the regex that meant it was matching from the beginning of the GFM input text. This fixes that by splitting spaces & then checking on the last match.
It also fixes a bug where `@#` etc. would open 2 autocomplete dropdowns.
## What are the relevant issue numbers?
Closes #25119
See merge request !7826
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/gfm_auto_complete.js.es6 | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js.es6 b/app/assets/javascripts/gfm_auto_complete.js.es6 index 89fe13b7a45..10769b7fd4f 100644 --- a/app/assets/javascripts/gfm_auto_complete.js.es6 +++ b/app/assets/javascripts/gfm_auto_complete.js.es6 @@ -59,12 +59,13 @@ // Tweaked to commands to start without a space only if char before is a non-word character // https://github.com/ichord/At.js var _a, _y, regexp, match; + subtext = subtext.split(' ').pop(); flag = flag.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); _a = decodeURI("%C3%80"); _y = decodeURI("%C3%BF"); - regexp = new RegExp("(?:\\B|\\W|\\s)" + flag + "([A-Za-z" + _a + "-" + _y + "0-9_\'\.\+\-]*)|([^\\x00-\\xff]*)$", 'gi'); + regexp = new RegExp("(?:\\B|\\W|\\s)" + flag + "(?!\\W)([A-Za-z" + _a + "-" + _y + "0-9_\'\.\+\-]*)|([^\\x00-\\xff]*)$", 'gi'); match = regexp.exec(subtext); |