yakovlevga / brickyeditor

WYSIWYG block editor jQuery plugin.
MIT License
115 stars 20 forks source link

HtmlTools lists creation does not work in Firefox #11

Closed Hrumpa closed 6 years ago

Hrumpa commented 6 years ago

Firefox 57.0 under Ubuntu 16.04 64 throws exception "NS_ERROR_FAILURE:" without any message at https://github.com/yakovlevga/brickyeditor/blob/af9ba602fcf066e8a919b4611a413251cf501716/dist/jquery.brickyeditor.js#L1011 when trying to create UL or OL via HtmlTools. Same behavior with previous code document.execCommand(command);

Everything works well in Chrome 62.0.3202.89

yakovlevga commented 6 years ago

Thanks for report. Looks like firefox issue, insertUnorderedList and insertOrderedList commands not works, if selection was made inside <p> tag. Couldn't find any list of correct containers tags in firefox documentation, so I decide to wrap execCommand in try/catch and in case of "NS_ERROR_FAILURE:" will wrap selection inside additional div. Behavior of execCommand is still inconsistent even in late versions of diferrent browsers.

I'll fix this today.

Hrumpa commented 6 years ago

Thanks, I agree, that most likely this is Firefox issue. Also may be related to "contenteditable" attribute placement. Maybe it is not a bad idea at this point to add some tests (acceptance?).

yakovlevga commented 6 years ago

Sure, tests are needed. I'll soon commit separate branch with refactoring, it will contains tests environment.

yakovlevga commented 6 years ago

Oops, this branch is already there: https://github.com/yakovlevga/brickyeditor/tree/refactoring I already sent it to this remote repo by mistake yesterday :)