1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-02 06:09:09 +01:00

remove pseudo-normalization from Node.create, fixes #1155 (#1158)

This commit is contained in:
Ian Storm Taylor 2017-09-21 12:52:51 -07:00 committed by GitHub
parent c070ae7aba
commit a2b922276f
2 changed files with 2 additions and 16 deletions

View File

@ -93,21 +93,14 @@ class Block extends Record(DEFAULTS) {
data = {},
isVoid = false,
key = generateKey(),
type,
} = object
let {
nodes = [],
type,
} = object
if (typeof type != 'string') {
throw new Error('`Block.fromJSON` requires a `type` string.')
}
if (nodes.length == 0) {
nodes = [{ kind: 'text', text: '' }]
}
const block = new Block({
key,
type,

View File

@ -93,21 +93,14 @@ class Inline extends Record(DEFAULTS) {
data = {},
isVoid = false,
key = generateKey(),
type,
} = object
let {
nodes = [],
type,
} = object
if (typeof type != 'string') {
throw new Error('`Inline.fromJS` requires a `type` string.')
}
if (nodes.length == 0) {
nodes = [{ kind: 'text', text: '' }]
}
const inline = new Inline({
key,
type,