Skip to content

Instantly share code, notes, and snippets.

Embed
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') {
return
}
var options = JSON.parse(binding.value._editable.replace('<!--#storyblok#', '').replace('-->', ''))
if (options.id != window.storyblok.getParam('_storyblok')) {
return
}
el.setAttribute('data-blok-c', JSON.stringify(options))
el.setAttribute('data-blok-uid', options.id + '-' + options.uid)
addClass(el, 'storyblok__outline')
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment