提交 7de68c8b 编写于 作者: F Fatih Acet

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
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册