Socket
Socket
Sign inDemoInstall

medium-editor

Package Overview
Dependencies
Maintainers
3
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

medium-editor - npm Package Compare versions

Comparing version 4.6.0 to 4.7.0

.jscsrc

2

bower.json
{
"name": "medium-editor",
"version": "4.6.0",
"version": "4.7.0",
"homepage": "http://daviferreira.github.io/medium-editor/",

@@ -5,0 +5,0 @@ "authors": [

@@ -0,1 +1,7 @@

4.7.0 / 2015-04-27
==================
* Expose importSelection + exportSelection helper methods
* Fix issue with initilization of MediumEditor using textarea
* Introduce jscs
4.6.0 / 2015-04-22

@@ -2,0 +8,0 @@ ==================

@@ -24,5 +24,5 @@ /*global module, require, process*/

'src/js/paste.js',
'src/js/extension-anchor.js',
'src/js/extension-anchor-preview.js',
'src/js/extension-fontsize.js',
'src/js/extensions/anchor.js',
'src/js/extensions/anchor-preview.js',
'src/js/extensions/fontsize.js',
'src/js/toolbar.js',

@@ -35,29 +35,29 @@ 'src/js/placeholders.js',

],
browsers = [ {
browserName: "internet explorer",
version: "9",
platform: "WIN7"
browsers = [{
browserName: 'internet explorer',
version: '9',
platform: 'WIN7'
}, {
browserName: "internet explorer",
version: "10",
platform: "WIN8"
browserName: 'internet explorer',
version: '10',
platform: 'WIN8'
}, {
browserName: "internet explorer",
version: "11",
platform: "WIN8.1"
browserName: 'internet explorer',
version: '11',
platform: 'WIN8.1'
}, {
browserName: "chrome",
platform: "WIN8.1"
browserName: 'chrome',
platform: 'WIN8.1'
}, {
browserName: "firefox",
platform: "WIN8.1"
browserName: 'firefox',
platform: 'WIN8.1'
}, {
browserName: "safari",
platform: "OS X 10.10"
browserName: 'safari',
platform: 'OS X 10.10'
}, {
browserName: "firefox",
platform: "OS X 10.10"
browserName: 'firefox',
platform: 'OS X 10.10'
}, {
browserName: "googlechrome",
platform: "OS X 10.10"
browserName: 'googlechrome',
platform: 'OS X 10.10'
}];

@@ -90,2 +90,15 @@

// TODO: "maximumLineLength": 120
gruntConfig.jscs = {
src: [
'src/js/**/*.js',
'spec/*.spec.js',
'Gruntfile.js',
'!src/js/polyfills.js'
],
options: {
config: '.jscsrc'
}
};
gruntConfig.jasmine = {

@@ -273,3 +286,3 @@ suite: {

gruntConfig.coveralls = {
gruntConfig.coveralls = {
dist: {

@@ -282,3 +295,3 @@ src: 'reports/jasmine/lcov/lcov.info'

options: {
files: ['bower.json', 'package.json','src/js/version.js'],
files: ['bower.json', 'package.json', 'src/js/version.js'],
updateConfigs: [],

@@ -302,10 +315,10 @@ commit: false,

if (parseInt(process.env.TRAVIS_PULL_REQUEST, 10) > 0) {
grunt.registerTask('travis', ['jshint', 'jasmine:suite', 'csslint', 'coveralls']);
grunt.registerTask('travis', ['jshint', 'jscs', 'jasmine:suite', 'csslint', 'coveralls']);
} else {
grunt.registerTask('travis', ['connect', 'jshint', 'jasmine:suite', 'csslint', 'saucelabs-jasmine', 'coveralls']);
grunt.registerTask('travis', ['connect', 'jshint', 'jscs', 'jasmine:suite', 'csslint', 'saucelabs-jasmine', 'coveralls']);
}
grunt.registerTask('test', ['jshint', 'concat', 'jasmine:suite', 'csslint']);
grunt.registerTask('test', ['jshint', 'jscs', 'concat', 'jasmine:suite', 'csslint']);
grunt.registerTask('sauce', ['connect', 'saucelabs-jasmine']);
grunt.registerTask('js', ['jshint', 'concat', 'jasmine:suite', 'uglify']);
grunt.registerTask('js', ['jshint', 'jscs', 'concat', 'jasmine:suite', 'uglify']);
grunt.registerTask('css', ['sass', 'autoprefixer', 'cssmin', 'csslint']);

@@ -312,0 +325,0 @@ grunt.registerTask('default', ['js', 'css']);

{
"name": "medium-editor",
"version": "4.6.0",
"version": "4.7.0",
"author": "Davi Ferreira <hi@daviferreira.com>",

@@ -51,2 +51,3 @@ "contributors": [

"grunt-coveralls": "1.0.0",
"grunt-jscs": "1.6.0",
"grunt-plato": "1.3.0",

@@ -53,0 +54,0 @@ "grunt-sass": "0.18.1",

@@ -206,2 +206,4 @@ # MediumEditor

* __.selectElement(element)__: change selection to be a specific element and update the toolbar to reflect the selection
* __.exportSelection()__: return a data representation of the selected text, which can be applied via `importSelection()`
* __.importSelection(selectionState)__: restore the selection using a data representation of previously selected text (ie value returned by `exportSelection()`)

@@ -220,3 +222,3 @@ ## Capturing DOM changes

`input` is supported by Chrome, Firefox, IE9 and other modern browsers. If you want to read more or support older browsers, check [Listening to events of a contenteditable HTML element](http://stackoverflow.com/questions/7802784/listening-to-events-of-a-contenteditable-html-element/7804973#7804973) and [Detect changes in the DOM](http://stackoverflow.com/questions/3219758/detect-changes-in-the-dom)
`input` is supported by Chrome, Firefox, and other modern browsers (However, [it is not supported in IE 9-11](https://connect.microsoft.com/IE/feedback/details/794285/ie10-11-input-event-does-not-fire-on-div-with-contenteditable-set)). If you want to read more or support older browsers, check [Listening to events of a contenteditable HTML element](http://stackoverflow.com/questions/7802784/listening-to-events-of-a-contenteditable-html-element/7804973#7804973) and [Detect changes in the DOM](http://stackoverflow.com/questions/3219758/detect-changes-in-the-dom)

@@ -237,4 +239,9 @@ ## Extensions & Plugins

These are the available grunt tasks:
To run all the test and build the dist files for testing on demo pages, just invoke:
```bash
grunt
```
These are the other available grunt tasks:
* __js__: runs jslint and jasmine tests and creates minified and concatenated versions of the script;

@@ -244,4 +251,5 @@ * __css__: runs autoprefixer and csslint

* __watch__: watch for modifications on script/scss files
* __spec__: runs a task against a specified file
The source files are located inside the __src__ directory.
The source files are located inside the __src__ directory. Be sure to make changes to these files and not files in the dist directory.

@@ -260,2 +268,4 @@ ## Contributing

Looking for something simple for a first contribution? Try fixing an [easy first bug](https://github.com/daviferreira/medium-editor/issues?q=is%3Aopen+is%3Aissue+label%3A%22easy+first+bug%22)!
## Contributors

@@ -262,0 +272,0 @@

@@ -63,3 +63,3 @@ /*global MediumEditor, describe, it, expect, spyOn,

it('should be displayed on hover of a link element with markup inside', function () {
it('should be displayed on hover of a link element with markup inside', function () {
var editor = new MediumEditor('.editor', {

@@ -70,3 +70,2 @@ delay: 200

// show preview

@@ -73,0 +72,0 @@ spyOn(MediumEditor.statics.AnchorPreview.prototype, 'showPreview').and.callThrough();

@@ -265,3 +265,3 @@ /*global MediumEditor, describe, it, expect, spyOn,

spyOn(document, "queryCommandState").and.throwError("DOM ERROR");
spyOn(document, 'queryCommandState').and.throwError('DOM ERROR');

@@ -331,3 +331,3 @@ this.el.innerHTML = '<b><i><u>lorem ipsum</u></i></b>';

spyOn(document, "queryCommandState").and.throwError("DOM ERROR");
spyOn(document, 'queryCommandState').and.throwError('DOM ERROR');

@@ -382,3 +382,3 @@ this.el.innerHTML = '<i><b><u>lorem ipsum</u></b></i>';

spyOn(document, "queryCommandState").and.throwError("DOM ERROR");
spyOn(document, 'queryCommandState').and.throwError('DOM ERROR');

@@ -433,3 +433,3 @@ this.el.innerHTML = '<u><b><i>lorem ipsum</i></b></u>';

spyOn(document, "queryCommandState").and.throwError("DOM ERROR");
spyOn(document, 'queryCommandState').and.throwError('DOM ERROR');

@@ -707,17 +707,17 @@ this.el.innerHTML = '<strike><b><i>lorem ipsum</i></b></strike>';

this.el.innerHTML = "<p>foo<b>bar</b><i>baz</i><strong>bam</strong></p>";
this.el.innerHTML = '<p>foo<b>bar</b><i>baz</i><strong>bam</strong></p>';
selectElementContentsAndFire(editor.elements[0].querySelector('p'));
fireEvent(button, "click");
expect(this.el.innerHTML).toBe("<p>foobarbazbam</p>");
fireEvent(button, 'click');
expect(this.el.innerHTML).toBe('<p>foobarbazbam</p>');
this.el.innerHTML = "<div><p><b>foo</b></p><p><i>bar</i></p><ul><li>on<b>e</b></li></ul></div>";
this.el.innerHTML = '<div><p><b>foo</b></p><p><i>bar</i></p><ul><li>on<b>e</b></li></ul></div>';
selectElementContentsAndFire(editor.elements[0].querySelector('div'));
fireEvent(button, "click");
expect(this.el.innerHTML).toBe("<div><p>foo</p><p>bar</p><ul><li>one</li></ul></div>");
fireEvent(button, 'click');
expect(this.el.innerHTML).toBe('<div><p>foo</p><p>bar</p><ul><li>one</li></ul></div>');
// TODO: IE does not unwrap something like <p><span style='color:red'>bar</span></p>
this.el.innerHTML = "<div><h2>b<i>a</i>r</h2><p><em><strong><u><sub><sup>foo</sup></sub></u></strong></em></p><pre>foo<i>bar</i>baz</pre></div>";
this.el.innerHTML = '<div><h2>b<i>a</i>r</h2><p><em><strong><u><sub><sup>foo</sup></sub></u></strong></em></p><pre>foo<i>bar</i>baz</pre></div>';
selectElementContentsAndFire(editor.elements[0].querySelector('div'));
fireEvent(button, "click");
expect(this.el.innerHTML).toBe("<div><h2>bar</h2><p>foo</p><pre>foobarbaz</pre></div>");
fireEvent(button, 'click');
expect(this.el.innerHTML).toBe('<div><h2>bar</h2><p>foo</p><pre>foobarbaz</pre></div>');

@@ -724,0 +724,0 @@ });

@@ -215,12 +215,12 @@ /*global MediumEditor, describe, it, expect, spyOn,

describe('spellcheck', function () {
it('should have spellcheck attribute set to true by default', function () {
var editor = new MediumEditor('.editor');
expect(editor.elements[0].getAttribute('spellcheck')).toBe('true');
});
it('should have spellcheck attribute set to true by default', function () {
var editor = new MediumEditor('.editor');
expect(editor.elements[0].getAttribute('spellcheck')).toBe('true');
});
it('should accept spellcheck as an options', function () {
var editor = new MediumEditor('.editor', {spellcheck: false});
expect(editor.elements[0].getAttribute('spellcheck')).toBe('false');
});
it('should accept spellcheck as an options', function () {
var editor = new MediumEditor('.editor', { spellcheck: false });
expect(editor.elements[0].getAttribute('spellcheck')).toBe('false');
});
});
});

@@ -23,3 +23,3 @@ /*global MediumEditor, describe, it, expect, jasmine,

editor = new MediumEditor('.editor', {delay: 100});
editor = new MediumEditor('.editor', { delay: 100 });
spy = jasmine.createSpy('spy');

@@ -35,3 +35,3 @@ editor.delay(spy);

editor = new MediumEditor('.editor', {delay: 1});
editor = new MediumEditor('.editor', { delay: 1 });
spy = jasmine.createSpy('spy');

@@ -38,0 +38,0 @@

@@ -53,4 +53,8 @@ /*global MediumEditor, describe, it, expect, jasmine,

blurredEditable,
focusListener = function (event, editable) { focusedEditable = editable; },
blurListener = function (event, editable) { blurredEditable = editable; };
focusListener = function (event, editable) {
focusedEditable = editable;
},
blurListener = function (event, editable) {
blurredEditable = editable;
};
editor.subscribe('focus', focusListener);

@@ -57,0 +61,0 @@ editor.subscribe('blur', blurListener);

@@ -91,3 +91,3 @@ /*global MediumEditor, describe, it, expect, spyOn,

it("exists", function(){
it('exists', function () {
expect(MediumEditor.Extension).toBeTruthy();

@@ -97,13 +97,13 @@ expect(MediumEditor.Extension).toBe(Extension);

it("provides an .extend method", function() {
it('provides an .extend method', function () {
expect(Extension.extend).toBeTruthy();
var Extended = Extension.extend({
foo: "bar"
foo: 'bar'
});
expect(Extended.prototype.foo).toBe("bar");
expect(Extended.prototype.foo).toBe('bar');
expect(Extended.extend).toBe(Extension.extend);
});
it("can be passed as an extension", function(){
it('can be passed as an extension', function () {

@@ -120,8 +120,8 @@ var Sub, editor, e1, e2;

spyOn(e1, "init");
spyOn(e1, 'init');
editor = new MediumEditor(".editor", {
editor = new MediumEditor('.editor', {
extensions: {
"foo": e1,
"bar": e2
'foo': e1,
'bar': e2
}

@@ -128,0 +128,0 @@ });

@@ -9,8 +9,8 @@ /*global MediumEditor, describe, it, expect, spyOn,

function testFontSizeContents (el, size) {
expect(el.childNodes.length).toBe(1);
var child = el.childNodes[0];
expect(child.tagName).toBe('FONT');
expect(child.getAttribute('size')).toBe(size);
expect(child.innerHTML).toBe('lorem ipsum');
function testFontSizeContents(el, size) {
expect(el.childNodes.length).toBe(1);
var child = el.childNodes[0];
expect(child.tagName).toBe('FONT');
expect(child.getAttribute('size')).toBe(size);
expect(child.innerHTML).toBe('lorem ipsum');
}

@@ -20,3 +20,3 @@

jasmine.clock().install();
this.mediumOpts = {buttons: ['fontsize']};
this.mediumOpts = { buttons: ['fontsize'] };
this.el = document.createElement('div');

@@ -23,0 +23,0 @@ this.el.className = 'editor';

@@ -26,3 +26,3 @@ /*global MediumEditor, describe, it, expect, afterEach,

var editor = new MediumEditor('.editor'),
el = document.getElementById("header"),
el = document.getElementById('header'),
range = document.createRange(),

@@ -39,7 +39,5 @@ sel = window.getSelection();

el = document.getElementById("header");
el = document.getElementById('header');
expect(el).toBeDefined();
expect(el.tagName).toBe('H2');
});

@@ -52,3 +50,3 @@

var editor = new MediumEditor('.editor'),
el = document.getElementById("header"),
el = document.getElementById('header'),
range = document.createRange(),

@@ -64,3 +62,3 @@ sel = window.getSelection();

el = document.getElementById("header");
el = document.getElementById('header');
expect(el.previousElementSibling.tagName).toBe('P');

@@ -75,4 +73,4 @@

var editor = new MediumEditor('.editor'),
originalHTML = document.getElementById("editor").innerHTML,
el = document.getElementById("header"),
originalHTML = document.getElementById('editor').innerHTML,
el = document.getElementById('header'),
range = document.createRange(),

@@ -88,7 +86,7 @@ sel = window.getSelection();

el = document.getElementById("header");
el = document.getElementById('header');
expect(el).toBeDefined();
expect(el.tagName).toBe('H2');
el = document.getElementById("editor");
el = document.getElementById('editor');
expect(el.innerHTML).not.toBe(originalHTML);

@@ -95,0 +93,0 @@

/*global atob, unescape, Uint8Array, Blob*/
function isIE9() {
return navigator.appName.indexOf("Internet Explorer") !== -1 && navigator.appVersion.indexOf("MSIE 9") !== -1;
return navigator.appName.indexOf('Internet Explorer') !== -1 && navigator.appVersion.indexOf("MSIE 9") !== -1;
}
function isIE10() {
return navigator.appName.indexOf("Internet Explorer") !== -1 && navigator.appVersion.indexOf("MSIE 10") !== -1;
return navigator.appName.indexOf('Internet Explorer') !== -1 && navigator.appVersion.indexOf("MSIE 10") !== -1;
}

@@ -20,3 +20,3 @@

function isFirefox() {
return navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
return navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
}

@@ -57,3 +57,3 @@

// dispatch for firefox + others
evt = document.createEvent("HTMLEvents");
evt = document.createEvent('HTMLEvents');
evt.initEvent(event, true, true); // event type,bubbling,cancelable

@@ -60,0 +60,0 @@

@@ -36,3 +36,3 @@ /*global MediumEditor, describe, it, expect, spyOn,

source: 'Microsoft Word - line breaks',
paste: "<p>One\nTwo\n</p>\n\n<p>Three Four</p>",
paste: '<p>One\nTwo\n</p>\n\n<p>Three Four</p>',
output: '<p>One Two </p><p>Three Four</p>'

@@ -42,3 +42,3 @@ },

source: 'Microsoft Word - Proprietary elements',
paste: "<p>One<o:p></o:p></p><p>Two<o:p></o:p></p>",
paste: '<p>One<o:p></o:p></p><p>Two<o:p></o:p></p>',
output: '<p>One</p><p>Two</p>'

@@ -51,3 +51,3 @@ }

paste: '<meta charset=\'utf-8\'><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-2f060cc5-1888-a396-af95-bfb31478c7ae"><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:bold;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">Bold,</span><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;"> </span><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:italic;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">italic,</span><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;"> </span><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:bold;font-style:italic;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">bold and italic</span><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">, and </span><a href="http://en.wikipedia.org/wiki/Link_(The_Legend_of_Zelda)" style="text-decoration:none;"><span style="font-size:15px;font-family:Arial;color:#1155cc;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;">a link</span></a><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">.</span></b>',
output: "<b>Bold,</b> <i>italic,</i> <b><i>bold and italic</i></b>, and <a href=\"http://en.wikipedia.org/wiki/Link_\\(The_Legend_of_Zelda\\)\">a link</a>\\."
output: '<b>Bold,</b> <i>italic,</i> <b><i>bold and italic</i></b>, and <a href="http://en.wikipedia.org/wiki/Link_\\(The_Legend_of_Zelda\\)">a link</a>\\.'
},

@@ -57,3 +57,3 @@ {

paste: '<meta charset=\'utf-8\'><b style="color: rgb(0, 0, 0); font-family: \'Helvetica Neue\', Helvetica, Arial, sans-serif; font-size: 22.22222328186035px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 30px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Bold,</b><span style="color: rgb(0, 0, 0); font-family: \'Helvetica Neue\', Helvetica, Arial, sans-serif; font-size: 22.22222328186035px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;"> </span><i style="color: rgb(0, 0, 0); font-family: \'Helvetica Neue\', Helvetica, Arial, sans-serif; font-size: 22.22222328186035px; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">italic,</i><span style="color: rgb(0, 0, 0); font-family: \'Helvetica Neue\', Helvetica, Arial, sans-serif; font-size: 22.22222328186035px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;"><span class="Apple-converted-space"> </span></span><b style="color: rgb(0, 0, 0); font-family: \'Helvetica Neue\', Helvetica, Arial, sans-serif; font-size: 22.22222328186035px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 30px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><i>bold and italic</i></b><span style="color: rgb(0, 0, 0); font-family: \'Helvetica Neue\', Helvetica, Arial, sans-serif; font-size: 22.22222328186035px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">, and<span class="Apple-converted-space"> </span></span><a href="http://en.wikipedia.org/wiki/Link_(The_Legend_of_Zelda)" style="color: black; font-family: \'Helvetica Neue\', Helvetica, Arial, sans-serif; font-size: 22.22222328186035px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">a link</a><span style="color: rgb(0, 0, 0); font-family: \'Helvetica Neue\', Helvetica, Arial, sans-serif; font-size: 22.22222328186035px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">.</span>',
output: "<b>Bold,</b> <i>italic,</i> <b><i>bold and italic</i></b>, and <a href=\"http://en.wikipedia.org/wiki/Link_\\(The_Legend_of_Zelda\\)\">a link</a>\\."
output: '<b>Bold,</b> <i>italic,</i> <b><i>bold and italic</i></b>, and <a href="http://en.wikipedia.org/wiki/Link_\\(The_Legend_of_Zelda\\)">a link</a>\\.'
},

@@ -68,14 +68,14 @@ {

{
source: "Text single word",
paste: "supercalifragilisticexpalidocious",
source: 'Text single word',
paste: 'supercalifragilisticexpalidocious',
output: '<div id="editor-inner">supercalifragilisticexpalidocious</div>'
},
{
source: "Text single word with leading/trailing space",
paste: " supercalifragilisticexpalidocious ",
source: 'Text single word with leading/trailing space',
paste: ' supercalifragilisticexpalidocious ',
output: '<div id="editor-inner"> supercalifragilisticexpalidocious </div>'
},
{
source: "Text multi-word with no line breaks",
paste: "Their relationship consisted in discussing if it existed",
source: 'Text multi-word with no line breaks',
paste: 'Their relationship consisted in discussing if it existed',
output: '<div id="editor-inner">Their relationship consisted in discussing if it existed</div>'

@@ -154,3 +154,3 @@ },

spyOn(document, "queryCommandSupported").and.returnValue(false);
spyOn(document, 'queryCommandSupported').and.returnValue(false);

@@ -191,3 +191,3 @@ multiLineTests.forEach(function (test) {

// Webkit: doing an insertHTML while this <span> is selected results in the span being replaced completely
expect(editorEl.innerHTML).toMatch(new RegExp("^Before(&nbsp;|\\s)(<span id=\"editor-inner\">)?" + inlineTests[i].output + "(</span>)?(&nbsp;|\\s)after\\.$"));
expect(editorEl.innerHTML).toMatch(new RegExp('^Before(&nbsp;|\\s)(<span id="editor-inner">)?' + inlineTests[i].output + '(</span>)?(&nbsp;|\\s)after\\.$'));
}

@@ -220,3 +220,3 @@ });

// Webkit: doing an insertHTML while this <span> is selected results in the span being replaced completely
expect(editorEl.innerHTML).toMatch(new RegExp("^Before(&nbsp;|\\s)(<span id=\"editor-inner\">)?" + inlineTests[i].output + "(</span>)?(&nbsp;|\\s)after\\.$"));
expect(editorEl.innerHTML).toMatch(new RegExp('^Before(&nbsp;|\\s)(<span id="editor-inner">)?' + inlineTests[i].output + '(</span>)?(&nbsp;|\\s)after\\.$'));
}

@@ -233,3 +233,3 @@ });

spyOn(document, "queryCommandSupported").and.returnValue(false);
spyOn(document, 'queryCommandSupported').and.returnValue(false);

@@ -246,3 +246,3 @@ inlineTests.forEach(function (test) {

// Webkit: doing an insertHTML while this <span> is selected results in the span being replaced completely
expect(this.el.innerHTML).toMatch(new RegExp("^Before(&nbsp;|\\s)(<span id=\"editor-inner\">)?" + test.output + "(</span>)?(&nbsp;|\\s)after\\.$"));
expect(this.el.innerHTML).toMatch(new RegExp('^Before(&nbsp;|\\s)(<span id="editor-inner">)?' + test.output + '(</span>)?(&nbsp;|\\s)after\\.$'));
}.bind(this));

@@ -265,3 +265,3 @@ });

expect(this.el.innerHTML).toMatch(new RegExp("^Before(&nbsp;|\\s)(<span id=\"editor-inner\">)?<sub>div one</sub><sub>div two</sub>(</span>)?(&nbsp;|\\s)after\\.$"));
expect(this.el.innerHTML).toMatch(new RegExp('^Before(&nbsp;|\\s)(<span id="editor-inner">)?<sub>div one</sub><sub>div two</sub>(</span>)?(&nbsp;|\\s)after\\.$'));
});

@@ -283,3 +283,3 @@ });

'<table class="medium-editor-table" dir="ltr" style="border: 1px solid red;"><tbody><tr><td>test</td></tr></tbody></table>',
{cleanAttrs: ['style', 'dir']}
{ cleanAttrs: ['style', 'dir'] }
);

@@ -294,3 +294,3 @@ expect(editor.elements[0].innerHTML).toBe('<table class="medium-editor-table"><tbody><tr><td>test</td></tr></tbody></table>');

'<div><i>test</i><meta name="description" content="test" /><b>test</b></div>',
{cleanTags: ['meta', 'b']}
{ cleanTags: ['meta', 'b'] }
);

@@ -376,3 +376,3 @@ expect(editor.elements[0].innerHTML).toBe('<div><i>test</i></div>');

selectElementContents(this.el.firstChild);
editor.cleanPaste("<p>One\nTwo\n</p>\n\n<p>Three Four</p>");
editor.cleanPaste('<p>One\nTwo\n</p>\n\n<p>Three Four</p>');
expect(editor.elements[0].innerHTML).toBe('<p>One Two </p><p>Three Four</p>');

@@ -379,0 +379,0 @@ });

@@ -88,3 +88,3 @@ /*global MediumEditor, describe, it, expect,

} else {
expect(placeholder).toEqual("'" + expectedValue + "'");
expect(placeholder).toEqual('\'' + expectedValue + '\'');
}

@@ -91,0 +91,0 @@ }

@@ -23,3 +23,3 @@ /*global MediumEditor, describe, it, expect, spyOn,

describe('Exposure', function () {
it("is exposed on the MediumEditor ctor", function () {
it('is exposed on the MediumEditor ctor', function () {
expect(MediumEditor.selection).toBeTruthy();

@@ -30,2 +30,40 @@ expect(MediumEditor.selection).toEqual(Selection);

describe('Export/Import Selection', function () {
it('should be able to import an exported selection', function () {
this.el.innerHTML = 'lorem <i>ipsum</i> dolor';
var editor = new MediumEditor('.editor', {
buttons: ['italic', 'underline', 'strikethrough']
});
selectElementContents(editor.elements[0].querySelector('i'));
var exportedSelection = editor.exportSelection();
expect(Object.keys(exportedSelection).sort()).toEqual(['end', 'start']);
selectElementContents(editor.elements[0]);
expect(exportedSelection).not.toEqual(editor.exportSelection());
editor.importSelection(exportedSelection);
expect(exportedSelection).toEqual(editor.exportSelection());
});
it('should have an index in the exported selection when it is in the second contenteditable', function () {
var el2 = document.createElement('div');
el2.className = 'editor';
el2.innerHTML = 'lorem <i>ipsum</i> dolor';
try {
document.body.appendChild(el2);
var editor = new MediumEditor('.editor', {
buttons: ['italic', 'underline', 'strikethrough']
});
selectElementContents(editor.elements[1].querySelector('i'));
var exportedSelection = editor.exportSelection();
expect(Object.keys(exportedSelection).sort()).toEqual(['editableElementIndex', 'end', 'start']);
expect(exportedSelection.editableElementIndex).toEqual(1);
} finally {
document.body.removeChild(el2);
}
});
});
describe('Saving Selection', function () {

@@ -51,3 +89,3 @@ it('should be applicable if html changes but text does not', function () {

// Restore selection back to <i> tag and add a <strike> tag
regex = new RegExp("^<u>lorem (<i><strike>|<strike><i>)ipsum(</i></strike>|</strike></i>) dolor</u>$");
regex = new RegExp('^<u>lorem (<i><strike>|<strike><i>)ipsum(</i></strike>|</strike></i>) dolor</u>$');
editor.restoreSelection();

@@ -54,0 +92,0 @@ button = editor.toolbar.getToolbarElement().querySelector('[data-action="strikethrough"]');

@@ -55,3 +55,3 @@ /*global MediumEditor, describe, it, expect, spyOn, jasmine,

it('should know about defaults', function() {
it('should know about defaults', function () {
expect(MediumEditor.prototype.defaults).toBe(editorDefaults);

@@ -88,3 +88,3 @@ });

editor = new MediumEditor('.editor', {delay: 5});
editor = new MediumEditor('.editor', { delay: 5 });
triggerEvents = function () {

@@ -91,0 +91,0 @@ fireEvent(window, 'resize');

@@ -11,2 +11,8 @@ /*global describe, it, beforeEach, afterEach, tearDown, expect,

this.el.value = 'test content';
this.el.setAttribute('data-disable-toolbar', false);
this.el.setAttribute('data-placeholder', 'Something');
this.el.setAttribute('data-disable-return', false);
this.el.setAttribute('data-disable-double-return', false);
this.el.setAttribute('data-disable-preview', false);
this.el.setAttribute('spellcheck', true);
document.body.appendChild(this.el);

@@ -23,5 +29,17 @@ });

it('should accept a textarea element and "convert" it to a div', function () {
var editor = new MediumEditor('.editor');
it('should accept a textarea element and "convert" it to a div, preserving important attributes', function () {
var editor = new MediumEditor('.editor'),
textarea = this.el;
expect(editor.elements[0].tagName.toLowerCase()).toBe('div');
var attributesToPreserve = ['data-disable-editing',
'data-disable-toolbar',
'data-placeholder',
'data-disable-return',
'data-disable-double-return',
'data-disable-preview',
'spellcheck'];
attributesToPreserve.forEach(function (attr) {
expect(editor.elements[0].getAttribute(attr)).toBe(textarea.getAttribute(attr));
});
});

@@ -28,0 +46,0 @@

@@ -140,3 +140,3 @@ /*global MediumEditor, describe, it, expect, spyOn,

outsideElement.setAttribute('style', '-webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;');
outsideElement.innerHTML = "Click Me, I don't clear selection";
outsideElement.innerHTML = 'Click Me, I don\'t clear selection';
document.body.appendChild(outsideElement);

@@ -329,3 +329,3 @@

it('should show the toolbar if it\'s text are selected even though one or more elements that has a data attr of disable-toolbar', function () {
it('should show the toolbar if its text are selected even though one or more elements that has a data attr of disable-toolbar', function () {
var editor,

@@ -341,3 +341,3 @@ element = document.createElement('div');

expect(editor.toolbar.getToolbarElement().style.display).toBe('');
selectElementContentsAndFire(this.el, { eventToFire: 'focus'});
selectElementContentsAndFire(this.el, { eventToFire: 'focus' });

@@ -344,0 +344,0 @@ expect(editor.toolbar.getToolbarElement().classList.contains('medium-editor-toolbar-active')).toBe(true);

@@ -8,3 +8,3 @@ /*global MediumEditor, Util, describe, it, expect, spyOn */

it("is exposed on the MediumEditor ctor", function () {
it('is exposed on the MediumEditor ctor', function () {
expect(MediumEditor.util).toBeTruthy();

@@ -18,9 +18,9 @@ expect(MediumEditor.util).toEqual(Util);

it('should overwrite values from right to left', function () {
var objOne = { one: "one" };
var objTwo = { one: "two", three: "three" };
var objThree = { three: "four", five: "six" };
var objFour;
var result = MediumEditor.util.extend({}, objOne, objTwo, objThree, objFour);
// expect(_.isEqual(result, { one: "two", three: "four", five: "six" })).toBe(true);
expect(result).toEqual({ one: "two", three: "four", five: "six" });
var objOne = { one: 'one' },
objTwo = { one: 'two', three: 'three' },
objThree = { three: 'four', five: 'six' },
objFour,
result = MediumEditor.util.extend({}, objOne, objTwo, objThree, objFour);
// expect(_.isEqual(result, { one: 'two', three: 'four', five: 'six' })).toBe(true);
expect(result).toEqual({ one: 'two', three: 'four', five: 'six' });
});

@@ -31,9 +31,9 @@ });

it('should overwrite values from left to right', function () {
var objOne = { one: "one" };
var objTwo = { one: "two", three: "three" };
var objThree = { three: "four", five: "six" };
var objFour;
var result = MediumEditor.util.defaults({}, objOne, objTwo, objThree, objFour);
// expect(_.isEqual(result, { one: "one", three: "three", five: "six" })).toBe(true);
expect(result).toEqual({ one: "one", three: "three", five: "six" });
var objOne = { one: 'one' },
objTwo = { one: 'two', three: 'three' },
objThree = { three: 'four', five: 'six' },
objFour,
result = MediumEditor.util.defaults({}, objOne, objTwo, objThree, objFour);
// expect(_.isEqual(result, { one: 'one', three: 'three', five: 'six' })).toBe(true);
expect(result).toEqual({ one: 'one', three: 'three', five: 'six' });
});

@@ -68,3 +68,3 @@ });

spyOn(Util, 'warn').and.callThrough();
Util.deprecated("old","new","11tybillion");
Util.deprecated('old', 'new', '11tybillion');
expect(Util.warn).toHaveBeenCalledWith(

@@ -78,18 +78,18 @@ 'old is deprecated, please use new instead. Will be removed in 11tybillion'

it("should get nested objects", function(){
it('should get nested objects', function () {
var obj = { a: { b: { c: { d: 10 } } } };
expect(Util.getObject("a.b.c.d", false, obj)).toBe(10);
expect(Util.getObject("a.b.c", false, obj)).toEqual({ d: 10 });
expect(Util.getObject("a", false, obj)).toEqual({ b: { c: { d: 10 }}});
expect(Util.getObject('a.b.c.d', false, obj)).toBe(10);
expect(Util.getObject('a.b.c', false, obj)).toEqual({ d: 10 });
expect(Util.getObject('a', false, obj)).toEqual({ b: { c: { d: 10 } } });
});
it("should create a path if told to", function(){
it('should create a path if told to', function () {
var obj = {};
expect(Util.getObject("a.b.c.d", true, obj)).toEqual({});
expect(Util.getObject('a.b.c.d', true, obj)).toEqual({});
expect(obj.a.b.c.d).toBeTruthy();
});
it("should NOT create a path", function() {
it('should NOT create a path', function () {
var obj = {};
expect(Util.getObject("a.b.c.d.e.f.g", false, obj)).toBe(undefined);
expect(Util.getObject('a.b.c.d.e.f.g', false, obj)).toBe(undefined);
expect(obj.a).toBe(undefined);

@@ -102,5 +102,5 @@ });

it("sets returns the value", function(){
it('sets returns the value', function () {
var obj = {};
expect(Util.setObject("a.b.c", 10, obj)).toBe(10);
expect(Util.setObject('a.b.c', 10, obj)).toBe(10);
expect(obj.a.b.c).toBe(10);

@@ -113,7 +113,7 @@ });

it("exists", function () {
expect(typeof Util.warn).toBe("function");
it('exists', function () {
expect(typeof Util.warn).toBe('function');
});
it("ends up calling console.warn", function () {
it('ends up calling console.warn', function () {
// IE9 mock for SauceLabs

@@ -132,4 +132,4 @@ if (window.console === undefined) {

var spy = spyOn(window.console.warn, "apply").and.callThrough();
Util.warn("message");
var spy = spyOn(window.console.warn, 'apply').and.callThrough();
Util.warn('message');
expect(spy).toHaveBeenCalled();

@@ -141,2 +141,1 @@ });

});

@@ -1,2 +0,2 @@

(function() {
(function () {
jasmine.getEnv().addReporter(new jasmine.JSReporter2()); //< for jsreporter

@@ -6,3 +6,3 @@

window.jasmine.getJSReport = function() {
window.jasmine.getJSReport = function () {
var results = oldFunc();

@@ -9,0 +9,0 @@ return removePassing(results);

/*global MediumEditor, describe, it, expect */
describe("Core MediumEditor", function () {
describe('Core MediumEditor', function () {
it("exists", function () {
it('exists', function () {
expect(MediumEditor).toBeTruthy();
});
describe("version", function () {
describe('version', function () {
it("exists", function () {
it('exists', function () {
expect(MediumEditor.version).toBeTruthy();
});
it("has major/minor/revision ints", function () {
it('has major/minor/revision ints', function () {
expect(MediumEditor.version.major).toBeDefined();

@@ -21,5 +21,5 @@ expect(MediumEditor.version.minor).toBeDefined();

it("exposes the major/minor/revison as a string", function () {
var v = "" + MediumEditor.version;
expect(typeof v).toEqual("string");
it('exposes the major/minor/revison as a string', function () {
var v = '' + MediumEditor.version;
expect(typeof v).toEqual('string');
});

@@ -29,2 +29,2 @@

});
});

@@ -165,3 +165,3 @@ /*global FileReader, Util, ButtonsData, DefaultButton,

files.some(function (file) {
if (file.type.match("image")) {
if (file.type.match('image')) {
var fileReader, id;

@@ -229,3 +229,13 @@ fileReader = new FileReader();

// Convert NodeList (or other array like object) into an array
this.elements = Array.prototype.slice.apply(selector);
var elements = Array.prototype.slice.apply(selector);
// Loop through elements and convert textarea's into divs
this.elements = [];
elements.forEach(function (element) {
if (element.tagName.toLowerCase() === 'textarea') {
this.elements.push(createContentEditable.call(this, element));
} else {
this.elements.push(element);
}
}, this);
}

@@ -273,6 +283,14 @@

function createContentEditable(index) {
var div = this.options.ownerDocument.createElement('div');
var id = (+new Date());
var textarea = this.elements[index];
function createContentEditable(textarea) {
var div = this.options.ownerDocument.createElement('div'),
id = (+new Date()),
attributesToClone = [
'data-disable-editing',
'data-disable-toolbar',
'data-placeholder',
'data-disable-return',
'data-disable-double-return',
'data-disable-preview',
'spellcheck'
];

@@ -282,4 +300,11 @@ div.className = textarea.className;

div.innerHTML = textarea.value;
div.setAttribute('medium-editor-textarea-id', id);
attributesToClone.forEach(function (attr) {
if (textarea.hasAttribute(attr)) {
div.setAttribute(attr, textarea.getAttribute(attr));
}
});
textarea.classList.add('medium-editor-hidden');
textarea.setAttribute('medium-editor-textarea-id', id);
textarea.parentNode.insertBefore(

@@ -290,5 +315,2 @@ div,

this.on(div, 'input', function () {
textarea.value = this.serialize()[id].value;
}.bind(this));
return div;

@@ -298,24 +320,36 @@ }

function initElements() {
var i,
addToolbar = false;
for (i = 0; i < this.elements.length; i += 1) {
if (!this.options.disableEditing && !this.elements[i].getAttribute('data-disable-editing')) {
if (this.elements[i].tagName.toLowerCase() === 'textarea') {
this.elements[i] = createContentEditable.call(this, i);
}
this.elements[i].setAttribute('contentEditable', true);
this.elements[i].setAttribute('spellcheck', this.options.spellcheck);
this.elements.forEach(function (element) {
if (!this.options.disableEditing && !element.getAttribute('data-disable-editing')) {
element.setAttribute('contentEditable', true);
element.setAttribute('spellcheck', this.options.spellcheck);
}
if (!this.elements[i].getAttribute('data-placeholder')) {
this.elements[i].setAttribute('data-placeholder', this.options.placeholder);
if (!element.getAttribute('data-placeholder')) {
element.setAttribute('data-placeholder', this.options.placeholder);
}
this.elements[i].setAttribute('data-medium-element', true);
this.elements[i].setAttribute('role', 'textbox');
this.elements[i].setAttribute('aria-multiline', true);
if (!this.options.disableToolbar && !this.elements[i].getAttribute('data-disable-toolbar')) {
addToolbar = true;
element.setAttribute('data-medium-element', true);
element.setAttribute('role', 'textbox');
element.setAttribute('aria-multiline', true);
if (element.hasAttribute('medium-editor-textarea-id')) {
this.on(element, 'input', function (event) {
var target = event.target,
textarea = target.parentNode.querySelector('textarea[medium-editor-textarea-id="' + target.getAttribute('medium-editor-textarea-id') + '"]');
if (textarea) {
textarea.value = this.serialize()[target.id].value;
}
}.bind(this));
}
}, this);
}
function initToolbar() {
if (this.toolbar || this.options.disableToolbar) {
return false;
}
// Init toolbar
if (!this.toolbar && addToolbar) {
var addToolbar = this.elements.some(function (element) {
return !element.getAttribute('data-disable-toolbar');
});
if (addToolbar) {
this.toolbar = new Toolbar(this);

@@ -372,4 +406,4 @@ this.options.elementsContainer.appendChild(this.toolbar.getToolbarElement());

targetBlank: this.options.targetBlank,
"window": this.options.contentWindow,
"document": this.options.ownerDocument
'window': this.options.contentWindow,
'document': this.options.ownerDocument
};

@@ -434,4 +468,4 @@

var nestedMerges = ['paste'];
var tempOpts = Util.extend({}, options);
var nestedMerges = ['paste'],
tempOpts = Util.extend({}, options);

@@ -529,4 +563,5 @@ nestedMerges.forEach(function (toMerge) {

// Call initialization helpers
initElements.call(this);
initCommands.call(this);
initElements.call(this);
initToolbar.call(this);
attachHandlers.call(this);

@@ -765,6 +800,5 @@

// TODO: move to selection.js and clean up old methods there
saveSelection: function () {
this.selectionState = null;
var selection = this.options.contentWindow.getSelection(),
exportSelection: function () {
var selectionState = null,
selection = this.options.contentWindow.getSelection(),
range,

@@ -793,3 +827,3 @@ preSelectionRange,

this.selectionState = {
selectionState = {
start: start,

@@ -801,13 +835,30 @@ end: start + range.toString().length,

}
if (selectionState !== null && selectionState.editableElementIndex === 0) {
delete selectionState.editableElementIndex;
}
return selectionState;
},
saveSelection: function () {
this.selectionState = this.exportSelection();
},
// http://stackoverflow.com/questions/17678843/cant-restore-selection-after-html-modify-even-if-its-the-same-html
// Tim Down
// TODO: move to selection.js and clean up old methods there
restoreSelection: function () {
if (!this.selectionState) {
importSelection: function (inSelectionState) {
if (!inSelectionState) {
return;
}
var editableElement = this.elements[this.selectionState.editableElementIndex],
var editableElementIndex = inSelectionState.editableElementIndex === undefined ?
0 : inSelectionState.editableElementIndex,
selectionState = {
editableElementIndex: editableElementIndex,
start: inSelectionState.start,
end: inSelectionState.end
},
editableElement = this.elements[selectionState.editableElementIndex],
charIndex = 0,

@@ -830,8 +881,8 @@ range = this.options.ownerDocument.createRange(),

nextCharIndex = charIndex + node.length;
if (!foundStart && this.selectionState.start >= charIndex && this.selectionState.start <= nextCharIndex) {
range.setStart(node, this.selectionState.start - charIndex);
if (!foundStart && selectionState.start >= charIndex && selectionState.start <= nextCharIndex) {
range.setStart(node, selectionState.start - charIndex);
foundStart = true;
}
if (foundStart && this.selectionState.end >= charIndex && this.selectionState.end <= nextCharIndex) {
range.setEnd(node, this.selectionState.end - charIndex);
if (foundStart && selectionState.end >= charIndex && selectionState.end <= nextCharIndex) {
range.setEnd(node, selectionState.end - charIndex);
stop = true;

@@ -857,2 +908,6 @@ }

restoreSelection: function () {
this.importSelection(this.selectionState);
},
createLink: function (opts) {

@@ -874,5 +929,5 @@ var customEvent,

if (this.options.targetBlank || opts.target === "_blank" || opts.buttonClass) {
customEvent = this.options.ownerDocument.createEvent("HTMLEvents");
customEvent.initEvent("input", true, true, this.options.contentWindow);
if (this.options.targetBlank || opts.target === '_blank' || opts.buttonClass) {
customEvent = this.options.ownerDocument.createEvent('HTMLEvents');
customEvent.initEvent('input', true, true, this.options.contentWindow);
for (i = 0; i < this.elements.length; i += 1) {

@@ -879,0 +934,0 @@ this.elements[i].dispatchEvent(customEvent);

var ButtonsData;
(function(){
(function () {
'use strict';

@@ -4,0 +4,0 @@

/*global PasteHandler */
var extensionDefaults;
(function(){
(function () {
// for now this is empty because nothing interally uses an Extension default.
// as they are converted, provide them here.
extensionDefaults = {
paste: PasteHandler
paste: PasteHandler
};
})();
})();
var editorDefaults;
(function(){
(function () {

@@ -4,0 +4,0 @@ // summary: The default options hash used by the Editor

@@ -0,6 +1,6 @@

/* global Util */
var Extension;
(function(){
/* global Util */
(function () {
Extension = function (options) {

@@ -35,3 +35,4 @@ Util.extend(this, options);

var parent = this, child;
var parent = this,
child;

@@ -42,6 +43,8 @@ // The constructor function for the new subclass is either defined by you

if (protoProps && protoProps.hasOwnProperty("constructor")) {
if (protoProps && protoProps.hasOwnProperty('constructor')) {
child = protoProps.constructor;
} else {
child = function () { return parent.apply(this, arguments); };
child = function () {
return parent.apply(this, arguments);
};
}

@@ -54,7 +57,11 @@

// `parent`'s constructor function.
var Surrogate = function(){ this.constructor = child; };
var Surrogate = function () {
this.constructor = child;
};
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate();
if (protoProps) { Util.extend(child.prototype, protoProps); }
if (protoProps) {
Util.extend(child.prototype, protoProps);
}

@@ -67,3 +74,3 @@ // todo: $super?

Extension.prototype = {
init: function(/* instance */){
init: function (/* instance */) {
// called when properly decorated and used.

@@ -184,3 +191,2 @@ // has a .base value pointing to the editor

/* onHide: [function ()]

@@ -193,3 +199,2 @@ *

};
})();
})();

@@ -17,4 +17,4 @@ /*global Util, Selection, Extension */

// replace two bogus tags that begin pastes from google docs
[new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi), ""],
[new RegExp(/<\/b>(<br[^>]*>)?$/gi), ""],
[new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi), ''],
[new RegExp(/<\/b>(<br[^>]*>)?$/gi), ''],

@@ -51,3 +51,3 @@ // un-html spaces and newlines inserted by OS X

PasteHandler = Extension.extend({
PasteHandler = Extension.extend({

@@ -85,4 +85,4 @@ /* Paste Options */

/* ----- internal options needed from base ----- */
"window": window,
"document": document,
'window': window,
'document': document,
targetBlank: false,

@@ -172,3 +172,3 @@ disableReturn: false,

try {
this.document.execCommand('insertText', false, "\n");
this.document.execCommand('insertText', false, '\n');
} catch (ignore) { }

@@ -267,7 +267,7 @@

cleanupSpans: function (container_el) {
cleanupSpans: function (containerEl) {
var i,
el,
new_el,
spans = container_el.querySelectorAll('.replace-with'),
newEl,
spans = containerEl.querySelectorAll('.replace-with'),
isCEF = function (el) {

@@ -279,14 +279,14 @@ return (el && el.nodeName !== '#text' && el.getAttribute('contenteditable') === 'false');

el = spans[i];
new_el = this.document.createElement(el.classList.contains('bold') ? 'b' : 'i');
newEl = this.document.createElement(el.classList.contains('bold') ? 'b' : 'i');
if (el.classList.contains('bold') && el.classList.contains('italic')) {
// add an i tag as well if this has both italics and bold
new_el.innerHTML = '<i>' + el.innerHTML + '</i>';
newEl.innerHTML = '<i>' + el.innerHTML + '</i>';
} else {
new_el.innerHTML = el.innerHTML;
newEl.innerHTML = el.innerHTML;
}
el.parentNode.replaceChild(new_el, el);
el.parentNode.replaceChild(newEl, el);
}
spans = container_el.querySelectorAll('span');
spans = containerEl.querySelectorAll('span');
for (i = 0; i < spans.length; i += 1) {

@@ -304,4 +304,4 @@ el = spans[i];

}
});
});
}());

@@ -9,3 +9,5 @@ /*global Util */

findMatchingSelectionParent: function (testElementFunction, contentWindow) {
var selection = contentWindow.getSelection(), range, current;
var selection = contentWindow.getSelection(),
range,
current;

@@ -12,0 +14,0 @@ if (selection.rangeCount === 0) {

@@ -25,8 +25,7 @@ /*global Util, Selection */

if (this.options.staticToolbar) {
toolbar.className += " static-toolbar";
toolbar.className += ' static-toolbar';
} else {
toolbar.className += " stalker-toolbar";
toolbar.className += ' stalker-toolbar';
}
toolbar.appendChild(this.createToolbarButtons());

@@ -333,3 +332,3 @@

// If we don't have a "valid" selection -> hide toolbar
// If we don't have a 'valid' selection -> hide toolbar
if (this.options.contentWindow.getSelection().toString().trim() === '' ||

@@ -484,3 +483,3 @@ (this.options.allowMultiParagraphSelection === false && this.multipleBlockElementsSelected())) {

toolbarElement.classList.add('sticky-toolbar');
toolbarElement.style.top = "0px";
toolbarElement.style.top = '0px';

@@ -490,6 +489,6 @@ // Normal static toolbar position

toolbarElement.classList.remove('sticky-toolbar');
toolbarElement.style.top = containerTop - toolbarHeight + "px";
toolbarElement.style.top = containerTop - toolbarHeight + 'px';
}
} else {
toolbarElement.style.top = containerTop - toolbarHeight + "px";
toolbarElement.style.top = containerTop - toolbarHeight + 'px';
}

@@ -496,0 +495,0 @@

@@ -28,3 +28,3 @@ /*global NodeFilter, console*/

} catch (e) {
// "p in context" throws an exception when context is a number, boolean, etc. rather than an object,
// 'p in context' throws an exception when context is a number, boolean, etc. rather than an object,
// so in that corner case just return undefined (by having no return statement)

@@ -243,3 +243,3 @@ }

el = doc.createElement("div");
el = doc.createElement('div');
el.innerHTML = html;

@@ -402,4 +402,4 @@ fragment = doc.createDocumentFragment();

warn: function(){
if(window.console !== undefined && typeof window.console.warn === 'function'){
warn: function () {
if (window.console !== undefined && typeof window.console.warn === 'function') {
window.console.warn.apply(console, arguments);

@@ -409,7 +409,7 @@ }

deprecated: function(oldName, newName, version){
deprecated: function (oldName, newName, version) {
// simple deprecation warning mechanism.
var m = oldName + " is deprecated, please use " + newName + " instead.";
if(version){
m += " Will be removed in " + version;
var m = oldName + ' is deprecated, please use ' + newName + ' instead.';
if (version) {
m += ' Will be removed in ' + version;
}

@@ -441,3 +441,3 @@ Util.warn(m);

getClosestTag : function(el, tag) { // get the closest parent
getClosestTag: function (el, tag) { // get the closest parent
return Util.traverseUp(el, function (element) {

@@ -462,13 +462,15 @@ return element.tagName.toLowerCase() === tag.toLowerCase();

setObject: function(name, value, context){
setObject: function (name, value, context) {
// summary:
// Set a property from a dot-separated string, such as "A.B.C"
var parts = name.split("."), p = parts.pop(), obj = getProp(parts, true, context);
// Set a property from a dot-separated string, such as 'A.B.C'
var parts = name.split('.'),
p = parts.pop(),
obj = getProp(parts, true, context);
return obj && p ? (obj[p] = value) : undefined; // Object
},
getObject: function(name, create, context){
getObject: function (name, create, context) {
// summary:
// Get a property from a dot-separated string, such as "A.B.C"
return getProp(name ? name.split(".") : [], create, context); // Object
// Get a property from a dot-separated string, such as 'A.B.C'
return getProp(name ? name.split('.') : [], create, context); // Object
}

@@ -475,0 +477,0 @@

@@ -0,15 +1,15 @@

/*global MediumEditor */
/*global MediumEditor */
MediumEditor.version = (function(major, minor, revision) {
return {
major: parseInt(major, 10),
minor: parseInt(minor, 10),
revision: parseInt(revision, 10),
toString: function(){
return [major, minor, revision].join(".");
}
};
}).apply(this, ({
// grunt-bump looks for this:
"version": "4.6.0"
}).version.split("."));
MediumEditor.version = (function (major, minor, revision) {
return {
major: parseInt(major, 10),
minor: parseInt(minor, 10),
revision: parseInt(revision, 10),
toString: function () {
return [major, minor, revision].join('.');
}
};
}).apply(this, ({
// grunt-bump looks for this:
'version': '4.7.0'
}).version.split('.'));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc