This seems to only happen in Firefox and may be caused by #5 with the additional whitespace being inserted. If the first character in the editor is highlighted, and you try to type, you get an error:
Uncaught Error: Cannot resolve a Slate point from DOM point: [object Text],0
Yes, I have addons installed, but I also tested this in a clean-install of Firefox Developer Edition and can confirm the same still happens.
I modified toSlateRange in utils.js to simply log what is being passed for domRange. It seems that the starting element is an invisible empty text node whereas it is correctly the first text node in Chromium. It seems the next sibling node is the correct element so perhaps a fix for this specific issue could be an IS_FIREFOX check selecting the sibling node as the start to the range.
This seems to only happen in Firefox and may be caused by #5 with the additional whitespace being inserted. If the first character in the editor is highlighted, and you try to type, you get an error:
This does not happen in Chromium. See the following GIF: https://gyazo.com/1e59a43c34826eec4ae56085839ae499
Yes, I have addons installed, but I also tested this in a clean-install of Firefox Developer Edition and can confirm the same still happens.
I modified
toSlateRange
inutils.js
to simply log what is being passed fordomRange
. It seems that the starting element is an invisible empty text node whereas it is correctly the first text node in Chromium. It seems the next sibling node is the correct element so perhaps a fix for this specific issue could be an IS_FIREFOX check selecting the sibling node as the start to the range.