mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-03 12:12:39 +02:00
Fix invalid transform path in move_node operation (#2324)
* Add failing deleteAtRange test * Fix invalid move node path increment (fixes #2291) * Add another three block delete all test without any void nodes * Test the correct variables in transform path (move_node)
This commit is contained in:
committed by
Ian Storm Taylor
parent
4e906b3be2
commit
125ea00245
@@ -342,6 +342,11 @@ function transform(path, operation) {
|
||||
const { newPath: np } = operation
|
||||
const npIndex = np.size - 1
|
||||
const npEqual = isEqual(np, path)
|
||||
|
||||
if (isEqual(p, np)) {
|
||||
return List([path])
|
||||
}
|
||||
|
||||
const npYounger = isYounger(np, path)
|
||||
const npAbove = isAbove(np, path)
|
||||
|
||||
|
@@ -0,0 +1,31 @@
|
||||
/** @jsx h */
|
||||
|
||||
import h from '../../../helpers/h'
|
||||
|
||||
export default function(change) {
|
||||
change.delete()
|
||||
}
|
||||
|
||||
export const input = (
|
||||
<value>
|
||||
<document>
|
||||
<paragraph>
|
||||
<anchor />1
|
||||
</paragraph>
|
||||
<paragraph>2</paragraph>
|
||||
<paragraph>
|
||||
3<focus />
|
||||
</paragraph>
|
||||
</document>
|
||||
</value>
|
||||
)
|
||||
|
||||
export const output = (
|
||||
<value>
|
||||
<document>
|
||||
<paragraph>
|
||||
<cursor />
|
||||
</paragraph>
|
||||
</document>
|
||||
</value>
|
||||
)
|
@@ -0,0 +1,32 @@
|
||||
/** @jsx h */
|
||||
|
||||
import h from '../../../helpers/h'
|
||||
|
||||
export default function(change) {
|
||||
change.delete()
|
||||
}
|
||||
|
||||
export const input = (
|
||||
<value>
|
||||
<document>
|
||||
<paragraph>
|
||||
<anchor />Hi
|
||||
</paragraph>
|
||||
<paragraph>there</paragraph>
|
||||
<paragraph>
|
||||
<emoji />
|
||||
<focus />
|
||||
</paragraph>
|
||||
</document>
|
||||
</value>
|
||||
)
|
||||
|
||||
export const output = (
|
||||
<value>
|
||||
<document>
|
||||
<paragraph>
|
||||
<cursor />
|
||||
</paragraph>
|
||||
</document>
|
||||
</value>
|
||||
)
|
Reference in New Issue
Block a user