Browse Source

Set indent style to 4 spaces

tags/2.0.0
Jeroen Akkerman 1 year ago
parent
commit
de26368ad1
12 changed files with 9135 additions and 9133 deletions
  1. 6
    0
      .editorconfig
  2. 18
    22
      .eslintrc
  3. 2
    3
      .gitignore
  4. 4
    3
      debug/simplemde.css
  5. 1635
    1635
      debug/simplemde.debug.js
  6. 1634
    1634
      debug/simplemde.js
  7. 63
    63
      gulpfile.js
  8. 3998
    3998
      package-lock.json
  9. 38
    38
      package.json
  10. 4
    4
      src/css/simplemde.css
  11. 30
    30
      src/js/codemirror/tablist.js
  12. 1703
    1703
      src/js/simplemde.js

+ 6
- 0
.editorconfig View File

@@ -0,0 +1,6 @@
[*]
charset=utf-8
end_of_line=lf
insert_final_newline=true
indent_style=space
indent_size=4

+ 18
- 22
.eslintrc View File

@@ -1,23 +1,19 @@
{
"rules": {
"indent": [
2,
"tab"
],
"strict": 0,
"no-console": 0,
"quotes": [
2,
"double"
],
"semi": [
2,
"always"
]
},
"env": {
"browser": true,
"node":true
},
"extends": "eslint:recommended"
}
"rules": {
"strict": 0,
"no-console": 0,
"quotes": [
2,
"double"
],
"semi": [
2,
"always"
]
},
"env": {
"browser": true,
"node": true
},
"extends": "eslint:recommended"
}

+ 2
- 3
.gitignore View File

@@ -1,8 +1,7 @@
localtesting/
# NPM files
node_modules/
bower_components/

#For IDE
# IDE files
*.iml
*.ipr
*.iws

+ 4
- 3
debug/simplemde.css View File

@@ -465,7 +465,7 @@ span.CodeMirror-selectedtext { background: none; }
background: transparent;
display: inline-block;
text-align: center;
text-decoration: none!important;
text-decoration: none !important;
width: 30px;
height: 30px;
margin: 0;
@@ -600,8 +600,8 @@ span.CodeMirror-selectedtext { background: none; }
display: block
}

.editor-preview>p,
.editor-preview-side>p {
.editor-preview > p,
.editor-preview-side > p {
margin-top: 0
}

@@ -675,6 +675,7 @@ span.CodeMirror-selectedtext { background: none; }
.CodeMirror .CodeMirror-placeholder {
opacity: .5;
}

.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word) {
background: rgba(255, 0, 0, .15);
}

+ 1635
- 1635
debug/simplemde.debug.js
File diff suppressed because it is too large
View File


+ 1634
- 1634
debug/simplemde.js
File diff suppressed because it is too large
View File


+ 63
- 63
gulpfile.js View File

@@ -1,83 +1,83 @@
"use strict";

