medium-editor
Advanced tools
Comparing version 4.12.5 to 4.12.6
@@ -32,3 +32,3 @@ { | ||
"package.json", | ||
"src/js", | ||
"src", | ||
"README.md", | ||
@@ -35,0 +35,0 @@ "CHANGES.md" |
@@ -0,0 +0,0 @@ 4.12.5 / 2015-06-16 |
@@ -0,0 +0,0 @@ # Contributing |
@@ -0,0 +0,0 @@ var TableExtension; |
@@ -0,0 +0,0 @@ /*global module, require, process*/ |
{ | ||
"name": "medium-editor", | ||
"version": "4.12.5", | ||
"version": "4.12.6", | ||
"author": "Davi Ferreira <hi@daviferreira.com>", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -0,0 +0,0 @@ # MediumEditor |
@@ -0,0 +0,0 @@ /*global MediumEditor, describe, it, expect, spyOn, AnchorForm, |
@@ -0,0 +0,0 @@ /*global MediumEditor, describe, it, expect, spyOn, |
@@ -0,0 +0,0 @@ /*global describe, it, expect, beforeEach, afterEach, |
@@ -0,0 +0,0 @@ /*global MediumEditor, describe, it, expect, spyOn, AnchorForm, |
@@ -0,0 +0,0 @@ /*global describe, it, expect, spyOn, |
@@ -0,0 +0,0 @@ /*global describe, it, expect, beforeEach, afterEach, |
@@ -0,0 +0,0 @@ /*global describe, it, expect, jasmine, |
@@ -0,0 +0,0 @@ /*global describe, it, expect, spyOn, |
@@ -0,0 +0,0 @@ /*global describe, it, expect, |
@@ -0,0 +0,0 @@ /*global describe, it, expect, jasmine, |
@@ -0,0 +0,0 @@ /*global describe, it, expect, afterEach, |
@@ -0,0 +0,0 @@ /*global MediumEditor, describe, it, expect, spyOn, |
@@ -0,0 +0,0 @@ /*global MediumEditor, describe, it, expect, spyOn, |
@@ -0,0 +0,0 @@ /*global describe, it, expect, afterEach, beforeEach, |
@@ -0,0 +0,0 @@ /*global describe, it, expect, afterEach, Util, |
@@ -0,0 +0,0 @@ /*global atob, unescape, Uint8Array, Blob*/ |
@@ -0,0 +0,0 @@ /*global MediumEditor, describe, it, expect, spyOn, |
@@ -0,0 +0,0 @@ /*global MediumEditor, describe, it, expect, spyOn, |
@@ -0,0 +0,0 @@ /*global describe, it, expect, Util, |
@@ -0,0 +0,0 @@ /*global MediumEditor, describe, it, expect, |
@@ -0,0 +0,0 @@ /*global MediumEditor, describe, it, expect, spyOn, |
@@ -0,0 +0,0 @@ /*global describe, it, expect, |
@@ -51,2 +51,8 @@ /*global MediumEditor, describe, it, expect, spyOn, jasmine, | ||
expect(editor.setup).toHaveBeenCalled(); | ||
expect(document.querySelector('[data-medium-element]')).toBeTruthy(); | ||
expect(document.querySelector('[aria-multiline]')).toBeTruthy(); | ||
expect(document.querySelector('[medium-editor-index]')).toBeTruthy(); | ||
expect(document.querySelector('[role]')).toBeTruthy(); | ||
expect(document.querySelector('[spellcheck]')).toBeTruthy(); | ||
expect(document.querySelector('[contenteditable]')).toBeTruthy(); | ||
}); | ||
@@ -65,2 +71,5 @@ | ||
expect(document.querySelector('.medium-editor-toolbar')).toBeFalsy(); | ||
// ensure only initial attributes are here: the editor class | ||
expect(this.el.getAttribute('class')).toBe('editor'); | ||
expect(this.el.attributes.length).toBe(1); | ||
}); | ||
@@ -67,0 +76,0 @@ |
@@ -57,2 +57,21 @@ /*global describe, it, beforeEach, afterEach, expect, | ||
it('should create unique div ids for multiple textareas', function () { | ||
var tas = []; | ||
for (var i = 0; i < 12; i++) { | ||
var ta = document.createElement('textarea'); | ||
ta.className = 'editor'; | ||
ta.value = 'test content'; | ||
document.body.appendChild(ta); | ||
tas.push(ta); | ||
} | ||
var editor = this.newMediumEditor('.editor'); | ||
editor.elements.forEach(function (el) { | ||
expect(document.querySelectorAll('div#' + el.id).length).toEqual(1); | ||
}); | ||
editor.destroy(); | ||
tas.forEach(function (el) { | ||
document.body.removeChild(el); | ||
}); | ||
}); | ||
it('should cleanup after destroy', function () { | ||
@@ -59,0 +78,0 @@ var editor = this.newMediumEditor('.editor'); |
@@ -0,0 +0,0 @@ /*global MediumEditor, describe, it, expect, spyOn, |
@@ -0,0 +0,0 @@ /*global MediumEditor, Util, describe, it, expect, spyOn, |
@@ -0,0 +0,0 @@ (function () { |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /*global MediumEditor, describe, it, expect */ |
@@ -180,5 +180,5 @@ /*global Util, ButtonsData, Selection, Extension, | ||
this.elements = []; | ||
elements.forEach(function (element) { | ||
elements.forEach(function (element, index) { | ||
if (element.tagName.toLowerCase() === 'textarea') { | ||
this.elements.push(createContentEditable.call(this, element)); | ||
this.elements.push(createContentEditable.call(this, element, index)); | ||
} else { | ||
@@ -289,5 +289,5 @@ this.elements.push(element); | ||
function createContentEditable(textarea) { | ||
function createContentEditable(textarea, id) { | ||
var div = this.options.ownerDocument.createElement('div'), | ||
id = (+new Date()), | ||
uniqueId = 'medium-editor-' + Date.now() + '-' + id, | ||
attributesToClone = [ | ||
@@ -304,3 +304,3 @@ 'data-disable-editing', | ||
div.className = textarea.className; | ||
div.id = id; | ||
div.id = uniqueId; | ||
div.innerHTML = textarea.value; | ||
@@ -643,2 +643,4 @@ div.setAttribute('medium-editor-textarea-id', id); | ||
this.events.destroy(); | ||
this.elements.forEach(function (element) { | ||
@@ -653,2 +655,5 @@ // Reset elements content, fix for issue where after editor destroyed the red underlines on spelling errors are left | ||
element.removeAttribute('data-medium-element'); | ||
element.removeAttribute('medium-editor-index'); | ||
element.removeAttribute('role'); | ||
element.removeAttribute('aria-multiline'); | ||
@@ -668,4 +673,2 @@ // Remove any elements created for textareas | ||
this.elements = []; | ||
this.events.destroy(); | ||
}, | ||
@@ -672,0 +675,0 @@ |
@@ -0,0 +0,0 @@ var ButtonsData; |
@@ -0,0 +0,0 @@ /*global Button, FormExtension, |
@@ -0,0 +0,0 @@ var editorDefaults; |
@@ -98,2 +98,8 @@ /*global Util*/ | ||
this.detachExecCommand(); | ||
if (this.base.elements) { | ||
this.base.elements.forEach(function (element) { | ||
element.removeAttribute('data-medium-focused'); | ||
}); | ||
} | ||
}, | ||
@@ -100,0 +106,0 @@ |
@@ -0,0 +0,0 @@ var Extension; |
@@ -0,0 +0,0 @@ var AnchorPreview; |
@@ -0,0 +0,0 @@ var AnchorForm; |
@@ -0,0 +0,0 @@ /*global Extension, Util */ |
@@ -0,0 +0,0 @@ var Button; |
@@ -0,0 +0,0 @@ /*global Util*/ |
@@ -0,0 +0,0 @@ /*global Util, Selection, DefaultButton */ |
@@ -0,0 +0,0 @@ /*global Util */ |
@@ -0,0 +0,0 @@ /*global Util, DefaultButton, Selection */ |
@@ -0,0 +0,0 @@ var FontSizeForm; |
@@ -0,0 +0,0 @@ var FormExtension; |
@@ -0,0 +0,0 @@ /*global Util, Extension */ |
@@ -0,0 +0,0 @@ /*global Util, Selection, Extension */ |
@@ -0,0 +0,0 @@ var Placeholder; |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /*global Util */ |
@@ -264,6 +264,6 @@ /*global Util, Selection*/ | ||
multipleBlockElementsSelected: function () { | ||
/*jslint regexp: true*/ | ||
var selectionHtml = Selection.getSelectionHtml.call(this).replace(/<[\S]+><\/[\S]+>/gim, ''), | ||
hasMultiParagraphs = selectionHtml.match(/<(p|h[1-6]|blockquote)[^>]*>/g); | ||
/*jslint regexp: false*/ | ||
var regexEmptyHTMLTags = /<[^\/>][^>]*><\/[^>]+>/gim, // http://stackoverflow.com/questions/3129738/remove-empty-tags-using-regex | ||
regexBlockElements = new RegExp('<(' + Util.parentElements.join('|') + ')[^>]*>', 'g'), | ||
selectionHTML = Selection.getSelectionHtml.call(this).replace(regexEmptyHTMLTags, ''), // Filter out empty blocks from selection | ||
hasMultiParagraphs = selectionHTML.match(regexBlockElements); // Find how many block elements are within the html | ||
@@ -270,0 +270,0 @@ return !!hasMultiParagraphs && hasMultiParagraphs.length > 1; |
@@ -0,0 +0,0 @@ /*global NodeFilter, Selection*/ |
@@ -14,3 +14,3 @@ /*global MediumEditor */ | ||
// grunt-bump looks for this: | ||
'version': '4.12.5' | ||
'version': '4.12.6' | ||
}).version.split('.')); |
return MediumEditor; | ||
}())); |
@@ -0,0 +0,0 @@ (function (root, factory) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1482690
110
18369