Improved error handling.

This commit is contained in:
Martin Edenhofer 2017-08-15 21:32:53 +02:00
parent c6fec78bf9
commit fde8d11b5f

View file

@ -104,12 +104,14 @@
// break <blockquote> after enter on empty line // break <blockquote> after enter on empty line
sel = window.getSelection() sel = window.getSelection()
node = $(sel.anchorNode) if (sel) {
if (node.parent().is('blockquote')) { node = $(sel.anchorNode)
e.preventDefault() if (node && node.parent() && node.parent().is('blockquote')) {
document.execCommand('Insertparagraph') e.preventDefault()
document.execCommand('Outdent') document.execCommand('Insertparagraph')
return document.execCommand('Outdent')
return
}
} }
// behavior to enter new line on alt+enter // behavior to enter new line on alt+enter
@ -246,7 +248,7 @@
// limit check // limit check
if ( !_this.allowKey(e) ) { if ( !_this.allowKey(e) ) {
if ( !_this.maxLengthOk( 1 ) ) { if ( !_this.maxLengthOk(1) ) {
e.preventDefault() e.preventDefault()
return return
} }