Merge pull request #361 from NextStepWebs/development

Fix broken dependency
master 1.11.2
Wes Cossick 8 years ago committed by GitHub
commit 6abda7ab68

@ -1,6 +1,6 @@
{ {
"name": "simplemde", "name": "simplemde",
"version": "1.11.1", "version": "1.11.2",
"homepage": "https://github.com/NextStepWebs/simplemde-markdown-editor", "homepage": "https://github.com/NextStepWebs/simplemde-markdown-editor",
"authors": [ "authors": [
"Wes Cossick <https://wescossick.com>" "Wes Cossick <https://wescossick.com>"

@ -1,5 +1,5 @@
/** /**
* simplemde v1.11.1 * simplemde v1.11.2
* Copyright Next Step Webs, Inc. * Copyright Next Step Webs, Inc.
* @link https://github.com/NextStepWebs/simplemde-markdown-editor * @link https://github.com/NextStepWebs/simplemde-markdown-editor
* @license MIT * @license MIT

File diff suppressed because one or more lines are too long

@ -1,5 +1,5 @@
/** /**
* simplemde v1.11.1 * simplemde v1.11.2
* Copyright Next Step Webs, Inc. * Copyright Next Step Webs, Inc.
* @link https://github.com/NextStepWebs/simplemde-markdown-editor * @link https://github.com/NextStepWebs/simplemde-markdown-editor
* @license MIT * @license MIT
@ -1833,7 +1833,6 @@ function isnan (val) {
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"base64-js":1,"ieee754":15,"isarray":16}],4:[function(require,module,exports){ },{"base64-js":1,"ieee754":15,"isarray":16}],4:[function(require,module,exports){
/* globals CodeMirror */
// Use strict mode (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) // Use strict mode (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode)
"use strict"; "use strict";
@ -1842,28 +1841,42 @@ function isnan (val) {
var Typo = require("typo-js"); var Typo = require("typo-js");
// Initialize data globally to reduce memory consumption // Create function
var num_loaded = 0; function CodeMirrorSpellChecker(options) {
var aff_loading = false; // Initialize
var dic_loading = false; options = options || {};
var aff_data = "";
var dic_data = "";
var typo; // Verify
if(typeof options.codeMirrorInstance !== "function" || typeof options.codeMirrorInstance.defineMode !== "function") {
console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");
return;
}
CodeMirror.defineMode("spell-checker", function(config) { // Because some browsers don't support this functionality yet
if(!String.prototype.includes) {
String.prototype.includes = function() {
"use strict";
return String.prototype.indexOf.apply(this, arguments) !== -1;
};
}
// Define the new mode
options.codeMirrorInstance.defineMode("spell-checker", function(config) {
// Load AFF/DIC data // Load AFF/DIC data
if(!aff_loading) { if(!CodeMirrorSpellChecker.aff_loading) {
aff_loading = true; CodeMirrorSpellChecker.aff_loading = true;
var xhr_aff = new XMLHttpRequest(); var xhr_aff = new XMLHttpRequest();
xhr_aff.open("GET", "https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff", true); xhr_aff.open("GET", "https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff", true);
xhr_aff.onload = function() { xhr_aff.onload = function() {
if(xhr_aff.readyState === 4 && xhr_aff.status === 200) { if(xhr_aff.readyState === 4 && xhr_aff.status === 200) {
aff_data = xhr_aff.responseText; CodeMirrorSpellChecker.aff_data = xhr_aff.responseText;
num_loaded++; CodeMirrorSpellChecker.num_loaded++;
if(num_loaded == 2) { if(CodeMirrorSpellChecker.num_loaded == 2) {
typo = new Typo("en_US", aff_data, dic_data, { CodeMirrorSpellChecker.typo = new Typo("en_US", CodeMirrorSpellChecker.aff_data, CodeMirrorSpellChecker.dic_data, {
platform: "any" platform: "any"
}); });
} }
@ -1872,17 +1885,17 @@ CodeMirror.defineMode("spell-checker", function(config) {
xhr_aff.send(null); xhr_aff.send(null);
} }
if(!dic_loading) { if(!CodeMirrorSpellChecker.dic_loading) {
dic_loading = true; CodeMirrorSpellChecker.dic_loading = true;
var xhr_dic = new XMLHttpRequest(); var xhr_dic = new XMLHttpRequest();
xhr_dic.open("GET", "https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic", true); xhr_dic.open("GET", "https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic", true);
xhr_dic.onload = function() { xhr_dic.onload = function() {
if(xhr_dic.readyState === 4 && xhr_dic.status === 200) { if(xhr_dic.readyState === 4 && xhr_dic.status === 200) {
dic_data = xhr_dic.responseText; CodeMirrorSpellChecker.dic_data = xhr_dic.responseText;
num_loaded++; CodeMirrorSpellChecker.num_loaded++;
if(num_loaded == 2) { if(CodeMirrorSpellChecker.num_loaded == 2) {
typo = new Typo("en_US", aff_data, dic_data, { CodeMirrorSpellChecker.typo = new Typo("en_US", CodeMirrorSpellChecker.aff_data, CodeMirrorSpellChecker.dic_data, {
platform: "any" platform: "any"
}); });
} }
@ -1912,28 +1925,33 @@ CodeMirror.defineMode("spell-checker", function(config) {
stream.next(); stream.next();
} }
if(typo && !typo.check(word)) if(CodeMirrorSpellChecker.typo && !CodeMirrorSpellChecker.typo.check(word))
return "spell-error"; // CSS class: cm-spell-error return "spell-error"; // CSS class: cm-spell-error
return null; return null;
} }
}; };
var mode = CodeMirror.getMode( var mode = options.codeMirrorInstance.getMode(
config, config.backdrop || "text/plain" config, config.backdrop || "text/plain"
); );
return CodeMirror.overlayMode(mode, overlay, true); return options.codeMirrorInstance.overlayMode(mode, overlay, true);
}); });
}
// Because some browsers don't support this functionality yet // Initialize data globally to reduce memory consumption
if(!String.prototype.includes) { CodeMirrorSpellChecker.num_loaded = 0;
String.prototype.includes = function() { CodeMirrorSpellChecker.aff_loading = false;
"use strict"; CodeMirrorSpellChecker.dic_loading = false;
return String.prototype.indexOf.apply(this, arguments) !== -1; CodeMirrorSpellChecker.aff_data = "";
}; CodeMirrorSpellChecker.dic_data = "";
} CodeMirrorSpellChecker.typo;
// Export
module.exports = CodeMirrorSpellChecker;
},{"typo-js":18}],5:[function(require,module,exports){ },{"typo-js":18}],5:[function(require,module,exports){
// CodeMirror, copyright (c) by Marijn Haverbeke and others // CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE // Distributed under an MIT license: http://codemirror.net/LICENSE

@ -1,5 +1,5 @@
/** /**
* simplemde v1.11.1 * simplemde v1.11.2
* Copyright Next Step Webs, Inc. * Copyright Next Step Webs, Inc.
* @link https://github.com/NextStepWebs/simplemde-markdown-editor * @link https://github.com/NextStepWebs/simplemde-markdown-editor
* @license MIT * @license MIT

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "simplemde", "name": "simplemde",
"version": "1.11.1", "version": "1.11.2",
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor. Features autosaving and spell checking.", "description": "A simple, beautiful, and embeddable JavaScript Markdown editor. Features autosaving and spell checking.",
"keywords": [ "keywords": [
"embeddable", "embeddable",

Loading…
Cancel
Save