Merge pull request #107 from NextStepWebs/development
Custom preview rendering, Loads of bug fixespull/75/head 1.7.1
commit
57fcf521a0
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,61 +1,112 @@
|
|||||||
var gulp = require('gulp'),
|
var gulp = require("gulp"),
|
||||||
minifycss = require('gulp-minify-css'),
|
minifycss = require("gulp-minify-css"),
|
||||||
uglify = require('gulp-uglify'),
|
uglify = require("gulp-uglify"),
|
||||||
concat = require('gulp-concat'),
|
concat = require("gulp-concat"),
|
||||||
header = require('gulp-header'),
|
header = require("gulp-header"),
|
||||||
pkg = require('./package.json'),
|
pkg = require("./package.json"),
|
||||||
prettify = require('gulp-jsbeautifier');
|
prettify = require("gulp-jsbeautifier"),
|
||||||
|
download = require("gulp-download");
|
||||||
var banner = ['/**',
|
|
||||||
' * <%= pkg.name %> v<%= pkg.version %>',
|
var banner = ["/**",
|
||||||
' * Copyright <%= pkg.company %>',
|
" * <%= pkg.name %> v<%= pkg.version %>",
|
||||||
' * @link <%= pkg.homepage %>',
|
" * Copyright <%= pkg.company %>",
|
||||||
' * @license <%= pkg.license %>',
|
" * @link <%= pkg.homepage %>",
|
||||||
' */',
|
" * @license <%= pkg.license %>",
|
||||||
''].join('\n');
|
" */",
|
||||||
|
""].join("\n");
|
||||||
gulp.task('scripts', function() {
|
|
||||||
|
gulp.task("downloads-codemirror", function(callback) {
|
||||||
|
var download_urls = [
|
||||||
|
"https://raw.githubusercontent.com/codemirror/CodeMirror/master/lib/codemirror.js",
|
||||||
|
"https://raw.githubusercontent.com/codemirror/CodeMirror/master/addon/edit/continuelist.js",
|
||||||
|
//"https://raw.githubusercontent.com/codemirror/CodeMirror/master/addon/edit/tablist.js", //waiting for PRs
|
||||||
|
"https://raw.githubusercontent.com/codemirror/CodeMirror/master/addon/display/fullscreen.js",
|
||||||
|
"https://raw.githubusercontent.com/codemirror/CodeMirror/master/addon/mode/overlay.js",
|
||||||
|
//"https://raw.githubusercontent.com/codemirror/CodeMirror/master/mode/gfm/gfm.js", //waiting for PRs
|
||||||
|
"https://raw.githubusercontent.com/codemirror/CodeMirror/master/mode/markdown/markdown.js",
|
||||||
|
"https://raw.githubusercontent.com/codemirror/CodeMirror/master/mode/xml/xml.js"];
|
||||||
|
|
||||||
|
download(download_urls)
|
||||||
|
.pipe(gulp.dest("src/js/codemirror/"));
|
||||||
|
|
||||||
|
// Wait to make sure they've been downloaded
|
||||||
|
setTimeout(function() {
|
||||||
|
callback();
|
||||||
|
}, 5000);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task("downloads-js", function(callback) {
|
||||||
|
var download_urls = [
|
||||||
|
"https://raw.githubusercontent.com/chjj/marked/master/lib/marked.js",
|
||||||
|
"https://raw.githubusercontent.com/NextStepWebs/codemirror-spell-checker/master/src/js/spell-checker.js",
|
||||||
|
"https://raw.githubusercontent.com/NextStepWebs/codemirror-spell-checker/master/src/js/typo.js"];
|
||||||
|
|
||||||
|
download(download_urls)
|
||||||
|
.pipe(gulp.dest("src/js/"));
|
||||||
|
|
||||||
|
// Wait to make sure they've been downloaded
|
||||||
|
setTimeout(function() {
|
||||||
|
callback();
|
||||||
|
}, 5000);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task("downloads-css", function(callback) {
|
||||||
|
var download_urls = [
|
||||||
|
"https://raw.githubusercontent.com/codemirror/CodeMirror/master/lib/codemirror.css",
|
||||||
|
"https://raw.githubusercontent.com/NextStepWebs/codemirror-spell-checker/master/src/css/spell-checker.css"];
|
||||||
|
|
||||||
|
download(download_urls)
|
||||||
|
.pipe(gulp.dest("src/css/"));
|
||||||
|
|
||||||
|
// Wait to make sure they've been downloaded
|
||||||
|
setTimeout(function() {
|
||||||
|
callback();
|
||||||
|
}, 5000);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task("scripts", ["downloads-codemirror", "downloads-js", "downloads-css"], function() {
|
||||||
var js_files = [
|
var js_files = [
|
||||||
'./src/js/codemirror/codemirror.js',
|
"./src/js/codemirror/codemirror.js",
|
||||||
'./src/js/codemirror/continuelist.js',
|
"./src/js/codemirror/continuelist.js",
|
||||||
'./src/js/codemirror/fullscreen.js',
|
"./src/js/codemirror/tablist.js",
|
||||||
'./src/js/codemirror/markdown.js',
|
"./src/js/codemirror/fullscreen.js",
|
||||||
'./src/js/codemirror/overlay.js',
|
"./src/js/codemirror/markdown.js",
|
||||||
'./src/js/codemirror/gfm.js',
|
"./src/js/codemirror/overlay.js",
|
||||||
'./src/js/codemirror/xml.js',
|
"./src/js/codemirror/gfm.js",
|
||||||
'./src/js/typo.js',
|
"./src/js/codemirror/xml.js",
|
||||||
'./src/js/spell-checker.js',
|
"./src/js/typo.js",
|
||||||
'./src/js/marked.js',
|
"./src/js/spell-checker.js",
|
||||||
'./src/js/simplemde.js'];
|
"./src/js/marked.js",
|
||||||
|
"./src/js/simplemde.js"];
|
||||||
|
|
||||||
return gulp.src(js_files)
|
return gulp.src(js_files)
|
||||||
.pipe(header(banner, {pkg: pkg}))
|
.pipe(header(banner, {pkg: pkg}))
|
||||||
.pipe(concat('simplemde.min.js'))
|
.pipe(concat("simplemde.min.js"))
|
||||||
.pipe(gulp.dest('dist'))
|
.pipe(gulp.dest("dist"))
|
||||||
.pipe(uglify())
|
.pipe(uglify())
|
||||||
.pipe(header(banner, {pkg: pkg}))
|
.pipe(header(banner, {pkg: pkg}))
|
||||||
.pipe(gulp.dest('dist'));
|
.pipe(gulp.dest("dist"));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('styles', function() {
|
gulp.task("styles", ["downloads-codemirror", "downloads-js", "downloads-css"], function() {
|
||||||
return gulp.src('./src/css/*.css')
|
return gulp.src("./src/css/*.css")
|
||||||
.pipe(concat('simplemde.min.css'))
|
.pipe(concat("simplemde.min.css"))
|
||||||
.pipe(gulp.dest('dist'))
|
.pipe(gulp.dest("dist"))
|
||||||
.pipe(minifycss())
|
.pipe(minifycss())
|
||||||
.pipe(header(banner, {pkg: pkg}))
|
.pipe(header(banner, {pkg: pkg}))
|
||||||
.pipe(gulp.dest('dist'));
|
.pipe(gulp.dest("dist"));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('prettify-js', function() {
|
gulp.task("prettify-js", function() {
|
||||||
gulp.src('./src/js/simplemde.js')
|
gulp.src("./src/js/simplemde.js")
|
||||||
.pipe(prettify({js: {braceStyle: "collapse", indentChar: "\t", indentSize: 1, maxPreserveNewlines: 3, spaceBeforeConditional: false}}))
|
.pipe(prettify({js: {braceStyle: "collapse", indentChar: "\t", indentSize: 1, maxPreserveNewlines: 3, spaceBeforeConditional: false}}))
|
||||||
.pipe(gulp.dest('./src/js'));
|
.pipe(gulp.dest("./src/js"));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('prettify-css', function() {
|
gulp.task("prettify-css", function() {
|
||||||
gulp.src('./src/css/simplemde.css')
|
gulp.src("./src/css/simplemde.css")
|
||||||
.pipe(prettify({css: {indentChar: "\t", indentSize: 1}}))
|
.pipe(prettify({css: {indentChar: "\t", indentSize: 1}}))
|
||||||
.pipe(gulp.dest('./src/css'));
|
.pipe(gulp.dest("./src/css"));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', ['scripts', 'styles', 'prettify-js', 'prettify-css']);
|
gulp.task("default", ["downloads-codemirror", "downloads-js", "downloads-css", "scripts", "styles", "prettify-js", "prettify-css"]);
|
@ -0,0 +1,53 @@
|
|||||||
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||||
|
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||||
|
|
||||||
|
(function(mod) {
|
||||||
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||||
|
mod(require("../../lib/codemirror"));
|
||||||
|
else if (typeof define == "function" && define.amd) // AMD
|
||||||
|
define(["../../lib/codemirror"], mod);
|
||||||
|
else // Plain browser env
|
||||||
|
mod(CodeMirror);
|
||||||
|
})(function(CodeMirror) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
Loading…
Reference in New Issue