diff options
author | Wu Cheng-Han | 2015-09-25 17:41:15 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2015-09-25 17:41:15 +0800 |
commit | 01217c9f4a83cbf700bca803cf1479c06981dac1 (patch) | |
tree | daffbe3e89c3311e14408baa732bdd93a3b71199 /public/js/index.js | |
parent | c2f9970ef0395f9fea82e1baba2e1e2614e94b5c (diff) |
Added extraTags support for list, and can toggle todo list in the view mode
Diffstat (limited to 'public/js/index.js')
-rw-r--r-- | public/js/index.js | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/public/js/index.js b/public/js/index.js index c414b0b5..28503413 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -102,7 +102,7 @@ var supportExternals = [ search: 'gist' } ]; -var supportBlockquoteTags = [ +var supportExtraTags = [ { text: '[name tag]', search: '[]', @@ -2031,13 +2031,35 @@ $(editor.getInputField()) return !isInCode; } }, - { //blockquote personal info & general info + { //extra tags for blockquote match: /(?:^|\n|\s)(\>.*)(\[\])(\w*)$/, search: function (term, callback) { var list = []; - $.map(supportBlockquoteTags, function (blockquotetag) { - if (blockquotetag.search.indexOf(term) === 0) - list.push(blockquotetag.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); + }) + callback(list); + checkCursorMenu(); + }, + replace: function (value) { + return '$1' + value; + }, + context: function (text) { + return !isInCode; + } + }, + { //extra tags for list + match: /(^[>\s]*[\-\+\*]\s(?:\[[x ]\]|.*))(\[\])(\w*)$/, + search: function (term, callback) { + var list = []; + $.map(supportExtraTags, function (extratag) { + if (extratag.search.indexOf(term) === 0) + list.push(extratag.command()); }); $.map(supportReferrals, function (referral) { if (referral.search.indexOf(term) === 0) |