1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 18:09:49 +02:00

fix inverting of split_node and merge_node operations

This commit is contained in:
Ian Storm Taylor
2017-11-16 12:20:30 -08:00
parent 65c583f695
commit 59a7197f81
3 changed files with 2 additions and 2 deletions

View File

@@ -186,6 +186,7 @@ Changes.mergeNodeByKey = (change, key, options = {}) => {
value,
path,
position,
target: null,
})
if (normalize) {

View File

@@ -29,6 +29,7 @@ const OPERATION_ATTRIBUTES = {
'value',
'path',
'position',
'target',
],
move_node: [
'value',

View File

@@ -104,7 +104,6 @@ class Operation extends Record(DEFAULTS) {
if (key == 'document') continue
if (key == 'selection') 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.`)
}
@@ -224,7 +223,6 @@ class Operation extends Record(DEFAULTS) {
if (key == 'selection') continue
if (key == 'value') continue
if (key == 'node' && type != 'insert_node') continue
if (key == 'target' && type == 'split_node') continue
if (key == 'mark' || key == 'marks' || key == 'node') {
value = value.toJSON()