Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2016-12-23 00:25:11 +0300
committerJacob Schatz <jschatz@gitlab.com>2016-12-23 00:25:11 +0300
commit05347e0748118d95724e2bd842f690cba5b03f8e (patch)
treec02a64973945455d5f665dbfa81f64718a14b8a1 /app/assets
parent7ca181d8e03f58a7be1e901645b26bb0cc8e89fb (diff)
parent940d8a06422b94ee7a5ff36d91a820fff3d9947b (diff)
Merge branch 'markdown-input-symbol-regex' into 'master'
Stops GFM special characters interfering with markdown tags See merge request !8265
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/gfm_auto_complete.js.es67
1 files changed, 4 insertions, 3 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js.es6 b/app/assets/javascripts/gfm_auto_complete.js.es6
index cbd8ac4eddd..12875eaa1c3 100644
--- a/app/assets/javascripts/gfm_auto_complete.js.es6
+++ b/app/assets/javascripts/gfm_auto_complete.js.es6
@@ -74,15 +74,16 @@
// The below is taken from At.js source
// 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, atSymbols;
- atSymbols = Object.keys(this.app.controllers).join('|');
+ var _a, _y, regexp, match, atSymbolsWithBar, atSymbolsWithoutBar;
+ atSymbolsWithBar = Object.keys(this.app.controllers).join('|');
+ atSymbolsWithoutBar = Object.keys(this.app.controllers).join('');
subtext = subtext.split(' ').pop();
flag = flag.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
_a = decodeURI("%C3%80");
_y = decodeURI("%C3%BF");
- regexp = new RegExp("(?:\\B|\\W|\\s)" + flag + "(?![" + atSymbols + "])([A-Za-z" + _a + "-" + _y + "0-9_\'\.\+\-]*)$", 'gi');
+ regexp = new RegExp("^(?:\\B|[^a-zA-Z0-9_" + atSymbolsWithoutBar + "]|\\s)" + flag + "(?![" + atSymbolsWithBar + "])([A-Za-z" + _a + "-" + _y + "0-9_\'\.\+\-]*)$", 'gi');
match = regexp.exec(subtext);