Skip to content

Commit

Permalink
Reverted 03861af (ianstormtaylor#4804) and added a test for the excep…
Browse files Browse the repository at this point in the history
…tion it caused (ianstormtaylor#4858)
  • Loading branch information
TheSpyder authored Mar 2, 2022
1 parent 019297e commit 14accb1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/transforms/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,7 @@ export const TextTransforms: TextTransforms = {
if (!voids && Editor.void(editor, { at: end })) {
return
}
const start = Range.start(at)
const pointRef = Editor.pointRef(editor, start)
const pointRef = Editor.pointRef(editor, end)
Transforms.delete(editor, { at, voids })
at = pointRef.unref()!
Transforms.setSelection(editor, { anchor: at, focus: at })
Expand Down
26 changes: 26 additions & 0 deletions test/transforms/insertText/selection/block-across.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/** @jsx jsx */
import { Transforms } from 'slate'
import { jsx } from '../../..'

export const run = editor => {
Transforms.insertText(editor, 'a')
}
export const input = (
<editor>
<block>
<anchor />
first paragraph
</block>
<block>
second
<focus /> paragraph
</block>
</editor>
)
export const output = (
<editor>
<block>
a<cursor /> paragraph
</block>
</editor>
)

0 comments on commit 14accb1

Please sign in to comment.