Added handling of contenteditable issues for ff.

This commit is contained in:
Martin Edenhofer 2016-06-21 15:37:52 +02:00
parent 13e2b55289
commit 2f13a28c98

View file

@ -59,6 +59,12 @@
this.preventInput = false
// detect firefox / handle contenteditable issues
this.browser = undefined
if ( navigator && navigator.userAgent && navigator.userAgent.search('Firefox') != -1) {
this.browser = 'ff'
}
this.init();
}
@ -104,6 +110,21 @@
document.execCommand('Outdent')
return
}
}
// return & space key being pressed
if (e.keyCode === 13 ) {
if (_this.browser === 'ff') {
// ff issue, inserts <br></br> right after contenteditable tag (still in ff47)
// https://bugzilla.mozilla.org/show_bug.cgi?id=911201
if (node.parent().hasClass('js-textarea')) {
e.preventDefault()
document.execCommand('insertHTML', false, '<p></p>')
console.log('ff issue, inserts <br></br> -> <p></p>')
return
}
// ff issue, inserts <br></br> inside of <li> - not content can be inserted
// to reproduce
@ -116,6 +137,8 @@
e.preventDefault()
document.execCommand('insertHTML', false, '<p></p>')
console.log('ff issue, inserts <br></br> inside of <li> - not content can be inserted anymore in this area')
return
}
}
}