From 6bcb55baf2596c6f6505ac8314f9ae7826b4f2f1 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sat, 15 Sep 2018 00:16:24 +0200 Subject: [PATCH] Pass editor in custom CSS parser --- src/editor/index.js | 2 +- src/parser/model/ParserCss.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/editor/index.js b/src/editor/index.js index dbeb84d6e..ae8f97d88 100644 --- a/src/editor/index.js +++ b/src/editor/index.js @@ -599,7 +599,7 @@ module.exports = config => { /** * Trigger event log message - * @param {String} msg String to log + * @param {*} msg Message to log * @param {Object} [opts={}] Custom options * @param {String} [opts.ns=''] Namespace of the log (eg. to use in plugins) * @param {String} [opts.level='debug'] Level of the log, `debug`, `info`, `warning`, `error` diff --git a/src/parser/model/ParserCss.js b/src/parser/model/ParserCss.js index a6cc93e17..dd2edae96 100644 --- a/src/parser/model/ParserCss.js +++ b/src/parser/model/ParserCss.js @@ -12,8 +12,9 @@ module.exports = (config = {}) => ({ */ parse(str) { let result = []; - const customParser = config.parserCss; - const nodes = customParser ? customParser(str) : BrowserCssParser(str); + const { parserCss, em = {} } = config; + const editor = em && em.get('Editor'); + const nodes = parserCss ? parserCss(str, editor) : BrowserCssParser(str); nodes.forEach(node => (result = result.concat(this.checkNode(node)))); return result;