mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 10:29:48 +02:00
fix inverting of split_node and merge_node operations
This commit is contained in:
@@ -186,6 +186,7 @@ Changes.mergeNodeByKey = (change, key, options = {}) => {
|
|||||||
value,
|
value,
|
||||||
path,
|
path,
|
||||||
position,
|
position,
|
||||||
|
target: null,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (normalize) {
|
if (normalize) {
|
||||||
|
@@ -29,6 +29,7 @@ const OPERATION_ATTRIBUTES = {
|
|||||||
'value',
|
'value',
|
||||||
'path',
|
'path',
|
||||||
'position',
|
'position',
|
||||||
|
'target',
|
||||||
],
|
],
|
||||||
move_node: [
|
move_node: [
|
||||||
'value',
|
'value',
|
||||||
|
@@ -104,7 +104,6 @@ class Operation extends Record(DEFAULTS) {
|
|||||||
if (key == 'document') continue
|
if (key == 'document') continue
|
||||||
if (key == 'selection') continue
|
if (key == 'selection') continue
|
||||||
if (key == 'node' && type != 'insert_node') continue
|
if (key == 'node' && type != 'insert_node') continue
|
||||||
if (key == 'target' && type == 'split_node') continue
|
|
||||||
|
|
||||||
throw new Error(`\`Operation.fromJSON\` was passed a "${type}" operation without the required "${key}" attribute.`)
|
throw new Error(`\`Operation.fromJSON\` was passed a "${type}" operation without the required "${key}" attribute.`)
|
||||||
}
|
}
|
||||||
@@ -224,7 +223,6 @@ class Operation extends Record(DEFAULTS) {
|
|||||||
if (key == 'selection') continue
|
if (key == 'selection') continue
|
||||||
if (key == 'value') continue
|
if (key == 'value') continue
|
||||||
if (key == 'node' && type != 'insert_node') continue
|
if (key == 'node' && type != 'insert_node') continue
|
||||||
if (key == 'target' && type == 'split_node') continue
|
|
||||||
|
|
||||||
if (key == 'mark' || key == 'marks' || key == 'node') {
|
if (key == 'mark' || key == 'marks' || key == 'node') {
|
||||||
value = value.toJSON()
|
value = value.toJSON()
|
||||||
|
Reference in New Issue
Block a user