Skip to content

Commit

Permalink
5.22.1
Browse files Browse the repository at this point in the history
  • Loading branch information
j0k3r committed Sep 29, 2016
1 parent f032037 commit 8a4d2f9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
38 changes: 33 additions & 5 deletions dist/js/medium-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ if (!("classList" in document.createElement("_"))) {

(function (root, factory) {
'use strict';
var isElectron = typeof module === 'object' && process && process.versions && process.versions.electron;
var isElectron = typeof module === 'object' && typeof process !== 'undefined' && process && process.versions && process.versions.electron;
if (!isElectron && typeof module === 'object') {
module.exports = factory;
} else if (typeof define === 'function' && define.amd) {
Expand Down Expand Up @@ -3864,19 +3864,47 @@ MediumEditor.extensions = {};
this.base.checkSelection();
},

ensureEncodedUri: function (str) {
return str === decodeURI(str) ? encodeURI(str) : str;
},

ensureEncodedUriComponent: function (str) {
return str === decodeURIComponent(str) ? encodeURIComponent(str) : str;
},

ensureEncodedParam: function (param) {
var split = param.split('='),
key = split[0],
val = split[1];

return key + (val === undefined ? '' : '=' + this.ensureEncodedUriComponent(val));
},

ensureEncodedQuery: function (queryString) {
return queryString.split('&').map(this.ensureEncodedParam.bind(this)).join('&');
},

checkLinkFormat: function (value) {
// Matches any alphabetical characters followed by ://
// Matches protocol relative "//"
// Matches common external protocols "mailto:" "tel:" "maps:"
// Matches relative hash link, begins with "#"
var urlSchemeRegex = /^([a-z]+:)?\/\/|^(mailto|tel|maps):|^\#/i,
// var te is a regex for checking if the string is a telephone number
telRegex = /^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/;
// telRegex is a regex for checking if the string is a telephone number
telRegex = /^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/,
split = value.split('?'),
path = split[0],
query = split[1];

if (telRegex.test(value)) {
return 'tel:' + value;
} else {
// Check for URL scheme and default to http:// if none found
return (urlSchemeRegex.test(value) ? '' : 'http://') + encodeURI(value);
return (urlSchemeRegex.test(value) ? '' : 'http://') +
// Ensure path is encoded
this.ensureEncodedUri(path) +
// Ensure query is encoded
(query === undefined ? '' : '?' + this.ensureEncodedQuery(query));
}
},

Expand Down Expand Up @@ -7798,7 +7826,7 @@ MediumEditor.parseVersionString = function (release) {

MediumEditor.version = MediumEditor.parseVersionString.call(this, ({
// grunt-bump looks for this:
'version': '5.22.0'
'version': '5.22.1'
}).version);

return MediumEditor;
Expand Down
8 changes: 4 additions & 4 deletions dist/js/medium-editor.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "medium-editor",
"version": "5.22.0",
"version": "5.22.1",
"author": "Davi Ferreira <hi@daviferreira.com>",
"contributors": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/js/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ MediumEditor.parseVersionString = function (release) {

MediumEditor.version = MediumEditor.parseVersionString.call(this, ({
// grunt-bump looks for this:
'version': '5.22.0'
'version': '5.22.1'
}).version);

0 comments on commit 8a4d2f9

Please sign in to comment.