From f1b6a42561240323d700595b6a80a3c1f970864e Mon Sep 17 00:00:00 2001 From: Jeroen Akkerman Date: Thu, 18 Jul 2019 12:00:32 +0200 Subject: [PATCH] Auto-format of the code --- src/js/easymde.js | 84 ++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/src/js/easymde.js b/src/js/easymde.js index f2e338c..055057c 100644 --- a/src/js/easymde.js +++ b/src/js/easymde.js @@ -122,8 +122,8 @@ function createToolbarButton(options, enableTooltips, shortcuts) { enableTooltips = (enableTooltips == undefined) ? true : enableTooltips; // Properly hande custom shortcuts - if( options.name && options.name in shortcuts ){ - bindings[options.name] = options.action; + if (options.name && options.name in shortcuts) { + bindings[options.name] = options.action; } if (options.title && enableTooltips) { @@ -284,7 +284,7 @@ function toggleFullScreen(editor) { if (/editor-preview-active-side/.test(sidebyside.className)) toggleSideBySide(editor); - if (editor.options.onToggleFullScreen) { + if (editor.options.onToggleFullScreen) { editor.options.onToggleFullScreen(cm.getOption('fullScreen') || false); } } @@ -729,7 +729,7 @@ function afterImageUploaded(editor, url) { _replaceSelection(cm, stat.image, options.insertTexts.uploadedImage, url); // show uploaded image filename for 1000ms editor.updateStatusBar('upload-image', editor.options.imageTexts.sbOnUploaded.replace('#image_name#', imageName)); - setTimeout(function() { + setTimeout(function () { editor.updateStatusBar('upload-image', editor.options.imageTexts.sbInit); }, 1000); } @@ -1044,7 +1044,7 @@ function _toggleLine(cm, name) { char = ''; } text = arr[1] + char + arr[3] + text.replace(whitespacesRegexp, '').replace(repl[name], '$1'); - } else if (untoggleOnly == false){ + } else if (untoggleOnly == false) { text = char + ' ' + text; } return text; @@ -1176,14 +1176,14 @@ function _cleanBlock(cm) { * @returns string A human-readable file size. Ex: '412Kb' */ function humanFileSize(bytes, units) { - if(Math.abs(bytes) < 1024) { + if (Math.abs(bytes) < 1024) { return '' + bytes + units[0]; } var u = 0; do { bytes /= 1024; ++u; - } while(Math.abs(bytes) >= 1024 && u < units.length); + } while (Math.abs(bytes) >= 1024 && u < units.length); return '' + bytes.toFixed(1) + units[u]; } @@ -1580,13 +1580,13 @@ function EasyMDE(options) { options.minHeight = options.minHeight || '300px'; - options.errorCallback = options.errorCallback || function(errorMessage) { - alert(errorMessage); + options.errorCallback = options.errorCallback || function (errorMessage) { + alert(errorMessage); }; // Import-image default configuration options.uploadImage = options.uploadImage || false; - options.imageMaxSize = options.imageMaxSize || 1024*1024*2; + options.imageMaxSize = options.imageMaxSize || 1024 * 1024 * 2; options.imageAccept = options.imageAccept || 'image/png, image/jpeg'; options.imageTexts = extend({}, imageTexts, options.imageTexts || {}); options.errorMessages = extend({}, errorMessages, options.errorMessages || {}); @@ -1615,35 +1615,35 @@ function EasyMDE(options) { if (options.uploadImage) { var self = this; - this.codemirror.on('dragenter', function(cm, event) { + this.codemirror.on('dragenter', function (cm, event) { self.updateStatusBar('upload-image', self.options.imageTexts.sbOnDragEnter); event.stopPropagation(); event.preventDefault(); }); - this.codemirror.on('dragend', function(cm, event) { + this.codemirror.on('dragend', function (cm, event) { self.updateStatusBar('upload-image', self.options.imageTexts.sbInit); event.stopPropagation(); event.preventDefault(); }); - this.codemirror.on('dragleave', function(cm, event) { + this.codemirror.on('dragleave', function (cm, event) { self.updateStatusBar('upload-image', self.options.imageTexts.sbInit); event.stopPropagation(); event.preventDefault(); }); - this.codemirror.on('dragover', function(cm, event) { + this.codemirror.on('dragover', function (cm, event) { self.updateStatusBar('upload-image', self.options.imageTexts.sbOnDragEnter); event.stopPropagation(); event.preventDefault(); }); - this.codemirror.on('drop', function(cm, event) { + this.codemirror.on('drop', function (cm, event) { event.stopPropagation(); event.preventDefault(); self.uploadImages(event.dataTransfer.files); }); - this.codemirror.on('paste', function(cm, event) { + this.codemirror.on('paste', function (cm, event) { self.uploadImages(event.clipboardData.files); }); } @@ -1660,9 +1660,9 @@ function EasyMDE(options) { * @param [onSuccess] {function} see EasyMDE.prototype.uploadImage * @param [onError] {function} see EasyMDE.prototype.uploadImage */ -EasyMDE.prototype.uploadImages = function(files, onSuccess, onError) { +EasyMDE.prototype.uploadImages = function (files, onSuccess, onError) { var names = []; - for(var i=0; i