Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

allowBlockElements=false in Safari prevents entering new lines #488

Closed
danburzo opened this issue Jul 22, 2016 · 2 comments
Closed

allowBlockElements=false in Safari prevents entering new lines #488

danburzo opened this issue Jul 22, 2016 · 2 comments

Comments

@danburzo
Copy link
Contributor

If you instantiate Scribe with allowBlockElements=false in Safari, you're not able to insert new lines with the Enter key. I'm investigating the source of the bug and will propose a PR, but any guidance in the meantime is appreciated!

@danburzo
Copy link
Contributor Author

danburzo commented Jul 22, 2016

I have narrowed it down to this piece of code https://github.com/guardian/scribe/blob/master/src/plugins/core/inline-elements-mode.js#L89 and at first brush it seems Safari and Chrome end up with different ranges, and thus the call to hasContent returns true in Safari (which catches a <br> in the process) and false in Chrome.

I'm now investigating why Safari has a different range than Chrome.

Later edit: Seems like Safari does not respect the DOM 2 insertNode spec, specifically If range’s start and end are the same, set range’s end to (parent, newOffset).

@katebee katebee closed this as completed in 32c04aa Feb 3, 2017
katebee added a commit that referenced this issue Feb 3, 2017
Fixes #488; allow new line at the end of the line in Safari
@katebee
Copy link
Contributor

katebee commented Feb 3, 2017

@danburzo thank you for all the detail on this issue 😄

❤️ documentation

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants