Merge branch 'development'

typescriptify 2.2.1
Unknown 6 years ago
commit 7fda2e09dd

@ -4,3 +4,6 @@ end_of_line=lf
insert_final_newline=true
indent_style=space
indent_size=4
[*.{yml,yaml}]
indent_size=2

@ -7,4 +7,4 @@ First of all, thanks for your interest in helping make EasyMDE even better. Cont
- If you really want to earn some brownie points, create a JSFiddle that demonstrates your code changes. Seriously, this helps immensely and allows one or multiple people to easily provide feedback on the great work you've done.
- When creating the JSFiddle, keep in mind that you can use http://rawgit.com for your files.
- Do your best to fully test your changes. Anticipate edge-case behavior.
- Try to keep your codebase that you're making changes to as up-to-date as possible with the origin. SimpleMDE creates new releases frequently, so it's easy to fall behind if you've been working on something new for a while.
- Try to keep your codebase that you're making changes to as up-to-date as possible with the origin. EasyMDE creates new releases frequently, so it's easy to fall behind if you've been working on something new for a while.

1
.gitignore vendored

@ -7,3 +7,4 @@ node_modules/
*.iws
.idea/
.vscode/
dev_test/

@ -6,3 +6,20 @@ node_js:
before_script:
- npm install -g gulp
script: gulp
deploy:
- provider: npm
email: info@saturnserver.org
api_key:
secure: VswGN/y8Tu9as13qQRd/zKcMRo7lpa9BWYYyw+LN4uRaustVzmFY0akOPInaajGyxvHvn9A8hY+ASNeUnpRcnVfHSNdtBlLltMm62dXVxqrWZl5cI07rXc1yerL5YcnuC8jEO9bm3lbkXL6fUt7pgk59wgEdZjUPaIpELY/1/H33RLpLGJ1P8JeIzUwuV6RqJcoULoEFoJruXWEjM+OkaJQt1z+/1JgXVxhGS/6NnKmf0pyZM+ULvgmF1l5YGwUfQl4miB8I7+GeWuYvPSDqL3YgLpxrmnw2uW4a120XtMf30awpGTF9iPZqc5VIQyOJ/8A2myGmm/r2RWXyn3WWQUYwmb4HDIuvbIGTGhW9Zd1X3Kjb14DFeD26ZB11ynOwGZPQC51rF0chK+O3PF56QKMsu8Qx56g8+pU4g3qP2txwAQjh89fTsx8I04Om/XwyoZ3eSQLkX/12oD1FcE7Fv30bVEiegN+hH3SiIofWBhhV0tUJjlrCHGgxMXb2e6XnJh9ePuvUOTW9AeWwYEQRpqnM1n6zIPci/dwGDNP9sYGBRsRMGdHlExP8FecM5/vL/3XHidk2PuRNM0BLDLibDVkwzwnHNQkpPuzrr57MKcScYy6VyLxErk88VGzNb8oZ6NFRQYmWgjX6bdFBfZFo5snB49tgRpWpCbiF5SBMNnQ=
on:
tags: true
branch: master
repo: Ionaru/easy-markdown-editor
- provider: npm
email: info@saturnserver.org
api_key:
secure: VswGN/y8Tu9as13qQRd/zKcMRo7lpa9BWYYyw+LN4uRaustVzmFY0akOPInaajGyxvHvn9A8hY+ASNeUnpRcnVfHSNdtBlLltMm62dXVxqrWZl5cI07rXc1yerL5YcnuC8jEO9bm3lbkXL6fUt7pgk59wgEdZjUPaIpELY/1/H33RLpLGJ1P8JeIzUwuV6RqJcoULoEFoJruXWEjM+OkaJQt1z+/1JgXVxhGS/6NnKmf0pyZM+ULvgmF1l5YGwUfQl4miB8I7+GeWuYvPSDqL3YgLpxrmnw2uW4a120XtMf30awpGTF9iPZqc5VIQyOJ/8A2myGmm/r2RWXyn3WWQUYwmb4HDIuvbIGTGhW9Zd1X3Kjb14DFeD26ZB11ynOwGZPQC51rF0chK+O3PF56QKMsu8Qx56g8+pU4g3qP2txwAQjh89fTsx8I04Om/XwyoZ3eSQLkX/12oD1FcE7Fv30bVEiegN+hH3SiIofWBhhV0tUJjlrCHGgxMXb2e6XnJh9ePuvUOTW9AeWwYEQRpqnM1n6zIPci/dwGDNP9sYGBRsRMGdHlExP8FecM5/vL/3XHidk2PuRNM0BLDLibDVkwzwnHNQkpPuzrr57MKcScYy6VyLxErk88VGzNb8oZ6NFRQYmWgjX6bdFBfZFo5snB49tgRpWpCbiF5SBMNnQ=
tag: next
on:
branch: development
repo: Ionaru/easy-markdown-editor

