Compare commits

...

41 Commits

Author SHA1 Message Date
Wes Cossick
6abda7ab68 Merge pull request #361 from NextStepWebs/development
Fix broken dependency
2016-06-14 12:57:04 -05:00
Wes Cossick
1471a4e662 Merge branch 'master' into development 2016-06-14 12:50:07 -05:00
Wes Cossick
0d9f7d9012 Update code and version 2016-06-14 12:48:07 -05:00
Wes Cossick
2c35e6782f 1.11.2 2016-06-14 12:46:09 -05:00
Wes Cossick
cb10536dd4 Update bower version 2016-06-14 12:46:03 -05:00
Wes Cossick
00e0f69d93 Merge pull request #356 from NextStepWebs/development
Republishing to NPM
2016-06-09 15:42:10 -05:00
Wes Cossick
98bc1e52a1 Update version 2016-06-09 15:26:41 -05:00
Wes Cossick
47b2667e86 1.11.1 2016-06-09 15:22:15 -05:00
Wes Cossick
316b8a58f8 Merge pull request #353 from NextStepWebs/development
Development
2016-06-07 22:54:06 -05:00
Wes Cossick
6676411766 Update version in comments 2016-06-07 22:46:55 -05:00
Wes Cossick
3653d4f81d 1.11.0 2016-06-07 22:46:32 -05:00
Wes Cossick
7dc2a8f7fe Revert "Revert this"
This reverts commit 021e70524275ad40459b6e13cbc82bb3fabfd990.
2016-06-07 22:46:19 -05:00
Wes Cossick
021e705242 Revert this 2016-06-07 22:46:15 -05:00
Wes Cossick
e74572ac4a Update version in bower 2016-06-07 22:46:11 -05:00
Wes Cossick
487ff36385 Rebuild project 2016-06-07 22:36:54 -05:00
Wes Cossick
d963582f16 Fix line and word count on init (#299) 2016-06-07 21:53:23 -05:00
Wes Cossick
69bff3ed78 Fix CodeMirror bug with init text (#344) 2016-06-07 21:43:25 -05:00
Wes Cossick
b4d4e89129 Fix selection bug when toggling between side-by-side (#309) 2016-06-07 21:40:40 -05:00
Wes Cossick
c949cad2d8 Update URLs; prefer SSL 2016-06-07 21:33:34 -05:00
Wes Cossick
c8f23a3aa9 Clean up build process, Use new CodeMirror Spell Checker 2016-06-07 21:28:01 -05:00
Wes Cossick
dbb1c25843 Travis CI now tests against Node.js 6 2016-06-07 21:28:01 -05:00
Wes Cossick
a30d8f6183 Fix #326 2016-06-07 21:28:01 -05:00
Wes Cossick
51ef0cd81d Merge pull request #351 from amka/patch-2
Add support for count Cyrillic words
2016-06-07 21:18:55 -05:00
Wes Cossick
97154e2bfc Merge pull request #345 from jbutz/development
Prevent onclick event from bubbling
2016-06-07 21:07:01 -05:00
Andrey M
bd33cd3c2b Add support for count Cyrillic words
Add unicode range for Cyrillic characters
2016-06-07 03:39:01 +04:00
Jason Butz
7187fb26fb Adjust whitespace characters 2016-06-03 09:09:33 -04:00
Jason Butz
f21cca3068 Prevent onclick event from bubbling 2016-06-03 09:07:15 -04:00
Wes Cossick
b6b1f7c1ef Merge pull request #304 from bbemis017/readmeError
Readme error
2016-04-22 18:56:43 -05:00
Wes Cossick
0ce450a7a7 Merge pull request #301 from JHeiner/issue150
Fix issue #150: use correct paths for dependencies.
2016-04-22 18:52:01 -05:00
Benjamin Bemis
d9d0cd50d5 Fixed Syntax Error in readme file 2016-04-22 19:38:20 -04:00
Jeremy Heiner
7b1e8deeaa Fix issue #150: use correct paths for dependencies.
https://nodejs.org/api/modules.html specifies what paths are
correct. One should never explicitly put "node_modules" in
dependency paths because npm is under no obligation to put things
where you told it to look for them. Issue #150 arises when
SimpleMDE is a dependency in some other project, so it and its
dependencies are peers under that project's "node_modules", and
there is no "./node_modules" within the SimpleMDE folder.

TL/DR: npm tells you where it puts dependencies, not vice versa.
2016-04-19 20:02:53 -04:00
Wes Cossick
e72e51c94f Merge pull request #297 from prostoandrei/development
Fix #286
2016-04-09 21:19:59 -05:00
Wes Cossick
4ec9ab8be0 Tweak documentation for styleSelectedText 2016-04-09 21:18:03 -05:00
Wes Cossick
6ed8344248 Fix documentation for styleSelectedText 2016-04-09 21:17:07 -05:00
Wes Cossick
2f4e7e4d9b Merge pull request #289 from foreachlt/style-selected-text
Added mark-selection plugin
2016-04-09 21:16:09 -05:00
andrey.vaganov
318b4c175f Merge branch 'development' of https://github.com/prostoandrei/simplemde-markdown-editor into development
Conflicts:
	debug/simplemde.debug.js
	debug/simplemde.js
	dist/simplemde.min.js
	src/js/simplemde.js
2016-03-31 13:36:05 +03:00
andrey.vaganov
fe1318dd39 fix issue #286 2016-03-31 13:34:12 +03:00
andrey.vaganov
4a8ce0bd12 fix issue #286 2016-03-31 12:14:39 +03:00
Kasparas Galdikas
490e57ded1 Added mark-selection plugin from CodeMirror with config option on simplemde 2016-03-25 15:56:44 +00:00
Wes Cossick
9eb0411d82 Merge pull request #284 from foreachlt/console
Removed console.log left overs
2016-03-25 09:58:32 -05:00
Kasparas Galdikas
be3fbf15b5 Removed console.log left overs 2016-03-20 14:55:19 +00:00
11 changed files with 6252 additions and 2028 deletions

View File

@ -1,5 +1,6 @@
language: node_js
node_js:
- '6'
- '5'
- '4'
- '0.12'

View File

@ -20,11 +20,11 @@ Via [bower](https://www.bower.io).
bower install simplemde --save
```
Via [jsDelivr](http://www.jsdelivr.com/#!simplemde). *Please note, jsDelivr may take a few days to update to the latest release.*
Via [jsDelivr](https://www.jsdelivr.com/#!simplemde). *Please note, jsDelivr may take a few days to update to the latest release.*
```HTML
<link rel="stylesheet" href="//cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
<script src="//cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
```
## Quick start
@ -103,6 +103,7 @@ simplemde.value("This text will appear in the editor");
- **spellChecker**: If set to `false`, disable the spell checker. Defaults to `true`.
- **status**: If set to `false`, hide the status bar. Defaults to the array of built-in status bar items.
- Optionally, you can set an array of status bar items to include, and in what order. You can even define your own custom status bar items.
- **styleSelectedText**: If set to `false`, remove the `CodeMirror-selectedtext` class from selected lines. Defaults to `true`.
- **tabSize**: If set, customize the tab size. Defaults to `2`.
- **toolbar**: If set to `false`, hide the toolbar. Defaults to the [array of icons](#toolbar-icons).
- **toolbarTips**: If set to `false`, disable toolbar button tips. Defaults to `true`.
@ -170,6 +171,7 @@ var simplemde = new SimpleMDE({
el.innerHTML = ++this.keystrokes + " Keystrokes";
}
}], // Another optional usage, with a custom status bar item that counts keystrokes
styleSelectedText: false,
tabSize: 4,
toolbar: false,
toolbarTips: false,
@ -225,7 +227,7 @@ var simplemde = new SimpleMDE({
},
{
name: "custom",
action: customFunction(editor){
action: function customFunction(editor){
// Add your own code
},
className: "fa fa-star",
@ -324,6 +326,6 @@ simplemde.clearAutosavedValue(); // no returned value
```
## How it works
SimpleMDE began as an improvement of [lepture's Editor project](https://github.com/lepture/editor), but has now taken on an identity of its own. It is bundled with [CodeMirror](https://github.com/codemirror/codemirror) and depends on [Font Awesome](http://fortawesome.github.io/Font-Awesome/).
SimpleMDE began as an improvement of [lepture's Editor project](https://github.com/lepture/editor), but has now taken on an identity of its own. It is bundled with [CodeMirror](https://github.com/codemirror/codemirror) and depends on [Font Awesome](http://fontawesome.io).
CodeMirror is the backbone of the project and parses much of the Markdown syntax as it's being written. This allows us to add styles to the Markdown that's being written. Additionally, a toolbar and status bar have been added to the top and bottom, respectively. Previews are rendered by [Marked](https://github.com/chjj/marked) using GFM.

View File

@ -1,25 +1,23 @@
{
"name": "simplemde",
"version": "1.10.1",
"homepage": "https://github.com/NextStepWebs/simplemde-markdown-editor",
"authors": [
"Wes Cossick"
],
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor.",
"main": ["dist/simplemde.min.js", "dist/simplemde.min.css"],
"moduleType": [
"globals"
],
"keywords": [
"embeddable",
"markdown",
"editor",
"javascript",
"wysiwyg"
],
"license": "MIT",
"ignore": [
"node_modules",
"bower_components"
]
"name": "simplemde",
"version": "1.11.2",
"homepage": "https://github.com/NextStepWebs/simplemde-markdown-editor",
"authors": [
"Wes Cossick <https://wescossick.com>"
],
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor.",
"main": ["src/js/simplemde.js", "src/css/simplemde.css"],
"keywords": [
"embeddable",
"markdown",
"editor",
"javascript",
"wysiwyg"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components"
]
}

View File

@ -1,5 +1,5 @@
/**
* simplemde v1.10.1
* simplemde v1.11.2
* Copyright Next Step Webs, Inc.
* @link https://github.com/NextStepWebs/simplemde-markdown-editor
* @license MIT
@ -58,7 +58,7 @@
}
.cm-fat-cursor .CodeMirror-cursor {
width: auto;
border: 0;
border: 0 !important;
background: #7e7;
}
.cm-fat-cursor div.CodeMirror-cursors {
@ -197,6 +197,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
.CodeMirror-gutters {
position: absolute; left: 0; top: 0;
min-height: 100%;
z-index: 3;
}
.CodeMirror-gutter {
@ -251,6 +252,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
-webkit-font-variant-ligatures: none;
font-variant-ligatures: none;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
@ -669,5 +672,5 @@ span.CodeMirror-selectedtext { background: none; }
opacity: .5;
}
.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word) {
background: rgba(255, 0, 0, .15);
background: rgba(255, 0, 0, .15);
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

19
dist/simplemde.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
"use strict";
var gulp = require("gulp"),
minifycss = require("gulp-minify-css"),
minifycss = require("gulp-clean-css"),
uglify = require("gulp-uglify"),
concat = require("gulp-concat"),
header = require("gulp-header"),
@ -8,11 +9,10 @@ var gulp = require("gulp"),
pkg = require("./package.json"),
debug = require("gulp-debug"),
eslint = require("gulp-eslint"),
prettify = require("gulp-jsbeautifier");
var browserify = require("browserify");
var source = require("vinyl-source-stream");
var rename = require("gulp-rename");
prettify = require("gulp-jsbeautifier"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
rename = require("gulp-rename");
var banner = ["/**",
" * <%= pkg.name %> v<%= pkg.version %>",
@ -45,10 +45,9 @@ gulp.task("lint", ["prettify-js"], function() {
function taskBrowserify(opts) {
return browserify("./src/js/simplemde.js", opts)
.bundle();
}
gulp.task("browserify:dev", ["lint"], function() {
gulp.task("browserify:debug", ["lint"], function() {
return taskBrowserify({debug:true, standalone:"SimpleMDE"})
.pipe(source("simplemde.debug.js"))
.pipe(buffer())
@ -56,7 +55,7 @@ gulp.task("browserify:dev", ["lint"], function() {
.pipe(gulp.dest("./debug/"));
});
gulp.task("browserify:min", ["lint"], function() {
gulp.task("browserify", ["lint"], function() {
return taskBrowserify({standalone:"SimpleMDE"})
.pipe(source("simplemde.js"))
.pipe(buffer())
@ -64,7 +63,7 @@ gulp.task("browserify:min", ["lint"], function() {
.pipe(gulp.dest("./debug/"));
});
gulp.task("scripts", ["browserify:dev", "browserify:min", "lint"], function() {
gulp.task("scripts", ["browserify:debug", "browserify", "lint"], function() {
var js_files = ["./debug/simplemde.js"];
return gulp.src(js_files)

View File

@ -1,69 +1,48 @@
{
"name": "simplemde",
"version": "1.10.1",
"version": "1.11.2",
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor. Features autosaving and spell checking.",
"keywords": [
"embeddable",
"markdown",
"editor",
"javascript",
"wysiwyg"
"embeddable",
"markdown",
"editor",
"javascript",
"wysiwyg"
],
"homepage": "https://github.com/NextStepWebs/simplemde-markdown-editor",
"main": "./src/js/simplemde.js",
"license": "MIT",
"company": "Next Step Webs, Inc.",
"author": {
"name": "Wes Cossick",
"url": "http://www.WesCossick.com"
"name": "Wes Cossick",
"url": "http://www.WesCossick.com"
},
"bugs": {
"url": "https://github.com/NextStepWebs/simplemde-markdown-editor/issues"
"url": "https://github.com/NextStepWebs/simplemde-markdown-editor/issues"
},
"dependencies": {
"codemirror": "codemirror/CodeMirror",
"codemirror-spell-checker": "nextstepwebs/codemirror-spell-checker",
"marked": "0.3.5"
"codemirror": "*",
"codemirror-spell-checker": "*",
"marked": "*"
},
"devDependencies": {
"browserify": "^11.2.0",
"browserify-shim": "^3.8.10",
"debug": "^2.2.0",
"eslint": "*",
"gulp": "*",
"gulp-concat": "*",
"gulp-debug": "^2.1.1",
"gulp-eslint": "*",
"gulp-header": "*",
"gulp-jsbeautifier": "*",
"gulp-minify-css": "^1.2.1",
"gulp-rename": "^1.2.2",
"gulp-uglify": "*",
"vinyl-source-stream": "*",
"vinyl-buffer": "*"
},
"browserify": {
"transform": [
"browserify-shim"
]
},
"browser": {
"spell-checker": "./node_modules/codemirror-spell-checker/src/js/spell-checker.js",
"typo": "./node_modules/codemirror-spell-checker/src/js/typo.js"
},
"browserify-shim": {
"spell-checker": {
"depends": [
"typo:Typo",
"codemirror:CodeMirror"
]
},
"typo": {
"exports": "Typo"
}
"browserify": "*",
"debug": "*",
"eslint": "*",
"gulp": "*",
"gulp-concat": "*",
"gulp-debug": "*",
"gulp-eslint": "*",
"gulp-header": "*",
"gulp-jsbeautifier": "*",
"gulp-clean-css": "*",
"gulp-rename": "*",
"gulp-uglify": "*",
"vinyl-source-stream": "*",
"vinyl-buffer": "*"
},
"repository": {
"type": "git",
"url": "https://github.com/NextStepWebs/simplemde-markdown-editor"
"type": "git",
"url": "https://github.com/NextStepWebs/simplemde-markdown-editor"
}
}

View File

@ -7,9 +7,10 @@ require("codemirror/addon/display/fullscreen.js");
require("codemirror/mode/markdown/markdown.js");
require("codemirror/addon/mode/overlay.js");
require("codemirror/addon/display/placeholder.js");
require("codemirror/addon/selection/mark-selection.js");
require("codemirror/mode/gfm/gfm.js");
require("codemirror/mode/xml/xml.js");
require("spell-checker");
var CodeMirrorSpellChecker = require("codemirror-spell-checker");
var marked = require("marked");
@ -739,6 +740,9 @@ function toggleSideBySide(editor) {
} else {
cm.off("update", cm.sideBySideRenderingFunction);
}
// Refresh to fix selection being off (#309)
cm.refresh();
}
@ -1048,7 +1052,7 @@ function extend(target) {
/* The right word count in respect for CJK. */
function wordCount(data) {
var pattern = /[a-zA-Z0-9_\u0392-\u03c9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g;
var pattern = /[a-zA-Z0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g;
var m = data.match(pattern);
var count = 0;
if(m === null) return count;
@ -1238,7 +1242,7 @@ var toolbarBuiltInButtons = {
var insertTexts = {
link: ["[", "](#url#)"],
image: ["![", "](#url#)"],
image: ["![](", "#url#)"],
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
horizontalRule: ["", "\n\n-----\n\n"]
};
@ -1465,6 +1469,10 @@ SimpleMDE.prototype.render = function(el) {
backdrop = options.parsingConfig;
backdrop.name = "gfm";
backdrop.gitHubSpice = false;
CodeMirrorSpellChecker({
codeMirrorInstance: CodeMirror
});
} else {
mode = options.parsingConfig;
mode.name = "gfm";
@ -1483,7 +1491,8 @@ SimpleMDE.prototype.render = function(el) {
extraKeys: keyMaps,
lineWrapping: (options.lineWrapping === false) ? false : true,
allowDropFileTypes: ["text/plain"],
placeholder: options.placeholder || el.getAttribute("placeholder") || ""
placeholder: options.placeholder || el.getAttribute("placeholder") || "",
styleSelectedText: (options.styleSelectedText != undefined) ? options.styleSelectedText : true
});
if(options.forceSync === true) {
@ -1508,6 +1517,13 @@ SimpleMDE.prototype.render = function(el) {
this.gui.sideBySide = this.createSideBySide();
this._rendered = this.element;
// Fixes CodeMirror bug (#344)
var temp_cm = this.codemirror;
setTimeout(function() {
temp_cm.refresh();
}.bind(temp_cm), 0);
};
// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem throw QuotaExceededError. We're going to detect this and set a variable accordingly.
@ -1672,9 +1688,7 @@ SimpleMDE.prototype.createToolbar = function(items) {
var nonSeparatorIconsFollow = false;
for(var x = (i + 1); x < items.length; x++) {
console.log(x);
if(items[x] !== "|" && (!self.options.hideIcons || self.options.hideIcons.indexOf(items[x].name) == -1)) {
console.log(items[x]);
nonSeparatorIconsFollow = true;
}
}
@ -1696,7 +1710,8 @@ SimpleMDE.prototype.createToolbar = function(items) {
// bind events, special for info
if(item.action) {
if(typeof item.action === "function") {
el.onclick = function() {
el.onclick = function(e) {
e.preventDefault();
item.action(self);
};
} else if(typeof item.action === "string") {
@ -1767,14 +1782,14 @@ SimpleMDE.prototype.createStatusbar = function(status) {
if(name === "words") {
defaultValue = function(el) {
el.innerHTML = "0";
el.innerHTML = wordCount(cm.getValue());
};
onUpdate = function(el) {
el.innerHTML = wordCount(cm.getValue());
};
} else if(name === "lines") {
defaultValue = function(el) {
el.innerHTML = "0";
el.innerHTML = cm.lineCount();
};
onUpdate = function(el) {
el.innerHTML = cm.lineCount();
@ -1989,9 +2004,17 @@ SimpleMDE.prototype.toTextArea = function() {
var cm = this.codemirror;
var wrapper = cm.getWrapperElement();
wrapper.parentNode.removeChild(this.gui.toolbar);
wrapper.parentNode.removeChild(this.gui.statusbar);
wrapper.parentNode.removeChild(this.gui.sideBySide);
if(wrapper.parentNode) {
if(this.gui.toolbar) {
wrapper.parentNode.removeChild(this.gui.toolbar);
}
if(this.gui.statusbar) {
wrapper.parentNode.removeChild(this.gui.statusbar);
}
if(this.gui.sideBySide) {
wrapper.parentNode.removeChild(this.gui.sideBySide);
}
}
cm.toTextArea();