Fix text complete of extra tags for list not triggered properly

This commit is contained in:
Wu Cheng-Han 2017-03-23 20:49:31 +08:00
parent 890f7089bf
commit 3156c38598

View file

@ -3313,17 +3313,13 @@ $(editor.getInputField())
return !isInCode return !isInCode
} }
}, },
{ // extra tags for blockquote { // extra tags for list
match: /(?:^|\n|\s)(>.*|\s|)((\^|)\[(\^|)\](\[\]|\(\)|:|)\s*\w*)$/, match: /(^[>\s]*[-+*]\s(?:\[[x ]\]|.*))(\[\])(\w*)$/,
search: function (term, callback) { search: function (term, callback) {
var line = editor.getLine(editor.getCursor().line)
var quote = line.match(this.match)[1].trim()
var list = [] var list = []
if (quote.indexOf('>') === 0) { $.map(supportExtraTags, function (extratag) {
$.map(supportExtraTags, function (extratag) { if (extratag.search.indexOf(term) === 0) { list.push(extratag.command()) }
if (extratag.search.indexOf(term) === 0) { list.push(extratag.command()) } })
})
}
$.map(supportReferrals, function (referral) { $.map(supportReferrals, function (referral) {
if (referral.search.indexOf(term) === 0) { list.push(referral.text) } if (referral.search.indexOf(term) === 0) { list.push(referral.text) }
}) })
@ -3336,13 +3332,17 @@ $(editor.getInputField())
return !isInCode return !isInCode
} }
}, },
{ // extra tags for list { // extra tags for blockquote
match: /(^[>\s]*[-+*]\s(?:\[[x ]\]|.*))(\[\])(\w*)$/, match: /(?:^|\n|\s)(>.*|\s|)((\^|)\[(\^|)\](\[\]|\(\)|:|)\s*\w*)$/,
search: function (term, callback) { search: function (term, callback) {
var line = editor.getLine(editor.getCursor().line)
var quote = line.match(this.match)[1].trim()
var list = [] var list = []
$.map(supportExtraTags, function (extratag) { if (quote.indexOf('>') === 0) {
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) { $.map(supportReferrals, function (referral) {
if (referral.search.indexOf(term) === 0) { list.push(referral.text) } if (referral.search.indexOf(term) === 0) { list.push(referral.text) }
}) })