Fix code styles
This commit is contained in:
parent
0bb3e53d58
commit
efb188c9c1
1 changed files with 212 additions and 213 deletions
|
@ -4,9 +4,9 @@ var defaultExtraKeys = {
|
|||
"F10": function (cm) {
|
||||
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
|
||||
},
|
||||
"Esc": function(cm) {
|
||||
"Esc": function (cm) {
|
||||
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 () {
|
||||
return CodeMirror.Pass
|
||||
|
@ -15,7 +15,7 @@ var defaultExtraKeys = {
|
|||
return CodeMirror.Pass
|
||||
},
|
||||
"Enter": "newlineAndIndentContinueMarkdownList",
|
||||
"Tab": function(cm) {
|
||||
"Tab": function (cm) {
|
||||
var tab = '\t';
|
||||
var spaces = Array(parseInt(cm.getOption("indentUnit")) + 1).join(" ");
|
||||
//auto indent whole line when in list or blockquote
|
||||
|
@ -370,7 +370,7 @@ function setIndent() {
|
|||
}
|
||||
setUnit();
|
||||
|
||||
type.click(function() {
|
||||
type.click(function () {
|
||||
if (editor.getOption('indentWithTabs')) {
|
||||
editor.setOption('indentWithTabs', false);
|
||||
cookieSpaceUnits = parseInt(Cookies.get('space_units'));
|
||||
|
@ -387,7 +387,7 @@ function setIndent() {
|
|||
setType();
|
||||
setUnit();
|
||||
});
|
||||
widthLabel.click(function() {
|
||||
widthLabel.click(function () {
|
||||
if (widthLabel.is(':visible')) {
|
||||
widthLabel.addClass('hidden');
|
||||
widthInput.removeClass('hidden');
|
||||
|
@ -398,7 +398,7 @@ function setIndent() {
|
|||
widthInput.addClass('hidden');
|
||||
}
|
||||
});
|
||||
widthInput.on('change', function() {
|
||||
widthInput.on('change', function () {
|
||||
var val = parseInt(widthInput.val());
|
||||
if (!val) val = editor.getOption('indentUnit');
|
||||
if (val < 1) val = 1;
|
||||
|
@ -410,7 +410,7 @@ function setIndent() {
|
|||
editor.setOption('indentUnit', val);
|
||||
setUnit();
|
||||
});
|
||||
widthInput.on('blur', function() {
|
||||
widthInput.on('blur', function () {
|
||||
widthLabel.removeClass('hidden');
|
||||
widthInput.addClass('hidden');
|
||||
});
|
||||
|
@ -435,15 +435,15 @@ function setKeymap() {
|
|||
}
|
||||
setKeymapLabel();
|
||||
|
||||
sublime.click(function() {
|
||||
sublime.click(function () {
|
||||
editor.setOption('keyMap', 'sublime');
|
||||
setKeymapLabel();
|
||||
});
|
||||
emacs.click(function() {
|
||||
emacs.click(function () {
|
||||
editor.setOption('keyMap', 'emacs');
|
||||
setKeymapLabel();
|
||||
});
|
||||
vim.click(function() {
|
||||
vim.click(function () {
|
||||
editor.setOption('keyMap', 'vim');
|
||||
setKeymapLabel();
|
||||
});
|
||||
|
@ -1096,12 +1096,12 @@ function uploadToGoogleDrive(accessToken) {
|
|||
var uploader = new MediaUploader({
|
||||
file: blob,
|
||||
token: accessToken,
|
||||
onComplete: function(data) {
|
||||
onComplete: function (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);
|
||||
ui.spinner.hide();
|
||||
},
|
||||
onError: function(data) {
|
||||
onError: function (data) {
|
||||
var modal = $('.export-modal');
|
||||
showMessageModal('<i class="fa fa-cloud-upload"></i> Export to Google Drive', 'Export Error :(', '', data, false);
|
||||
ui.spinner.hide();
|
||||
|
@ -1115,7 +1115,7 @@ function googleApiAuth(immediate, callback) {
|
|||
'client_id': GOOGLE_CLIENT_ID,
|
||||
'scope': 'https://www.googleapis.com/auth/drive.file',
|
||||
'immediate': immediate
|
||||
}, callback ? callback : function() {});
|
||||
}, callback ? callback : function () { });
|
||||
}
|
||||
function onGoogleClientLoaded() {
|
||||
googleApiAuth(true);
|
||||
|
@ -1127,7 +1127,7 @@ ui.toolbar.export.googleDrive.click(function (e) {
|
|||
if (token) {
|
||||
uploadToGoogleDrive(token.access_token);
|
||||
} else {
|
||||
googleApiAuth(false, function(result) {
|
||||
googleApiAuth(false, function (result) {
|
||||
uploadToGoogleDrive(result.access_token);
|
||||
});
|
||||
}
|
||||
|
@ -1155,18 +1155,17 @@ function buildImportFromGoogleDrive() {
|
|||
apiKey: GOOGLE_API_KEY,
|
||||
clientId: GOOGLE_CLIENT_ID,
|
||||
buttonEl: ui.toolbar.import.googleDrive,
|
||||
onSelect: function(file) {
|
||||
onSelect: function (file) {
|
||||
if (file.downloadUrl) {
|
||||
ui.spinner.show();
|
||||
var accessToken = gapi.auth.getToken().access_token;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
beforeSend: function (request)
|
||||
{
|
||||
beforeSend: function (request) {
|
||||
request.setRequestHeader('Authorization', 'Bearer ' + accessToken);
|
||||
},
|
||||
url: file.downloadUrl,
|
||||
success: function(data) {
|
||||
success: function (data) {
|
||||
if (file.fileExtension == 'html')
|
||||
parseToEditor(data);
|
||||
else
|
||||
|
@ -1278,8 +1277,8 @@ function updateScrollspy() {
|
|||
|
||||
function applyScrollspyActive(top, headerMap, headers, target, offset) {
|
||||
var index = 0;
|
||||
for(var i = headerMap.length - 1; i >= 0; i--) {
|
||||
if(top >= (headerMap[i] + offset) && headerMap[i + 1] && top < (headerMap[i + 1] + offset)) {
|
||||
for (var i = headerMap.length - 1; i >= 0; i--) {
|
||||
if (top >= (headerMap[i] + offset) && headerMap[i + 1] && top < (headerMap[i + 1] + offset)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
|
@ -2199,10 +2198,10 @@ editor.on('beforeChange', function (cm, change) {
|
|||
if (cmClient && !socket.connected)
|
||||
cmClient.editorAdapter.ignoreNextChange = true;
|
||||
});
|
||||
editor.on('cut', function() {
|
||||
editor.on('cut', function () {
|
||||
windowResize(); //workaround for scrollMap
|
||||
});
|
||||
editor.on('paste', function() {
|
||||
editor.on('paste', function () {
|
||||
windowResize(); //workaround for scrollMap
|
||||
});
|
||||
editor.on('changes', function (cm, changes) {
|
||||
|
@ -2889,7 +2888,7 @@ $(editor.getInputField())
|
|||
return !isInCode;
|
||||
}
|
||||
}
|
||||
], {
|
||||
], {
|
||||
appendTo: $('.cursor-menu')
|
||||
})
|
||||
.on({
|
||||
|
|
Loading…
Add table
Reference in a new issue