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