mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-01 11:12:42 +02:00
fix html serializer default block type logic
This commit is contained in:
@@ -109,10 +109,16 @@ class Html {
|
||||
return memo
|
||||
}
|
||||
|
||||
const commonProps = {kind: 'block', nodes: [node]}
|
||||
const block = this.defaultBlockType.typeof === 'string'
|
||||
? {type: this.defaultBlockType, ...commonProps}
|
||||
: {...commonProps, ...this.defaultBlockType}
|
||||
const { defaultBlockType } = this
|
||||
const defaults = typeof defaultBlockType == 'string'
|
||||
? { type: defaultBlockType }
|
||||
: defaultBlockType
|
||||
|
||||
const block = {
|
||||
kind: 'block',
|
||||
nodes: [node],
|
||||
...defaults
|
||||
}
|
||||
|
||||
memo.push(block)
|
||||
return memo
|
||||
|
@@ -16,9 +16,9 @@ export default {
|
||||
}
|
||||
],
|
||||
defaultBlockType: {
|
||||
type: 'contentBlock',
|
||||
type: 'default',
|
||||
data: {
|
||||
style: 'default'
|
||||
key: 'value'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,9 +11,10 @@ nodes:
|
||||
marks: []
|
||||
- text: e
|
||||
marks: []
|
||||
- type: contentBlock
|
||||
- type: default
|
||||
isVoid: false
|
||||
data: {style: default}
|
||||
data:
|
||||
key: value
|
||||
nodes:
|
||||
- characters:
|
||||
- text: t
|
||||
|
Reference in New Issue
Block a user