Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Users a parameter check to only make elements of current story editable.
Vue.directive('my-editable', {
bind: function(el, binding) {
if (typeof binding.value._editable === 'undefined') {
var options = JSON.parse(binding.value._editable.replace('<!--#storyblok#', '').replace('-->', ''))
if ( != window.storyblok.getParam('_storyblok')) {
el.setAttribute('data-blok-c', JSON.stringify(options))
el.setAttribute('data-blok-uid', + '-' + options.uid)
addClass(el, 'storyblok__outline')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment