mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-18 13:11:17 +02:00
Switched Map to fromJS in order to convert the whole js object (also nested data structures) to immutable (#2619)
Looks like a worthwhile improvement to me @delijah and thanks for contributing the PR. Given that nested data structures are permissible this improved the ease of use.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import isPlainObject from 'is-plain-object'
|
import isPlainObject from 'is-plain-object'
|
||||||
import { List, Map, Record } from 'immutable'
|
import { fromJS, List, Record } from 'immutable'
|
||||||
|
|
||||||
import KeyUtils from '../utils/key-utils'
|
import KeyUtils from '../utils/key-utils'
|
||||||
import Node from './node'
|
import Node from './node'
|
||||||
@@ -88,7 +88,7 @@ class Block extends Record(DEFAULTS) {
|
|||||||
const block = new Block({
|
const block = new Block({
|
||||||
key,
|
key,
|
||||||
type,
|
type,
|
||||||
data: Map(data),
|
data: fromJS(data),
|
||||||
nodes: Node.createList(nodes),
|
nodes: Node.createList(nodes),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user