Skip to content

Instantly share code, notes, and snippets.

@DominikAngerer
Created March 6, 2019 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DominikAngerer/b53f705d42e8c6651b6d3243c0c019b3 to your computer and use it in GitHub Desktop.
Save DominikAngerer/b53f705d42e8c6651b6d3243c0c019b3 to your computer and use it in GitHub Desktop.
const Fieldtype = {
mixins: [window.Storyblok.plugin],
template: `<div>
<markdown-field :uid="uid" :model="model.original" :schema="schema" @changed="update" key="original"></markdown-field>
</div>`,
methods: {
initWith() {
return {
plugin: 'markdown-html',
original: '',
html: ''
}
},
update(k, v) {
this.model.original = v
this.model.html = this.$options.filters.marked(v)
}
},
watch: {
'model': {
handler: function (value) {
this.$emit('changed-model', value);
},
deep: true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment