Created
January 17, 2018 01:53
-
-
Save DominikAngerer/25a5b4f837f0f60df410a74087670f61 to your computer and use it in GitHub Desktop.
TinyMCE community edition
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
module.exports = { | |
watch: { | |
'model': { | |
handler: function (value) { | |
this.$emit('changed-model', value) | |
}, | |
deep: true | |
} | |
}, | |
created: function() { | |
jQuery.getScript('https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.7.4/tinymce.min.js', this.initEditor.bind(this)) | |
}, | |
props: ['model'], | |
methods: { | |
initEditor: function() { | |
if (!this.model) { | |
this.model = '' | |
} | |
tinymce.init({ | |
target: this.$el.querySelector('.textarea'), | |
init_instance_callback: function(editor) { | |
editor.on('input change undo redo setcontent', function() { | |
this.$emit('changed-model', editor.getContent()) | |
}.bind(this)) | |
} | |
}) | |
} | |
}, | |
template: "<div><textarea v-model=\"model\" rows=\"5\" class=\"textarea uk-width-1-1\"><\/textarea><\/div>" | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment