medium-editor
Advanced tools
Comparing version 4.8.0 to 4.8.1
{ | ||
"name": "medium-editor", | ||
"version": "4.8.0", | ||
"version": "4.8.1", | ||
"homepage": "http://daviferreira.github.io/medium-editor/", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -0,1 +1,6 @@ | ||
4.8.1 / 2015-05-13 | ||
================== | ||
* Fix error thrown when loading MediumEditor js from head | ||
4.8.0 / 2015-05-11 | ||
@@ -2,0 +7,0 @@ ================== |
{ | ||
"name": "medium-editor", | ||
"version": "4.8.0", | ||
"version": "4.8.1", | ||
"author": "Davi Ferreira <hi@daviferreira.com>", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -18,3 +18,3 @@ /*global Util */ | ||
InputEventOnContenteditableSupported: false, | ||
InputEventOnContenteditableSupported: !Util.isIE, | ||
@@ -516,50 +516,2 @@ // Helpers for event handling | ||
}; | ||
// Do feature detection to determine if the 'input' event is supported correctly | ||
// Currently, IE does not support this event on contenteditable elements | ||
var tempFunction = function () { | ||
Events.prototype.InputEventOnContenteditableSupported = true; | ||
}, | ||
tempElement, | ||
existingRanges = []; | ||
// Create a temporary contenteditable element with an 'oninput' event listener | ||
tempElement = document.createElement('div'); | ||
tempElement.setAttribute('contenteditable', true); | ||
tempElement.innerHTML = 't'; | ||
tempElement.addEventListener('input', tempFunction); | ||
tempElement.style.position = 'absolute'; | ||
tempElement.style.left = '-100px'; | ||
tempElement.style.top = '-100px'; | ||
document.body.appendChild(tempElement); | ||
// Store any existing ranges that may exist | ||
var selection = document.getSelection(); | ||
for (var i = 0; i < selection.rangeCount; i++) { | ||
existingRanges.push(selection.getRangeAt(i)); | ||
} | ||
// Create a new range containing the content of the temporary contenteditable element | ||
// and replace the selection to only contain this range | ||
var range = document.createRange(); | ||
range.selectNodeContents(tempElement); | ||
selection.removeAllRanges(); | ||
selection.addRange(range); | ||
// Call 'execCommand' on the current selection, which will cause the input event to be triggered if it's supported | ||
document.execCommand('bold', false, null); | ||
// Cleanup the temporary element | ||
tempElement.removeEventListener('input', tempFunction); | ||
tempElement.parentNode.removeChild(tempElement); | ||
selection.removeAllRanges(); | ||
// Restore any existing ranges | ||
if (existingRanges.length) { | ||
for (i = 0; i < existingRanges.length; i++) { | ||
selection.addRange(existingRanges[i]); | ||
} | ||
} | ||
}()); |
@@ -14,3 +14,3 @@ /*global MediumEditor */ | ||
// grunt-bump looks for this: | ||
'version': '4.8.0' | ||
'version': '4.8.1' | ||
}).version.split('.')); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1115470
13594