1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-12 10:14:02 +02:00

only apply Firefox toSlatePoint offset fix if ending in \n\n (#4552)

This commit is contained in:
Claudéric Demers
2021-09-27 13:14:07 -04:00
committed by GitHub
parent ffac781086
commit 37d60c58b8
2 changed files with 6 additions and 1 deletions

View File

@@ -515,7 +515,7 @@ export const ReactEditor = {
// COMPAT: In Firefox, `range.cloneContents()` returns an extra trailing '\n'
// when the document ends with a new-line character. This results in the offset
// length being off by one, so we need to subtract one to account for this.
(IS_FIREFOX && domNode.textContent?.endsWith('\n')))
(IS_FIREFOX && domNode.textContent?.endsWith('\n\n')))
) {
offset--
}