forked from ianstormtaylor/slate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix positions iteration when starting in an inline void node (ianstor…
- Loading branch information
1 parent
34cfc1c
commit 9ce0a08
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'slate': patch | ||
--- | ||
|
||
Fix positions iteration when starting inside an inline void node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/slate/test/interfaces/Editor/positions/range/start-in-void.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** @jsx jsx */ | ||
import { Editor } from 'slate' | ||
import { jsx } from '../../../..' | ||
|
||
export const input = ( | ||
<editor> | ||
<block> | ||
one | ||
<inline void> | ||
<text /> | ||
</inline> | ||
two | ||
</block> | ||
</editor> | ||
) | ||
export const test = editor => { | ||
return Array.from( | ||
Editor.positions(editor, { | ||
at: { | ||
anchor: { path: [0, 1, 0], offset: 0 }, | ||
focus: { path: [0, 2], offset: 2 }, | ||
}, | ||
unit: 'character', | ||
}) | ||
) | ||
} | ||
export const output = [ | ||
{ path: [0, 1, 0], offset: 0 }, | ||
{ path: [0, 2], offset: 1 }, | ||
{ path: [0, 2], offset: 2 }, | ||
] |