mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-06 23:36:31 +02:00
allow for passing default block type to html serializer
This commit is contained in:
@@ -69,6 +69,7 @@ class Html {
|
|||||||
*
|
*
|
||||||
* @param {Object} options
|
* @param {Object} options
|
||||||
* @property {Array} rules
|
* @property {Array} rules
|
||||||
|
* @property {String} defaultBlockType
|
||||||
*/
|
*/
|
||||||
|
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
@@ -76,6 +77,8 @@ class Html {
|
|||||||
...(options.rules || []),
|
...(options.rules || []),
|
||||||
TEXT_RULE
|
TEXT_RULE
|
||||||
]
|
]
|
||||||
|
|
||||||
|
this.defaultBlockType = options.defaultBlockType || 'paragraph'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -105,7 +108,7 @@ class Html {
|
|||||||
|
|
||||||
const block = {
|
const block = {
|
||||||
kind: 'block',
|
kind: 'block',
|
||||||
type: 'paragraph',
|
type: this.defaultBlockType,
|
||||||
nodes: [node]
|
nodes: [node]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user