var gulp = require("gulp"),
minifycss = require("gulp-clean-css"),
uglify = require("gulp-uglify"),
concat = require("gulp-concat"),
header = require("gulp-header"),
buffer = require("vinyl-buffer"),
pkg = require("./package.json"),
debug = require("gulp-debug"),
eslint = require("gulp-eslint"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
rename = require("gulp-rename");
minifycss = require("gulp-clean-css"),
uglify = require("gulp-uglify"),
concat = require("gulp-concat"),
header = require("gulp-header"),
buffer = require("vinyl-buffer"),
pkg = require("./package.json"),
debug = require("gulp-debug"),
eslint = require("gulp-eslint"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
rename = require("gulp-rename");

var banner = ["/**",
" * <%= pkg.name %> v<%= pkg.version %>",
" * Copyright <%= pkg.author %>",
" * @link <%= pkg.repository.url %>",
" * @license <%= pkg.license %>",
" */",
""].join("\n");
" * <%= pkg.name %> v<%= pkg.version %>",
" * Copyright <%= pkg.author %>",
" * @link <%= pkg.repository.url %>",
" * @license <%= pkg.license %>",
" */",
""].join("\n");

gulp.task("lint", function() {
gulp.src("./src/js/**/*.js")
.pipe(debug())
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
gulp.task("lint", function () {
gulp.src("./src/js/**/*.js")
.pipe(debug())
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});

function taskBrowserify(opts) {
return browserify("./src/js/simplemde.js", opts)
.bundle();
return browserify("./src/js/simplemde.js", opts)
.bundle();
}

gulp.task("browserify:debug", ["lint"], function() {
return taskBrowserify({debug:true, standalone:"SimpleMDE"})
.pipe(source("simplemde.debug.js"))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./debug/"));
gulp.task("browserify:debug", ["lint"], function () {
return taskBrowserify({debug: true, standalone: "SimpleMDE"})
.pipe(source("simplemde.debug.js"))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./debug/"));
});

gulp.task("browserify", ["lint"], function() {
return taskBrowserify({standalone:"SimpleMDE"})
.pipe(source("simplemde.js"))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./debug/"));
gulp.task("browserify", ["lint"], function () {
return taskBrowserify({standalone: "SimpleMDE"})
.pipe(source("simplemde.js"))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./debug/"));
});

gulp.task("scripts", ["browserify:debug", "browserify", "lint"], function() {
var js_files = ["./debug/simplemde.js"];
return gulp.src(js_files)
.pipe(concat("simplemde.min.js"))
.pipe(uglify())
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./dist/"));
gulp.task("scripts", ["browserify:debug", "browserify", "lint"], function () {
var js_files = ["./debug/simplemde.js"];
return gulp.src(js_files)
.pipe(concat("simplemde.min.js"))
.pipe(uglify())
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./dist/"));
});

gulp.task("styles", function() {
var css_files = [
"./node_modules/codemirror/lib/codemirror.css",
"./src/css/*.css",
"./node_modules/codemirror-spell-checker/src/css/spell-checker.css"
];
return gulp.src(css_files)
.pipe(concat("simplemde.css"))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./debug/"))
.pipe(minifycss())
.pipe(rename("simplemde.min.css"))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./dist/"));
gulp.task("styles", function () {
var css_files = [
"./node_modules/codemirror/lib/codemirror.css",
"./src/css/*.css",
"./node_modules/codemirror-spell-checker/src/css/spell-checker.css"
];
return gulp.src(css_files)
.pipe(concat("simplemde.css"))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./debug/"))
.pipe(minifycss())
.pipe(rename("simplemde.min.css"))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./dist/"));
});

gulp.task("default", ["scripts", "styles"]);

+ 3998
- 3998
package-lock.json
File diff suppressed because it is too large
View File


+ 38
- 38
package.json View File

@@ -1,40 +1,40 @@
{
"name": "simplemde",
"version": "1.11.2",
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor. Features autosaving and spell checking.",
"keywords": [
"embeddable",
"markdown",
"editor",
"javascript",
"fontawesome"
],
"main": "./src/js/simplemde.js",
"license": "MIT",
"author": "Jeroen Akkerman",
"bugs": {
"url": "https://github.com/ionaru/simplemde-markdown-editor/issues"
},
"dependencies": {
"codemirror": "^5.32.0",
"codemirror-spell-checker": "^1.1.2",
"marked": "^0.3.7"
},
"devDependencies": {
"browserify": "^14.5.0",
"gulp": "^3.9.1",
"gulp-clean-css": "^3.9.0",
"gulp-concat": "^2.6.1",
"gulp-debug": "^3.1.0",
"gulp-eslint": "^4.0.0",
"gulp-header": "^1.8.9",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^3.0.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
},
"repository": {
"type": "git",
"url": "https://github.com/ionaru/simplemde-markdown-editor"
}
"name": "simplemde",
"version": "1.11.2",
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor. Features autosaving and spell checking.",
"keywords": [
"embeddable",
"markdown",
"editor",
"javascript",
"fontawesome"
],
"main": "./src/js/simplemde.js",
"license": "MIT",
"author": "Jeroen Akkerman",
"bugs": {
"url": "https://github.com/ionaru/simplemde-markdown-editor/issues"
},
"dependencies": {
"codemirror": "^5.32.0",
"codemirror-spell-checker": "^1.1.2",
"marked": "^0.3.7"
},
"devDependencies": {
"browserify": "^14.5.0",
"gulp": "^3.9.1",
"gulp-clean-css": "^3.9.0",
"gulp-concat": "^2.6.1",
"gulp-debug": "^3.1.0",
"gulp-eslint": "^4.0.0",
"gulp-header": "^1.8.9",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^3.0.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
},
"repository": {
"type": "git",
"url": "https://github.com/ionaru/simplemde-markdown-editor"
}
}

+ 4
- 4
src/css/simplemde.css View File

@@ -112,7 +112,7 @@
background: transparent;
display: inline-block;
text-align: center;
text-decoration: none!important;
text-decoration: none !important;
width: 30px;
height: 30px;
margin: 0;
@@ -247,8 +247,8 @@
display: block
}

.editor-preview>p,
.editor-preview-side>p {
.editor-preview > p,
.editor-preview-side > p {
margin-top: 0
}

@@ -321,4 +321,4 @@

.CodeMirror .CodeMirror-placeholder {
opacity: .5;
}
}

+ 30
- 30
src/js/codemirror/tablist.js View File

@@ -4,41 +4,41 @@
var CodeMirror = require("codemirror");

CodeMirror.commands.tabAndIndentMarkdownList = function (cm) {
var ranges = cm.listSelections();
var pos = ranges[0].head;
var eolState = cm.getStateAfter(pos.line);
var inList = eolState.list !== false;
var ranges = cm.listSelections();
var pos = ranges[0].head;
var eolState = cm.getStateAfter(pos.line);
var inList = eolState.list !== false;

if (inList) {
cm.execCommand("indentMore");
return;
}
if (inList) {
cm.execCommand("indentMore");
return;
}

if (cm.options.indentWithTabs) {
cm.execCommand("insertTab");
}
else {
var spaces = Array(cm.options.tabSize + 1).join(" ");
cm.replaceSelection(spaces);
}
if (cm.options.indentWithTabs) {
cm.execCommand("insertTab");
}
else {
var spaces = Array(cm.options.tabSize + 1).join(" ");
cm.replaceSelection(spaces);
}
};

CodeMirror.commands.shiftTabAndUnindentMarkdownList = function (cm) {
var ranges = cm.listSelections();
var pos = ranges[0].head;
var eolState = cm.getStateAfter(pos.line);
var inList = eolState.list !== false;
var ranges = cm.listSelections();
var pos = ranges[0].head;
var eolState = cm.getStateAfter(pos.line);
var inList = eolState.list !== false;

if (inList) {
cm.execCommand("indentLess");
return;
}
if (inList) {
cm.execCommand("indentLess");
return;
}

if (cm.options.indentWithTabs) {
cm.execCommand("insertTab");
}
else {
var spaces = Array(cm.options.tabSize + 1).join(" ");
cm.replaceSelection(spaces);
}
if (cm.options.indentWithTabs) {
cm.execCommand("insertTab");
}
else {
var spaces = Array(cm.options.tabSize + 1).join(" ");
cm.replaceSelection(spaces);
}
};

+ 1703
- 1703
src/js/simplemde.js
File diff suppressed because it is too large
View File


Loading…
Cancel
Save