Firefox bug: Images are not being appended to current cursor position
slwen opened this issue · 2 comments
slwen commented
slwen commented
As an update for this I've found a work-around that I'm currently rolling with in Firefox and it appears to be fine in other browsers too, though I suspect the root cause of this problem has something to do with the regex matching being a bit off inside of src/getSurface.js
. It seems to split text chunks incorrectly when it encounters <br>
tags.
The work-around is to force Firefox content editable divs (WYSIWYG mode) to insert <p>
tags rather than <br>
when the user hits the enter key. This seemingly brings it in to line with Chrome and IE.
Here's some example code I use after instantiating a woofmark editor:
wysiwygElement.addEventListener('keypress', function(e) {
if (e.keyCode == '13' || e.which == '13') {
document.execCommand('formatBlock', false, 'p');
}
}, false);