Merge pull request #3856 from tgxworld/whitelist_chars_autocomplete
FIX: Whitelist parentheses and brackets in autocomplete.
This commit is contained in:
commit
ce47a05834
|
@ -287,7 +287,7 @@ export default function(options) {
|
||||||
if (options.key && e.which === options.key.charCodeAt(0)) {
|
if (options.key && e.which === options.key.charCodeAt(0)) {
|
||||||
caretPosition = Discourse.Utilities.caretPosition(me[0]);
|
caretPosition = Discourse.Utilities.caretPosition(me[0]);
|
||||||
var prevChar = me.val().charAt(caretPosition - 1);
|
var prevChar = me.val().charAt(caretPosition - 1);
|
||||||
if (!prevChar || /\W/.test(prevChar)) {
|
if (!prevChar || /[^\w\)\]]/.test(prevChar)) {
|
||||||
completeStart = completeEnd = caretPosition;
|
completeStart = completeEnd = caretPosition;
|
||||||
updateAutoComplete(options.dataSource(""));
|
updateAutoComplete(options.dataSource(""));
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ export default function(options) {
|
||||||
stopFound = prev === options.key;
|
stopFound = prev === options.key;
|
||||||
if (stopFound) {
|
if (stopFound) {
|
||||||
prev = me[0].value[c - 1];
|
prev = me[0].value[c - 1];
|
||||||
if (!prev || /\W/.test(prev)) {
|
if (!prev || /[^\w\)\]]/.test(prev)) {
|
||||||
completeStart = c;
|
completeStart = c;
|
||||||
caretPosition = completeEnd = initial;
|
caretPosition = completeEnd = initial;
|
||||||
term = me[0].value.substring(c + 1, initial);
|
term = me[0].value.substring(c + 1, initial);
|
||||||
|
|
Loading…
Reference in New Issue