1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-19 21:01:57 +02:00

Reverted 03861af (#4804) and added a test for the exception it caused (#4858)

This commit is contained in:
Andrew Herron 2022-03-02 15:47:00 +10:00 committed by GitHub
parent 442d263672
commit 33be22f3e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
'slate': patch
---
Reverted #4804 as it triggered an exception when inserting text with multi-block selection

View File

@ -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 })

View File

@ -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>
)