k('enter', function(e) { // corret enter behavior if (format.is.div()) { // div -> p format.p(); } for (var i = 0; i < spanformats.length; i++) { (function(name) { if (format.is(name)) { format(name); } })(spanformats[i]); } if (!options.blank && isblank(editable)) { // don't put too many blank lines e.preventDefault(); return false; } if (k.shift) { // shift + enter is <br> return false; } var curr = caret.blockParent(); var prev = curr.previousElementSibling; if (prev && prev.tagName.toLowerCase() === 'hr' && isblank(curr)) { e.preventDefault(); return false; } if (format.is.blockquote()) { if (!curr.textContent) { e.preventDefault(); return false; } setTimeout(function() { format.blockquote(); format.p(); }, 1); return true; } if (format.is.ul() || format.is.ol()) { setTimeout(function() { if (!format.is.ul() && !format.is.ol()) { format.p(); } }, 1); return true; } setTimeout(function() { var prev = caret.blockParent().previousElementSibling; if (prev && isblank(prev)) { prev.parentNode.replaceChild(document.createElement('hr'), prev); } }, 1); });
k('backspace', function(e) { if (isblank(editable)) { e.preventDefault(); if (!format.is.p()) { format.p(); } } });
setTimeout(function() { if (!format.is.ul() && !format.is.ol()) { format.p(); } }, 1);
setTimeout(function() { format.blockquote(); format.p(); }, 1);