mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 20:51:20 +02:00
@@ -93,21 +93,14 @@ class Block extends Record(DEFAULTS) {
|
|||||||
data = {},
|
data = {},
|
||||||
isVoid = false,
|
isVoid = false,
|
||||||
key = generateKey(),
|
key = generateKey(),
|
||||||
type,
|
|
||||||
} = object
|
|
||||||
|
|
||||||
let {
|
|
||||||
nodes = [],
|
nodes = [],
|
||||||
|
type,
|
||||||
} = object
|
} = object
|
||||||
|
|
||||||
if (typeof type != 'string') {
|
if (typeof type != 'string') {
|
||||||
throw new Error('`Block.fromJSON` requires a `type` string.')
|
throw new Error('`Block.fromJSON` requires a `type` string.')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodes.length == 0) {
|
|
||||||
nodes = [{ kind: 'text', text: '' }]
|
|
||||||
}
|
|
||||||
|
|
||||||
const block = new Block({
|
const block = new Block({
|
||||||
key,
|
key,
|
||||||
type,
|
type,
|
||||||
|
@@ -93,21 +93,14 @@ class Inline extends Record(DEFAULTS) {
|
|||||||
data = {},
|
data = {},
|
||||||
isVoid = false,
|
isVoid = false,
|
||||||
key = generateKey(),
|
key = generateKey(),
|
||||||
type,
|
|
||||||
} = object
|
|
||||||
|
|
||||||
let {
|
|
||||||
nodes = [],
|
nodes = [],
|
||||||
|
type,
|
||||||
} = object
|
} = object
|
||||||
|
|
||||||
if (typeof type != 'string') {
|
if (typeof type != 'string') {
|
||||||
throw new Error('`Inline.fromJS` requires a `type` string.')
|
throw new Error('`Inline.fromJS` requires a `type` string.')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodes.length == 0) {
|
|
||||||
nodes = [{ kind: 'text', text: '' }]
|
|
||||||
}
|
|
||||||
|
|
||||||
const inline = new Inline({
|
const inline = new Inline({
|
||||||
key,
|
key,
|
||||||
type,
|
type,
|
||||||
|
Reference in New Issue
Block a user