Fix code styles

This commit is contained in:
Cheng-Han, Wu 2016-04-24 12:30:16 +08:00
parent 0bb3e53d58
commit efb188c9c1

View file

@ -4,9 +4,9 @@ var defaultExtraKeys = {
"F10": function (cm) { "F10": function (cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen")); cm.setOption("fullScreen", !cm.getOption("fullScreen"));
}, },
"Esc": function(cm) { "Esc": function (cm) {
if (cm.getOption('keyMap').substr(0, 3) === 'vim') return CodeMirror.Pass; if (cm.getOption('keyMap').substr(0, 3) === 'vim') return CodeMirror.Pass;
else if(cm.getOption("fullScreen")) cm.setOption("fullScreen", false); else if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}, },
"Cmd-S": function () { "Cmd-S": function () {
return CodeMirror.Pass return CodeMirror.Pass
@ -15,9 +15,9 @@ var defaultExtraKeys = {
return CodeMirror.Pass return CodeMirror.Pass
}, },
"Enter": "newlineAndIndentContinueMarkdownList", "Enter": "newlineAndIndentContinueMarkdownList",
"Tab": function(cm) { "Tab": function (cm) {
var tab = '\t'; var tab = '\t';
var spaces = Array(parseInt(cm.getOption("indentUnit")) + 1).join(" "); var spaces = Array(parseInt(cm.getOption("indentUnit")) + 1).join(" ");
//auto indent whole line when in list or blockquote //auto indent whole line when in list or blockquote
var cursor = cm.getCursor(); var cursor = cm.getCursor();
var line = cm.getLine(cursor.line); var line = cm.getLine(cursor.line);
@ -32,19 +32,19 @@ var defaultExtraKeys = {
line: cursor.line, line: cursor.line,
ch: ch ch: ch
}; };
if (cm.getOption('indentWithTabs')) if (cm.getOption('indentWithTabs'))
cm.replaceRange(tab, pos, pos, '+input'); cm.replaceRange(tab, pos, pos, '+input');
else else
cm.replaceRange(spaces, pos, pos, '+input'); cm.replaceRange(spaces, pos, pos, '+input');
} else { } else {
if (cm.getOption('indentWithTabs')) if (cm.getOption('indentWithTabs'))
cm.execCommand('defaultTab'); cm.execCommand('defaultTab');
else { else {
cm.replaceSelection(spaces); cm.replaceSelection(spaces);
} }
} }
}, },
"Cmd-Left": "goLineLeftSmart", "Cmd-Left": "goLineLeftSmart",
"Cmd-Right": "goLineRight" "Cmd-Right": "goLineRight"
}; };
@ -370,7 +370,7 @@ function setIndent() {
} }
setUnit(); setUnit();
type.click(function() { type.click(function () {
if (editor.getOption('indentWithTabs')) { if (editor.getOption('indentWithTabs')) {
editor.setOption('indentWithTabs', false); editor.setOption('indentWithTabs', false);
cookieSpaceUnits = parseInt(Cookies.get('space_units')); cookieSpaceUnits = parseInt(Cookies.get('space_units'));
@ -385,9 +385,9 @@ function setIndent() {
} }
} }
setType(); setType();
setUnit(); setUnit();
}); });
widthLabel.click(function() { widthLabel.click(function () {
if (widthLabel.is(':visible')) { if (widthLabel.is(':visible')) {
widthLabel.addClass('hidden'); widthLabel.addClass('hidden');
widthInput.removeClass('hidden'); widthInput.removeClass('hidden');
@ -398,9 +398,9 @@ function setIndent() {
widthInput.addClass('hidden'); widthInput.addClass('hidden');
} }
}); });
widthInput.on('change', function() { widthInput.on('change', function () {
var val = parseInt(widthInput.val()); var val = parseInt(widthInput.val());
if (!val) val = editor.getOption('indentUnit'); if (!val) val = editor.getOption('indentUnit');
if (val < 1) val = 1; if (val < 1) val = 1;
else if (val > 10) val = 10; else if (val > 10) val = 10;
@ -410,7 +410,7 @@ function setIndent() {
editor.setOption('indentUnit', val); editor.setOption('indentUnit', val);
setUnit(); setUnit();
}); });
widthInput.on('blur', function() { widthInput.on('blur', function () {
widthLabel.removeClass('hidden'); widthLabel.removeClass('hidden');
widthInput.addClass('hidden'); widthInput.addClass('hidden');
}); });
@ -435,15 +435,15 @@ function setKeymap() {
} }
setKeymapLabel(); setKeymapLabel();
sublime.click(function() { sublime.click(function () {
editor.setOption('keyMap', 'sublime'); editor.setOption('keyMap', 'sublime');
setKeymapLabel(); setKeymapLabel();
}); });
emacs.click(function() { emacs.click(function () {
editor.setOption('keyMap', 'emacs'); editor.setOption('keyMap', 'emacs');
setKeymapLabel(); setKeymapLabel();
}); });
vim.click(function() { vim.click(function () {
editor.setOption('keyMap', 'vim'); editor.setOption('keyMap', 'vim');
setKeymapLabel(); setKeymapLabel();
}); });
@ -861,22 +861,22 @@ function showStatus(type, num) {
status.html(""); status.html("");
switch (currentStatus) { switch (currentStatus) {
case statusType.connected: case statusType.connected:
label.addClass(statusType.connected.label); label.addClass(statusType.connected.label);
fa.addClass(statusType.connected.fa); fa.addClass(statusType.connected.fa);
msg = statusType.connected.msg; msg = statusType.connected.msg;
break; break;
case statusType.online: case statusType.online:
label.addClass(statusType.online.label); label.addClass(statusType.online.label);
fa.addClass(statusType.online.fa); fa.addClass(statusType.online.fa);
shortMsg = num; shortMsg = num;
msg = num + " " + statusType.online.msg; msg = num + " " + statusType.online.msg;
break; break;
case statusType.offline: case statusType.offline:
label.addClass(statusType.offline.label); label.addClass(statusType.offline.label);
fa.addClass(statusType.offline.fa); fa.addClass(statusType.offline.fa);
msg = statusType.offline.msg; msg = statusType.offline.msg;
break; break;
} }
label.append(fa); label.append(fa);
@ -891,15 +891,15 @@ function showStatus(type, num) {
function toggleMode() { function toggleMode() {
switch (currentMode) { switch (currentMode) {
case modeType.edit: case modeType.edit:
changeMode(modeType.view); changeMode(modeType.view);
break; break;
case modeType.view: case modeType.view:
changeMode(modeType.edit); changeMode(modeType.edit);
break; break;
case modeType.both: case modeType.both:
changeMode(modeType.view); changeMode(modeType.view);
break; break;
} }
} }
@ -920,24 +920,24 @@ function changeMode(type) {
ui.area.view.removeClass(scrollClass); ui.area.view.removeClass(scrollClass);
ui.area.view.removeClass(responsiveClass); ui.area.view.removeClass(responsiveClass);
switch (currentMode) { switch (currentMode) {
case modeType.edit: case modeType.edit:
ui.area.edit.show(); ui.area.edit.show();
ui.area.view.hide(); ui.area.view.hide();
if (!editShown) { if (!editShown) {
editor.refresh(); editor.refresh();
editShown = true; editShown = true;
} }
break; break;
case modeType.view: case modeType.view:
ui.area.edit.hide(); ui.area.edit.hide();
ui.area.view.show(); ui.area.view.show();
break; break;
case modeType.both: case modeType.both:
ui.area.codemirror.addClass(scrollClass); ui.area.codemirror.addClass(scrollClass);
ui.area.edit.addClass(responsiveClass).show(); ui.area.edit.addClass(responsiveClass).show();
ui.area.view.addClass(scrollClass); ui.area.view.addClass(scrollClass);
ui.area.view.show(); ui.area.view.show();
break; break;
} }
if (currentMode == modeType.view) { if (currentMode == modeType.view) {
editor.getInputField().blur(); editor.getInputField().blur();
@ -1054,8 +1054,8 @@ ui.toolbar.publish.attr("href", noteurl + "/publish");
//download //download
//markdown //markdown
ui.toolbar.download.markdown.click(function (e) { ui.toolbar.download.markdown.click(function (e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var filename = renderFilename(ui.area.markdown) + '.md'; var filename = renderFilename(ui.area.markdown) + '.md';
var markdown = editor.getValue(); var markdown = editor.getValue();
var blob = new Blob([markdown], { var blob = new Blob([markdown], {
@ -1065,8 +1065,8 @@ ui.toolbar.download.markdown.click(function (e) {
}); });
//html //html
ui.toolbar.download.html.click(function (e) { ui.toolbar.download.html.click(function (e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
exportToHTML(ui.area.markdown); exportToHTML(ui.area.markdown);
}); });
//export to dropbox //export to dropbox
@ -1096,12 +1096,12 @@ function uploadToGoogleDrive(accessToken) {
var uploader = new MediaUploader({ var uploader = new MediaUploader({
file: blob, file: blob,
token: accessToken, token: accessToken,
onComplete: function(data) { onComplete: function (data) {
data = JSON.parse(data); data = JSON.parse(data);
showMessageModal('<i class="fa fa-cloud-upload"></i> Export to Google Drive', 'Export Complete!', data.alternateLink, 'Click here to view your file', true); showMessageModal('<i class="fa fa-cloud-upload"></i> Export to Google Drive', 'Export Complete!', data.alternateLink, 'Click here to view your file', true);
ui.spinner.hide(); ui.spinner.hide();
}, },
onError: function(data) { onError: function (data) {
var modal = $('.export-modal'); var modal = $('.export-modal');
showMessageModal('<i class="fa fa-cloud-upload"></i> Export to Google Drive', 'Export Error :(', '', data, false); showMessageModal('<i class="fa fa-cloud-upload"></i> Export to Google Drive', 'Export Error :(', '', data, false);
ui.spinner.hide(); ui.spinner.hide();
@ -1111,11 +1111,11 @@ function uploadToGoogleDrive(accessToken) {
} }
function googleApiAuth(immediate, callback) { function googleApiAuth(immediate, callback) {
gapi.auth.authorize( gapi.auth.authorize(
{ {
'client_id': GOOGLE_CLIENT_ID, 'client_id': GOOGLE_CLIENT_ID,
'scope': 'https://www.googleapis.com/auth/drive.file', 'scope': 'https://www.googleapis.com/auth/drive.file',
'immediate': immediate 'immediate': immediate
}, callback ? callback : function() {}); }, callback ? callback : function () { });
} }
function onGoogleClientLoaded() { function onGoogleClientLoaded() {
googleApiAuth(true); googleApiAuth(true);
@ -1127,7 +1127,7 @@ ui.toolbar.export.googleDrive.click(function (e) {
if (token) { if (token) {
uploadToGoogleDrive(token.access_token); uploadToGoogleDrive(token.access_token);
} else { } else {
googleApiAuth(false, function(result) { googleApiAuth(false, function (result) {
uploadToGoogleDrive(result.access_token); uploadToGoogleDrive(result.access_token);
}); });
} }
@ -1155,18 +1155,17 @@ function buildImportFromGoogleDrive() {
apiKey: GOOGLE_API_KEY, apiKey: GOOGLE_API_KEY,
clientId: GOOGLE_CLIENT_ID, clientId: GOOGLE_CLIENT_ID,
buttonEl: ui.toolbar.import.googleDrive, buttonEl: ui.toolbar.import.googleDrive,
onSelect: function(file) { onSelect: function (file) {
if (file.downloadUrl) { if (file.downloadUrl) {
ui.spinner.show(); ui.spinner.show();
var accessToken = gapi.auth.getToken().access_token; var accessToken = gapi.auth.getToken().access_token;
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
beforeSend: function (request) beforeSend: function (request) {
{
request.setRequestHeader('Authorization', 'Bearer ' + accessToken); request.setRequestHeader('Authorization', 'Bearer ' + accessToken);
}, },
url: file.downloadUrl, url: file.downloadUrl,
success: function(data) { success: function (data) {
if (file.fileExtension == 'html') if (file.fileExtension == 'html')
parseToEditor(data); parseToEditor(data);
else else
@ -1270,16 +1269,16 @@ function updateScrollspy() {
headerMap.push($(headers[i]).offset().top - parseInt($(headers[i]).css('margin-top'))); headerMap.push($(headers[i]).offset().top - parseInt($(headers[i]).css('margin-top')));
} }
applyScrollspyActive($(window).scrollTop(), headerMap, headers, applyScrollspyActive($(window).scrollTop(), headerMap, headers,
$('.scrollspy-body'), 0); $('.scrollspy-body'), 0);
var offset = ui.area.view.scrollTop() - ui.area.view.offset().top; var offset = ui.area.view.scrollTop() - ui.area.view.offset().top;
applyScrollspyActive(ui.area.view.scrollTop(), headerMap, headers, applyScrollspyActive(ui.area.view.scrollTop(), headerMap, headers,
$('.scrollspy-view'), offset - 10); $('.scrollspy-view'), offset - 10);
} }
function applyScrollspyActive(top, headerMap, headers, target, offset) { function applyScrollspyActive(top, headerMap, headers, target, offset) {
var index = 0; var index = 0;
for(var i = headerMap.length - 1; i >= 0; i--) { for (var i = headerMap.length - 1; i >= 0; i--) {
if(top >= (headerMap[i] + offset) && headerMap[i + 1] && top < (headerMap[i + 1] + offset)) { if (top >= (headerMap[i] + offset) && headerMap[i + 1] && top < (headerMap[i + 1] + offset)) {
index = i; index = i;
break; break;
} }
@ -1365,9 +1364,9 @@ function replaceAll(data) {
line: 0, line: 0,
ch: 0 ch: 0
}, { }, {
line: editor.lastLine(), line: editor.lastLine(),
ch: editor.lastLine().length ch: editor.lastLine().length
}, '+input'); }, '+input');
} }
function importFromUrl(url) { function importFromUrl(url) {
@ -1458,22 +1457,22 @@ function updatePermission(newPermission) {
var label = null; var label = null;
var title = null; var title = null;
switch (permission) { switch (permission) {
case "freely": case "freely":
label = '<i class="fa fa-leaf"></i> Freely'; label = '<i class="fa fa-leaf"></i> Freely';
title = "Anyone can edit"; title = "Anyone can edit";
break; break;
case "editable": case "editable":
label = '<i class="fa fa-shield"></i> Editable'; label = '<i class="fa fa-shield"></i> Editable';
title = "Signed people can edit"; title = "Signed people can edit";
break; break;
case "locked": case "locked":
label = '<i class="fa fa-lock"></i> Locked'; label = '<i class="fa fa-lock"></i> Locked';
title = "Only owner can edit"; title = "Only owner can edit";
break; break;
case "private": case "private":
label = '<i class="fa fa-hand-stop-o"></i> Private'; label = '<i class="fa fa-hand-stop-o"></i> Private';
title = "Only owner can view & edit"; title = "Only owner can view & edit";
break; break;
} }
if (personalInfo.userid && personalInfo.userid == owner) { if (personalInfo.userid && personalInfo.userid == owner) {
label += ' <i class="fa fa-caret-down"></i>'; label += ' <i class="fa fa-caret-down"></i>';
@ -1487,24 +1486,24 @@ function updatePermission(newPermission) {
function havePermission() { function havePermission() {
var bool = false; var bool = false;
switch (permission) { switch (permission) {
case "freely": case "freely":
bool = true;
break;
case "editable":
if (!personalInfo.login) {
bool = false;
} else {
bool = true; bool = true;
} break;
break; case "editable":
case "locked": if (!personalInfo.login) {
case "private": bool = false;
if (personalInfo.userid != owner) { } else {
bool = false; bool = true;
} else { }
bool = true; break;
} case "locked":
break; case "private":
if (personalInfo.userid != owner) {
bool = false;
} else {
bool = true;
}
break;
} }
return bool; return bool;
} }
@ -1528,15 +1527,15 @@ socket.emit = function () {
socket.on('info', function (data) { socket.on('info', function (data) {
console.error(data); console.error(data);
switch (data.code) { switch (data.code) {
case 403: case 403:
location.href = "./403"; location.href = "./403";
break; break;
case 404: case 404:
location.href = "./404"; location.href = "./404";
break; break;
case 500: case 500:
location.href = "./500"; location.href = "./500";
break; break;
} }
}); });
socket.on('error', function (data) { socket.on('error', function (data) {
@ -2022,18 +2021,18 @@ function buildCursor(user) {
coord.top = coord.top < 0 ? 0 : coord.top; coord.top = coord.top < 0 ? 0 : coord.top;
var iconClass = 'fa-user'; var iconClass = 'fa-user';
switch (user.type) { switch (user.type) {
case 'xs': case 'xs':
iconClass = 'fa-mobile'; iconClass = 'fa-mobile';
break; break;
case 'sm': case 'sm':
iconClass = 'fa-tablet'; iconClass = 'fa-tablet';
break; break;
case 'md': case 'md':
iconClass = 'fa-desktop'; iconClass = 'fa-desktop';
break; break;
case 'lg': case 'lg':
iconClass = 'fa-desktop'; iconClass = 'fa-desktop';
break; break;
} }
if ($('.other-cursors').length <= 0) { if ($('.other-cursors').length <= 0) {
$("<div class='other-cursors'>").insertAfter('.CodeMirror-cursors'); $("<div class='other-cursors'>").insertAfter('.CodeMirror-cursors');
@ -2137,9 +2136,9 @@ function buildCursor(user) {
"left": coord.left, "left": coord.left,
"top": coord.top "top": coord.top
}, { }, {
duration: cursorAnimatePeriod, duration: cursorAnimatePeriod,
queue: false queue: false
}); });
} }
if (user.idle && cursor.css('display') !== 'none') if (user.idle && cursor.css('display') !== 'none')
@ -2181,13 +2180,13 @@ editor.on('beforeChange', function (cm, change) {
if (!havePermission()) { if (!havePermission()) {
change.canceled = true; change.canceled = true;
switch (permission) { switch (permission) {
case "editable": case "editable":
$('.signin-modal').modal('show'); $('.signin-modal').modal('show');
break; break;
case "locked": case "locked":
case "private": case "private":
$('.locked-modal').modal('show'); $('.locked-modal').modal('show');
break; break;
} }
} }
} else { } else {
@ -2199,10 +2198,10 @@ editor.on('beforeChange', function (cm, change) {
if (cmClient && !socket.connected) if (cmClient && !socket.connected)
cmClient.editorAdapter.ignoreNextChange = true; cmClient.editorAdapter.ignoreNextChange = true;
}); });
editor.on('cut', function() { editor.on('cut', function () {
windowResize(); //workaround for scrollMap windowResize(); //workaround for scrollMap
}); });
editor.on('paste', function() { editor.on('paste', function () {
windowResize(); //workaround for scrollMap windowResize(); //workaround for scrollMap
}); });
editor.on('changes', function (cm, changes) { editor.on('changes', function (cm, changes) {
@ -2272,23 +2271,23 @@ function saveInfo() {
var left = $(window).scrollLeft(); var left = $(window).scrollLeft();
var top = $(window).scrollTop(); var top = $(window).scrollTop();
switch (currentMode) { switch (currentMode) {
case modeType.edit: case modeType.edit:
if (scrollbarStyle == 'native') { if (scrollbarStyle == 'native') {
lastInfo.edit.scroll.left = left; lastInfo.edit.scroll.left = left;
lastInfo.edit.scroll.top = top; lastInfo.edit.scroll.top = top;
} else { } else {
lastInfo.edit.scroll = editor.getScrollInfo();
}
break;
case modeType.view:
lastInfo.view.scroll.left = left;
lastInfo.view.scroll.top = top;
break;
case modeType.both:
lastInfo.edit.scroll = editor.getScrollInfo(); lastInfo.edit.scroll = editor.getScrollInfo();
} lastInfo.view.scroll.left = ui.area.view.scrollLeft();
break; lastInfo.view.scroll.top = ui.area.view.scrollTop();
case modeType.view: break;
lastInfo.view.scroll.left = left;
lastInfo.view.scroll.top = top;
break;
case modeType.both:
lastInfo.edit.scroll = editor.getScrollInfo();
lastInfo.view.scroll.left = ui.area.view.scrollLeft();
lastInfo.view.scroll.top = ui.area.view.scrollTop();
break;
} }
lastInfo.edit.cursor = editor.getCursor(); lastInfo.edit.cursor = editor.getCursor();
lastInfo.needRestore = true; lastInfo.needRestore = true;
@ -2301,29 +2300,29 @@ function restoreInfo() {
var ch = lastInfo.edit.cursor.ch; var ch = lastInfo.edit.cursor.ch;
editor.setCursor(line, ch); editor.setCursor(line, ch);
switch (currentMode) { switch (currentMode) {
case modeType.edit: case modeType.edit:
if (scrollbarStyle == 'native') { if (scrollbarStyle == 'native') {
$(window).scrollLeft(lastInfo.edit.scroll.left); $(window).scrollLeft(lastInfo.edit.scroll.left);
$(window).scrollTop(lastInfo.edit.scroll.top); $(window).scrollTop(lastInfo.edit.scroll.top);
} else { } else {
var left = lastInfo.edit.scroll.left;
var top = lastInfo.edit.scroll.top;
editor.scrollIntoView();
editor.scrollTo(left, top);
}
break;
case modeType.view:
$(window).scrollLeft(lastInfo.view.scroll.left);
$(window).scrollTop(lastInfo.view.scroll.top);
break;
case modeType.both:
var left = lastInfo.edit.scroll.left; var left = lastInfo.edit.scroll.left;
var top = lastInfo.edit.scroll.top; var top = lastInfo.edit.scroll.top;
editor.scrollIntoView(); editor.scrollIntoView();
editor.scrollTo(left, top); editor.scrollTo(left, top);
} ui.area.view.scrollLeft(lastInfo.view.scroll.left);
break; ui.area.view.scrollTop(lastInfo.view.scroll.top);
case modeType.view: break;
$(window).scrollLeft(lastInfo.view.scroll.left);
$(window).scrollTop(lastInfo.view.scroll.top);
break;
case modeType.both:
var left = lastInfo.edit.scroll.left;
var top = lastInfo.edit.scroll.top;
editor.scrollIntoView();
editor.scrollTo(left, top);
ui.area.view.scrollLeft(lastInfo.view.scroll.left);
ui.area.view.scrollTop(lastInfo.view.scroll.top);
break;
} }
lastInfo.needRestore = false; lastInfo.needRestore = false;
@ -2705,11 +2704,11 @@ $(editor.getInputField())
var list = []; var list = [];
$.map(emojify.emojiNames, function (emoji) { $.map(emojify.emojiNames, function (emoji) {
if (emoji.indexOf(term) === 0) //match at first character if (emoji.indexOf(term) === 0) //match at first character
list.push(emoji); list.push(emoji);
}); });
$.map(emojify.emojiNames, function (emoji) { $.map(emojify.emojiNames, function (emoji) {
if (emoji.indexOf(term) !== -1) //match inside the word if (emoji.indexOf(term) !== -1) //match inside the word
list.push(emoji); list.push(emoji);
}); });
callback(list); callback(list);
}, },
@ -2726,7 +2725,7 @@ $(editor.getInputField())
checkInContainerSyntax(); checkInContainerSyntax();
return !isInCode && !isInContainerSyntax; return !isInCode && !isInContainerSyntax;
} }
}, },
{ // Code block language strategy { // Code block language strategy
langs: supportCodeModes, langs: supportCodeModes,
charts: supportCharts, charts: supportCharts,
@ -2768,7 +2767,7 @@ $(editor.getInputField())
context: function (text) { context: function (text) {
return isInCode; return isInCode;
} }
}, },
{ // Container strategy { // Container strategy
containers: supportContainers, containers: supportContainers,
match: /(^|\n):::(\s*)(\w*)$/, match: /(^|\n):::(\s*)(\w*)$/,
@ -2804,7 +2803,7 @@ $(editor.getInputField())
context: function (text) { context: function (text) {
return !isInCode && isInContainer; return !isInCode && isInContainer;
} }
}, },
{ //header { //header
match: /(?:^|\n)(\s{0,3})(#{1,6}\w*)$/, match: /(?:^|\n)(\s{0,3})(#{1,6}\w*)$/,
search: function (term, callback) { search: function (term, callback) {
@ -2818,7 +2817,7 @@ $(editor.getInputField())
context: function (text) { context: function (text) {
return !isInCode; return !isInCode;
} }
}, },
{ //extra tags for blockquote { //extra tags for blockquote
match: /(?:^|\n|\s)(\>.*)(\[\])(\w*)$/, match: /(?:^|\n|\s)(\>.*)(\[\])(\w*)$/,
search: function (term, callback) { search: function (term, callback) {
@ -2839,7 +2838,7 @@ $(editor.getInputField())
context: function (text) { context: function (text) {
return !isInCode; return !isInCode;
} }
}, },
{ //extra tags for list { //extra tags for list
match: /(^[>\s]*[\-\+\*]\s(?:\[[x ]\]|.*))(\[\])(\w*)$/, match: /(^[>\s]*[\-\+\*]\s(?:\[[x ]\]|.*))(\[\])(\w*)$/,
search: function (term, callback) { search: function (term, callback) {
@ -2860,7 +2859,7 @@ $(editor.getInputField())
context: function (text) { context: function (text) {
return !isInCode; return !isInCode;
} }
}, },
{ //referral { //referral
match: /(^|\n|\s)(\!|\!|\[\])(\w*)$/, match: /(^|\n|\s)(\!|\!|\[\])(\w*)$/,
search: function (term, callback) { search: function (term, callback) {
@ -2874,7 +2873,7 @@ $(editor.getInputField())
context: function (text) { context: function (text) {
return !isInCode; return !isInCode;
} }
}, },
{ //externals { //externals
match: /(^|\n|\s)\{\}(\w*)$/, match: /(^|\n|\s)\{\}(\w*)$/,
search: function (term, callback) { search: function (term, callback) {
@ -2888,8 +2887,8 @@ $(editor.getInputField())
context: function (text) { context: function (text) {
return !isInCode; return !isInCode;
} }
} }
], { ], {
appendTo: $('.cursor-menu') appendTo: $('.cursor-menu')
}) })
.on({ .on({