1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-06 15:26:34 +02:00

swap html serializer to take rules in options dictionary

This commit is contained in:
Ian Storm Taylor
2016-07-17 15:40:38 -07:00
parent 2ee317c0a0
commit ca1dfd904d
2 changed files with 5 additions and 4 deletions

View File

@@ -154,7 +154,7 @@ const RULES = [
* @type {Html} * @type {Html}
*/ */
const serializer = new Html(RULES) const serializer = new Html({ rules: RULES })
/** /**
* The pasting html example. * The pasting html example.

View File

@@ -53,13 +53,14 @@ class Html {
/** /**
* Create a new serializer with `rules`. * Create a new serializer with `rules`.
* *
* @param {Array} rules * @param {Object} options
* @property {Array} rules
* @return {Html} serializer * @return {Html} serializer
*/ */
constructor(rules = []) { constructor(options = {}) {
this.rules = [ this.rules = [
...rules, ...(options.rules || []),
TEXT_RULE, TEXT_RULE,
BR_RULE BR_RULE
] ]