1
0
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:
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, value,
path, path,
position, position,
target: null,
}) })
if (normalize) { if (normalize) {

View File

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

View File

@@ -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()