wysihtml5
wysihtml5 copied to clipboard
wysihtml5-0.4.0pre.js + textarea hidden + Firefox = TypeError: sel.nativeSelection is null
Hi,
I know wysihtml5-0.4.0pre.js is not a final version but for your information when using it with a hidden textarea (in a tab for example) on Firefox, you have a js error:
TypeError: sel.nativeSelection is null
file:///..../wysihtml5-0.4.0pre.js
Line 2975
See example here: http://jsfiddle.net/EhbuY/
Thanks
I also get this error in 0.3.0
Experiencing same issue on v0.4.0.pre
Same issue here :(
Any ideas on how to resolve it?
For me, not hiding the textarea on page load fixed it. Just remove display:none; if it's there.
---
Sent from my iPhone
On Fri, Sep 6, 2013 at 4:48 PM, Eric [email protected] wrote:
Same issue here :(
Any ideas on how to resolve it?
Reply to this email directly or view it on GitHub: https://github.com/xing/wysihtml5/issues/371#issuecomment-23976415
Thanks, that makes a bit more sense. I'll probably have to do a workaround like setting the opacity to hide the editor instead until there's a more permanent solution.
I patched 1 line in rangy and it seems to fix the issue: https://github.com/glebm/bootstrap-wysihtml5-rails/blob/master/vendor/assets/javascripts/bootstrap-wysihtml5/rangy/rangy-core.js#L2958
I cannot thank you enough...that did the trick!
High-five! :hand:
I'm having the same issue. Using wysihtml5-0.4.0pre.js + Bootstrap tabs (which are hidding the textarea onload by applying a css class with display:none). Plus, I've set the option useLineBreaks: false
.
On Firefox I get the console error sel.nativeSelection is null
and both the original textarea and the wysihtml5 iframe are shown, but no toolbar is displayed.
When I apply @glebm's fix it works almost fine (Cheers for that one! Saved me from a really embarrassing script I was about to write). Only now, in Firefox, the editors inside tabs stoped making paragraphs and return only br
's. This happens only in Firefox and only for editors that were hidden onload...
Anyone else having the same problem?
Edit: I'm also using bootstrap-wysihtml5 and I'm calling wysihtml5 after the tabs script. It's not very practical for me to change this order. Although I think that could fix it, I'd love to find a more permanent solution.
I also get this error in 0.3.0