Created
March 6, 2019 00:00
-
-
Save DominikAngerer/b53f705d42e8c6651b6d3243c0c019b3 to your computer and use it in GitHub Desktop.
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
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