storyblok-react
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -50,2 +50,7 @@ 'use strict'; | ||
}, { | ||
key: 'hasClass', | ||
value: function hasClass(el, className) { | ||
return el.classList ? el.classList.contains(className) : new RegExp('\\b' + className + '\\b').test(el.className); | ||
} | ||
}, { | ||
key: 'addClass', | ||
@@ -55,3 +60,3 @@ value: function addClass(el, className) { | ||
el.classList.add(className); | ||
} else if (!hasClass(el, className)) { | ||
} else if (!this.hasClass(el, className)) { | ||
el.className += ' ' + className; | ||
@@ -58,0 +63,0 @@ } |
{ | ||
"name": "storyblok-react", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "React component for storyblok.", | ||
@@ -14,2 +14,3 @@ "keywords": [ | ||
"main": "./lib/sb-editable.js", | ||
"types": "./lib/sb-editable.d.ts", | ||
"scripts": { | ||
@@ -16,0 +17,0 @@ "build": "babel -d lib/ src/ && date", |
@@ -24,6 +24,10 @@ import React from 'react' | ||
hasClass(el, className) { | ||
return el.classList ? el.classList.contains(className) : new RegExp('\\b'+ className+'\\b').test(el.className) | ||
} | ||
addClass(el, className) { | ||
if (el.classList) { | ||
el.classList.add(className) | ||
} else if (!hasClass(el, className)) { | ||
} else if (!this.hasClass(el, className)) { | ||
el.className += ' ' + className | ||
@@ -30,0 +34,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6233
5
105