1
0
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:
Ian Storm Taylor
2016-12-01 19:21:54 -08:00
parent 03653256d6
commit 35b97b7c0e

View File

@@ -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]
} }