Файл: library/wysihtml5/src/quirks/ensure_proper_clearing.js
Строк: 50
<?php
/**
* IE and Opera leave an empty paragraph in the contentEditable element after clearing it
*
* @param {Object} contentEditableElement The contentEditable element to observe for clearing events
* @exaple
* wysihtml5.quirks.ensureProperClearing(myContentEditableElement);
*/
wysihtml5.quirks.ensureProperClearing = (function() {
var clearIfNecessary = function() {
var element = this;
setTimeout(function() {
var innerHTML = element.innerHTML.toLowerCase();
if (innerHTML == "<p> </p>" ||
innerHTML == "<p> </p><p> </p>") {
element.innerHTML = "";
}
}, 0);
};
return function(composer) {
wysihtml5.dom.observe(composer.element, ["cut", "keydown"], clearIfNecessary);
};
})();
?>