Created
February 5, 2020 11:32
-
-
Save onefriendaday/a646fadb462367e8682fc540878c351d to your computer and use it in GitHub Desktop.
Users a parameter check to only make elements of current story editable.
This file contains hidden or 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
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