Created
February 21, 2018 05:37
-
-
Save Jinksi/ffcb76e4040f9c47ff4cd3af69768cfb to your computer and use it in GitHub Desktop.
Netlify CMS base64 encode widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var EncodeControl = createClass({ | |
handleChange: function (e) { | |
this.props.onChange(btoa(e.target.value.trim())) | |
}, | |
render: function () { | |
var value = this.props.value ? atob(this.props.value) : '' | |
return h('input', { | |
type: 'text', | |
value: value, | |
onChange: this.handleChange, | |
className: 'nc-controlPane-widget' | |
}) | |
} | |
}) | |
CMS.registerWidget('encode', EncodeControl) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment