vue-editor-js
vue-editor-js copied to clipboard
TypeError: _this.$refs.editor.save is not a function
When I press the save button it shows me the error message: TypeError: _this.$refs.editor.save is not a function... My vue view code:
<template>
<div class="home">
<editor
header
list
code
ref="editor"
autofocus
holder-id="codex-editor"
save-button-id="save-button"
@save="onSave"
:config="config"
/>
<button @click="save">Save!</button>
</div>
</template>
<style lang="scss" scoped></style>
<script>
export default {
name: "CreatePost",
data() {
return {
config: {
image: {
field: "image",
types: "image/*",
},
},
};
},
methods: {
onSave(response) {
console.log("response: ", response);
},
async save() {
const res = await this.$refs.editor.save();
console.log("res: ", res);
},
},
};
</script>
I found a workaround https://github.com/ChangJoo-Park/vue-editor-js/blob/master/demo/Demo.vue#L101 args from onChange has saver, so saver.save() gives me the content of editor :)
Is there any new solution out there? I got two different property saver and save but that's not working also.

Use this :
this.$refs.editor._data.state.editor.save()
also the useful render() is on this path