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:
@@ -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.
|
||||||
|
@@ -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
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user