mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-10 17:24:02 +02:00
This commit is contained in:
5
.changeset/purple-walls-kiss.md
Normal file
5
.changeset/purple-walls-kiss.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Reverted #4804 as it triggered an exception when inserting text with multi-block selection
|
@@ -487,8 +487,7 @@ export const TextTransforms: TextTransforms = {
|
|||||||
if (!voids && Editor.void(editor, { at: end })) {
|
if (!voids && Editor.void(editor, { at: end })) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const start = Range.start(at)
|
const pointRef = Editor.pointRef(editor, end)
|
||||||
const pointRef = Editor.pointRef(editor, start)
|
|
||||||
Transforms.delete(editor, { at, voids })
|
Transforms.delete(editor, { at, voids })
|
||||||
at = pointRef.unref()!
|
at = pointRef.unref()!
|
||||||
Transforms.setSelection(editor, { anchor: at, focus: at })
|
Transforms.setSelection(editor, { anchor: at, focus: at })
|
||||||
|
@@ -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>
|
||||||
|
)
|
Reference in New Issue
Block a user