mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-19 21:51:51 +02:00
fix removeText with Mark of length 1 (#1917)
This commit is contained in:
committed by
Ian Storm Taylor
parent
518d299600
commit
cab3f71e7a
@@ -589,7 +589,7 @@ class Text extends Record(DEFAULTS) {
|
|||||||
|
|
||||||
// PERF: For simple backspace, we can operate directly on the leaf
|
// PERF: For simple backspace, we can operate directly on the leaf
|
||||||
if (length === 1) {
|
if (length === 1) {
|
||||||
const { leaf, index, startOffset } = this.searchLeafAtOffset(start)
|
const { leaf, index, startOffset } = this.searchLeafAtOffset(start + 1)
|
||||||
const offset = start - startOffset
|
const offset = start - startOffset
|
||||||
|
|
||||||
if (leaf) {
|
if (leaf) {
|
||||||
|
@@ -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]
|
Reference in New Issue
Block a user