storyblok-react
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -11,5 +11,7 @@ import React from 'react' | ||
} | ||
declare class SbEditable extends React.Component<SbEditableProps, {}> { | ||
declare class SbEditable extends React.PureComponent<SbEditableProps, {}> { | ||
constructor(props: SbEditableProps) | ||
componentDidMount(): void | ||
componentDidUpdate(): void | ||
addPropsOnChildren(): void | ||
addClass(el: HTMLElement, className: string): void | ||
@@ -16,0 +18,0 @@ render(): React.ReactNode |
@@ -25,4 +25,4 @@ 'use strict'; | ||
var SbEditable = function (_React$Component) { | ||
_inherits(SbEditable, _React$Component); | ||
var SbEditable = function (_React$PureComponent) { | ||
_inherits(SbEditable, _React$PureComponent); | ||
@@ -38,2 +38,12 @@ function SbEditable(props) { | ||
value: function componentDidMount() { | ||
this.addPropsOnChildren(); | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate() { | ||
this.addPropsOnChildren(); | ||
} | ||
}, { | ||
key: 'addPropsOnChildren', | ||
value: function addPropsOnChildren() { | ||
if (typeof this.props.content._editable === 'undefined' || window.location === window.parent.location) { | ||
@@ -72,4 +82,4 @@ return; | ||
return SbEditable; | ||
}(_react2.default.Component); | ||
}(_react2.default.PureComponent); | ||
exports.default = SbEditable; |
{ | ||
"name": "storyblok-react", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "React component for storyblok.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
class SbEditable extends React.Component { | ||
class SbEditable extends React.PureComponent { | ||
constructor(props) { | ||
@@ -10,2 +10,10 @@ super(props) | ||
componentDidMount() { | ||
this.addPropsOnChildren() | ||
} | ||
componentDidUpdate() { | ||
this.addPropsOnChildren() | ||
} | ||
addPropsOnChildren() { | ||
if (typeof this.props.content._editable === 'undefined' || | ||
@@ -16,4 +24,4 @@ window.location === window.parent.location) { | ||
var el = ReactDOM.findDOMNode(this) | ||
var options = JSON.parse(this.props.content._editable.replace(/^<!--#storyblok#/, '').replace(/-->$/, '')) | ||
const el = ReactDOM.findDOMNode(this) | ||
const options = JSON.parse(this.props.content._editable.replace(/^<!--#storyblok#/, '').replace(/-->$/, '')) | ||
@@ -20,0 +28,0 @@ if (el instanceof Object && typeof el.setAttribute === 'function') { |
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
7552
122