From ca1dfd904d9a7a5c7228fca328b1b390a7b98b7c Mon Sep 17 00:00:00 2001 From: Ian Storm Taylor Date: Sun, 17 Jul 2016 15:40:38 -0700 Subject: [PATCH] swap html serializer to take rules in options dictionary --- examples/paste-html/index.js | 2 +- lib/serializers/html.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/paste-html/index.js b/examples/paste-html/index.js index 1fd20fca5..a2f8ef85f 100644 --- a/examples/paste-html/index.js +++ b/examples/paste-html/index.js @@ -154,7 +154,7 @@ const RULES = [ * @type {Html} */ -const serializer = new Html(RULES) +const serializer = new Html({ rules: RULES }) /** * The pasting html example. diff --git a/lib/serializers/html.js b/lib/serializers/html.js index b2ab0cb7d..ee5547258 100644 --- a/lib/serializers/html.js +++ b/lib/serializers/html.js @@ -53,13 +53,14 @@ class Html { /** * Create a new serializer with `rules`. * - * @param {Array} rules + * @param {Object} options + * @property {Array} rules * @return {Html} serializer */ - constructor(rules = []) { + constructor(options = {}) { this.rules = [ - ...rules, + ...(options.rules || []), TEXT_RULE, BR_RULE ]