From 543f04d7b270ef7f8f604d3dd5a62d7857cd6302 Mon Sep 17 00:00:00 2001 From: Hari Gopal Date: Fri, 10 Jan 2020 16:08:22 +0530 Subject: [PATCH] Custom Class: Fixed TypeError when mapper is undefined (#2167) --- plugins/custom-class/prism-custom-class.js | 2 +- plugins/custom-class/prism-custom-class.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/custom-class/prism-custom-class.js b/plugins/custom-class/prism-custom-class.js index 24f56549e7..3eeb75f191 100644 --- a/plugins/custom-class/prism-custom-class.js +++ b/plugins/custom-class/prism-custom-class.js @@ -88,7 +88,7 @@ } env.classes = env.classes.map(function (c) { - return prefixString + mapper ? mapper(c, env.language) : c; + return prefixString + (mapper ? mapper(c, env.language) : c); }); }); diff --git a/plugins/custom-class/prism-custom-class.min.js b/plugins/custom-class/prism-custom-class.min.js index da639b6707..e579293526 100644 --- a/plugins/custom-class/prism-custom-class.min.js +++ b/plugins/custom-class/prism-custom-class.min.js @@ -1 +1 @@ -!function(){if("undefined"!=typeof self&&self.Prism||"undefined"!=typeof global&&global.Prism){var a,e,t="";Prism.plugins.customClass={add:function(n){a=n},map:function(s){e="function"==typeof s?s:function(n){return s[n]||n}},prefix:function(n){t=n||""}},Prism.hooks.add("wrap",function(s){if(a){var n=a({content:s.content,type:s.type,language:s.language});Array.isArray(n)?s.classes.push.apply(s.classes,n):n&&s.classes.push(n)}(e||t)&&(s.classes=s.classes.map(function(n){return t+e?e(n,s.language):n}))})}}(); \ No newline at end of file +!function(){if("undefined"!=typeof self&&self.Prism||"undefined"!=typeof global&&global.Prism){var a,e,t="";Prism.plugins.customClass={add:function(n){a=n},map:function(s){e="function"==typeof s?s:function(n){return s[n]||n}},prefix:function(n){t=n||""}},Prism.hooks.add("wrap",function(s){if(a){var n=a({content:s.content,type:s.type,language:s.language});Array.isArray(n)?s.classes.push.apply(s.classes,n):n&&s.classes.push(n)}(e||t)&&(s.classes=s.classes.map(function(n){return t+(e?e(n,s.language):n)}))})}}(); \ No newline at end of file