1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-20 06:01:24 +02:00

fix removeText with Mark of length 1 (#1917)

This commit is contained in:
Irwan Fario Subastian
2018-06-20 12:29:19 +10:00
committed by Ian Storm Taylor
parent 518d299600
commit cab3f71e7a
2 changed files with 20 additions and 1 deletions

View File

@@ -589,7 +589,7 @@ class Text extends Record(DEFAULTS) {
// PERF: For simple backspace, we can operate directly on the leaf
if (length === 1) {
const { leaf, index, startOffset } = this.searchLeafAtOffset(start)
const { leaf, index, startOffset } = this.searchLeafAtOffset(start + 1)
const offset = start - startOffset
if (leaf) {

View File

@@ -0,0 +1,19 @@
/** @jsx h */
import h from '../../../../helpers/h'
export const input = (
<text>
<b>Cat </b>is <i>Cute</i>
</text>
)[0]
export default function(t) {
return t.removeText(4, 1)
}
export const output = (
<text>
<b>Cat </b>s <i>Cute</i>
</text>
)[0]