From 3156c3859825259232a59b0d7c4100540b659be0 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Thu, 23 Mar 2017 20:49:31 +0800 Subject: [PATCH] Fix text complete of extra tags for list not triggered properly --- public/js/index.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index 520850f0..bb942122 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -3313,17 +3313,13 @@ $(editor.getInputField()) return !isInCode } }, - { // extra tags for blockquote - match: /(?:^|\n|\s)(>.*|\s|)((\^|)\[(\^|)\](\[\]|\(\)|:|)\s*\w*)$/, + { // extra tags for list + match: /(^[>\s]*[-+*]\s(?:\[[x ]\]|.*))(\[\])(\w*)$/, search: function (term, callback) { - var line = editor.getLine(editor.getCursor().line) - var quote = line.match(this.match)[1].trim() var list = [] - if (quote.indexOf('>') === 0) { - $.map(supportExtraTags, function (extratag) { - if (extratag.search.indexOf(term) === 0) { list.push(extratag.command()) } - }) - } + $.map(supportExtraTags, function (extratag) { + if (extratag.search.indexOf(term) === 0) { list.push(extratag.command()) } + }) $.map(supportReferrals, function (referral) { if (referral.search.indexOf(term) === 0) { list.push(referral.text) } }) @@ -3336,13 +3332,17 @@ $(editor.getInputField()) return !isInCode } }, - { // extra tags for list - match: /(^[>\s]*[-+*]\s(?:\[[x ]\]|.*))(\[\])(\w*)$/, + { // extra tags for blockquote + match: /(?:^|\n|\s)(>.*|\s|)((\^|)\[(\^|)\](\[\]|\(\)|:|)\s*\w*)$/, search: function (term, callback) { + var line = editor.getLine(editor.getCursor().line) + var quote = line.match(this.match)[1].trim() var list = [] - $.map(supportExtraTags, function (extratag) { - if (extratag.search.indexOf(term) === 0) { list.push(extratag.command()) } - }) + if (quote.indexOf('>') === 0) { + $.map(supportExtraTags, function (extratag) { + if (extratag.search.indexOf(term) === 0) { list.push(extratag.command()) } + }) + } $.map(supportReferrals, function (referral) { if (referral.search.indexOf(term) === 0) { list.push(referral.text) } })