mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-02 06:09:09 +01:00
parent
c070ae7aba
commit
a2b922276f
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user