@ -10,6 +10,7 @@ Changes include:
* Small styling changes
* Support for Node 8 and beyond
* Lots of refactored code
* Links in preview will open in a new tab by default
My intention is to continue development on this project, improving it and keeping it alive.

@ -1,5 +1,5 @@
/**
* easymde v2.0.1
* easymde v2.1.0
* Copyright Jeroen Akkerman
* @link https://github.com/ionaru/easy-markdown-editor
* @license MIT

File diff suppressed because one or more lines are too long

102
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "easymde",
"version": "2.0.1",
"version": "2.2.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -332,9 +332,9 @@
}
},
"async-done": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/async-done/-/async-done-1.2.4.tgz",
"integrity": "sha512-mxc+yISkb0vjsuvG3dJCIZXzRWjKndQ9Zo9zNDJ1K2wh9eP0E0oGmOWm+4cFOvW4dA0tGFImTW5tQJHCtn1kIQ==",
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/async-done/-/async-done-1.3.1.tgz",
"integrity": "sha512-R1BaUeJ4PMoLNJuk+0tLJgjmEqVsdN118+Z8O+alhnQDQgy0kmD5Mqi0DNEmMx2LM0Ed5yekKu+ZXYvIHceicg==",
"dev": true,
"requires": {
"end-of-stream": "^1.1.0",
@ -963,9 +963,9 @@
"dev": true
},
"codemirror": {
"version": "5.37.0",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.37.0.tgz",
"integrity": "sha512-dQaayDJCLU4UJcwg2RM44oFrs0dMNndTp6qxQJF6XI71l1xN3RB4IqiKES0b0rccbARbrD/UBB4t8DNknfaOTw=="
"version": "5.39.0",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.39.0.tgz",
"integrity": "sha512-vpJRray/0ZCt9FiS7UcVr1JAm6OBdUt6TA/94Q7MScr8TnutVdQWh/WPr0migzaBPQmYvY7I9UZNvbsaLESIuQ=="
},
"codemirror-spell-checker": {
"version": "1.1.2",
@ -1104,9 +1104,9 @@
"dev": true
},
"copy-props": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.3.tgz",
"integrity": "sha512-Q5jXiqCOvlQc1Nvy2txrVg9ZexZ0UAw9NBQ7/s3cZ7SCAm0WD7NNsLwwcy+xvNwuVBbfkF2+4SBcz1L1AWbtmw==",
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.4.tgz",
"integrity": "sha512-7cjuUME+p+S3HZlbllgsn2CDwS+5eCCX16qBgNC4jgSTf49qR1VKy/Zhl400m0IQXl/bPGEVqncgUUMjrr4s8A==",
"dev": true,
"requires": {
"each-props": "^1.3.0",
@ -1410,9 +1410,9 @@
}
},
"each-props": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/each-props/-/each-props-1.3.1.tgz",
"integrity": "sha1-/BOPUeOid0KG1IWOAtbn3kYt4Vg=",
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/each-props/-/each-props-1.3.2.tgz",
"integrity": "sha512-vV0Hem3zAGkJAyU7JSjixeU66rwdynTAa1vofCrSA5fEln+m67Az9CcnkVD776/fsN/UjIWmBDoNRS6t6G9RfA==",
"dev": true,
"requires": {
"is-plain-object": "^2.0.1",
@ -1999,14 +1999,14 @@
"dev": true
},
"fsevents": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.3.tgz",
"integrity": "sha512-X+57O5YkDTiEQGiw8i7wYc2nQgweIekqkepI8Q3y4wVlurgBt2SuwxTeYUYMZIGpLZH3r/TsMjczCMXE5ZOt7Q==",
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz",
"integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==",
"dev": true,
"optional": true,
"requires": {
"nan": "^2.9.2",
"node-pre-gyp": "^0.9.0"
"node-pre-gyp": "^0.10.0"
},
"dependencies": {
"abbrev": {
@ -2087,7 +2087,7 @@
}
},
"deep-extend": {
"version": "0.4.2",
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true
@ -2265,7 +2265,7 @@
}
},
"node-pre-gyp": {
"version": "0.9.1",
"version": "0.10.0",
"bundled": true,
"dev": true,
"optional": true,
@ -2374,12 +2374,12 @@
"optional": true
},
"rc": {
"version": "1.2.6",
"version": "1.2.7",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"deep-extend": "~0.4.0",
"deep-extend": "^0.5.1",
"ini": "~1.3.0",
"minimist": "^1.2.0",
"strip-json-comments": "~2.0.1"
@ -2761,9 +2761,9 @@
}
},
"gulp-rename": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.2.2.tgz",
"integrity": "sha1-OtRCh2PwXidk3sHGfYaNsnVoeBc=",
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.2.3.tgz",
"integrity": "sha512-CmdPM0BjJ105QCX1fk+j7NGhiN/1rCl9HLGss+KllBS/tdYadpjTxqdKyh/5fNV+M3yjT1MFz5z93bXdrTyzAw==",
"dev": true
},
"gulp-uglify": {
@ -3033,9 +3033,9 @@
}
},
"insert-module-globals": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.0.6.tgz",
"integrity": "sha512-R3sidKJr3SsggqQQ5cEwQb3pWG8RNx0UnpyeiOSR6jorRIeAOzH2gkTWnNdMnyRiVbjrG047K7UCtlMkQ1Mo9w==",
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.1.0.tgz",
"integrity": "sha512-LbYZdybvKjbbcKLp03lB323Cgc8f0iL0Rjh8U6JZ7K1gZSf7MxQH191iCNUcLX4qIQ6/yWe4Q4ZsQ+opcReNFg==",
"dev": true,
"requires": {
"JSONStream": "^1.0.3",
@ -3584,9 +3584,9 @@
}
},
"marked": {
"version": "0.3.19",
"resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz",
"integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg=="
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/marked/-/marked-0.4.0.tgz",
"integrity": "sha512-tMsdNBgOsrUophCAFQl0XPe6Zqk/uy9gnue+jIIKhykO51hxyu6uNx7zBPy0+y/WKYVZZMspV9YeXLNdKk+iYw=="
},
"matchdep": {
"version": "2.0.0",
@ -3713,9 +3713,9 @@
}
},
"module-deps": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.0.2.tgz",
"integrity": "sha512-KWBI3009iRnHjRlxRhe8nJ6kdeBTg4sMi5N6AZgg5f1/v5S7EBCRBOY854I4P5Anl4kx6AJH+4bBBC2Gi3nkvg==",
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.1.0.tgz",
"integrity": "sha512-NPs5N511VD1rrVJihSso/LiBShRbJALYBKzDW91uZYy7BpjnO4bGnZL3HjZ9yKcFdZUWwaYjDz9zxbuP7vKMuQ==",
"dev": true,
"requires": {
"JSONStream": "^1.0.3",
@ -4244,9 +4244,9 @@
}
},
"pumpify": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.0.tgz",
"integrity": "sha512-UWi0klDoq8xtVzlMRgENV9F7iCTZExaJQSQL187UXsxpk9NnrKGqTqqUNYAKGOzucSOxs2+jUnRNI+rLviPhJg==",
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz",
"integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==",
"dev": true,
"requires": {
"duplexify": "^3.6.0",
@ -4824,9 +4824,9 @@
"dev": true
},
"sparkles": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz",
"integrity": "sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM=",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.1.tgz",
"integrity": "sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw==",
"dev": true
},
"spdx-correct": {
@ -5233,9 +5233,9 @@
"integrity": "sha1-VNjrx5SfGngQkItgAsaEFSbJnVo="
},
"uglify-js": {
"version": "3.3.24",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.24.tgz",
"integrity": "sha512-hS7+TDiqIqvWScCcKRybCQzmMnEzJ4ryl9ErRmW4GFyG48p0/dKZiy/5mVLbsFzU8CCnCgQdxMiJzZythvLzCg==",
"version": "3.3.25",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.25.tgz",
"integrity": "sha512-hobogryjDV36VrLK3Y69ou4REyrTApzUblVFmdQOYRe8cYaSmFJXMb4dR9McdvYDSbeNdzUgYr2YVukJaErJcA==",
"dev": true,
"requires": {
"commander": "~2.15.0",
@ -5382,9 +5382,9 @@
}
},
"upath": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/upath/-/upath-1.0.5.tgz",
"integrity": "sha512-qbKn90aDQ0YEwvXoLqj0oiuUYroLX2lVHZ+b+xwjozFasAOC4GneDq5+OaIG5Zj+jFmbz/uO+f7a9qxjktJQww==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz",
"integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==",
"dev": true
},
"urix": {
@ -5444,9 +5444,9 @@
"dev": true
},
"v8flags": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.0.2.tgz",
"integrity": "sha512-6sgSKoFw1UpUPd3cFdF7QGnrH6tDeBgW1F3v9gy8gLY0mlbiBXq8soy8aQpY6xeeCjH5K+JvC62Acp7gtl7wWA==",
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.0.tgz",
"integrity": "sha512-0m69VIK2dudEf2Ub0xwLQhZkDZu85OmiOpTw+UGDt56ibviYICHziM/3aE+oVg7IjGPp0c83w3eSVqa+lYZ9UQ==",
"dev": true,
"requires": {
"homedir-polyfill": "^1.0.1"
@ -5493,9 +5493,9 @@
}
},
"vinyl-fs": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-3.0.2.tgz",
"integrity": "sha512-AUSFda1OukBwuLPBTbyuO4IRWgfXmqC4UTW0f8xrCa8Hkv9oyIU+NSqBlgfOLZRoUt7cHdo75hKQghCywpIyIw==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-3.0.3.tgz",
"integrity": "sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng==",
"dev": true,
"requires": {
"fs-mkdirp-stream": "^1.0.0",

@ -1,6 +1,6 @@
{
"name": "easymde",
"version": "2.0.1",
"version": "2.2.1",
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor that easy to use. Features include autosaving and spell checking.",
"keywords": [
"embeddable",
@ -9,16 +9,16 @@
"javascript",
"fontawesome"
],
"main": "./src/js/simplemde.js",
"main": "./src/js/easymde.js",
"license": "MIT",
"author": "Jeroen Akkerman",
"bugs": {
"url": "https://github.com/ionaru/easy-markdown-editor/issues"
},
"dependencies": {
"codemirror": "^5.37.0",
"codemirror": "^5.39.0",
"codemirror-spell-checker": "1.1.2",
"marked": "0.3.19"
"marked": "^0.4.0"
},
"devDependencies": {
"browserify": "^16.2.2",
@ -27,7 +27,7 @@
"gulp-concat": "^2.6.1",
"gulp-eslint": "^4.0.0",
"gulp-header": "^2.0.5",
"gulp-rename": "^1.2.2",
"gulp-rename": "^1.2.3",
"gulp-uglify": "^3.0.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^2.0.0"

@ -16,6 +16,7 @@ var marked = require('marked');
// Some variables
var isMac = /Mac/.test(navigator.platform);
var anchorToExternalRegex = new RegExp(/(<a.*?https?:\/\/.*?[^a]>)+?/g);
// Mapping of actions that can be bound to keyboard shortcuts or toolbar buttons
var bindings = {
@ -77,6 +78,25 @@ var isMobile = function () {
return check;
};
/**
* Modify HTML to add 'target="_blank"' to links so they open in new tabs by default.
* @param {string} htmlText - HTML to be modified.
* @return {string} The modified HTML text.
*/
function addAnchorTargetBlank(htmlText) {
var match;
while ((match = anchorToExternalRegex.exec(htmlText)) !== null) {
// With only one capture group in the RegExp, we can safely take the first index from the match.
var linkString = match[0];
if (linkString.indexOf('target=') === -1) {
var fixedLinkString = linkString.replace(/>$/, ' target="_blank">');
htmlText = htmlText.replace(linkString, fixedLinkString);
}
}
return htmlText;
}
/**
* Fix shortcut. Mac use Command, others use Ctrl.
@ -1477,13 +1497,16 @@ EasyMDE.prototype.markdown = function (text) {
}
}
// Set options
marked.setOptions(markedOptions);
// Convert the markdown to HTML
var htmlText = marked(text);
// Edit the HTML anchors to add 'target="_blank"' by default.
htmlText = addAnchorTargetBlank(htmlText);
// Return
return marked(text);
return htmlText;
}
};
@ -1548,6 +1571,13 @@ EasyMDE.prototype.render = function (el) {
mode.gitHubSpice = false;
}
// eslint-disable-next-line no-unused-vars
function configureMouse(cm, repeat, event) {
return {
addNew: false
};
}
this.codemirror = CodeMirror.fromTextArea(el, {
mode: mode,
backdrop: backdrop,
@ -1562,6 +1592,7 @@ EasyMDE.prototype.render = function (el) {
allowDropFileTypes: ['text/plain'],
placeholder: options.placeholder || el.getAttribute('placeholder') || '',
styleSelectedText: (options.styleSelectedText != undefined) ? options.styleSelectedText : !isMobile(),
configureMouse: configureMouse
});
this.codemirror.getScrollerElement().style.minHeight = options.minHeight;

Loading…
Cancel
Save