Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: _this.$refs.editor.save is not a function #69

Open
MuhammadNFadhil opened this issue Dec 14, 2020 · 3 comments
Open

TypeError: _this.$refs.editor.save is not a function #69

MuhammadNFadhil opened this issue Dec 14, 2020 · 3 comments

Comments

@MuhammadNFadhil
Copy link

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>
@zghib
Copy link

zghib commented Dec 18, 2020

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 :)

@bidyut18
Copy link

Is there any new solution out there?
I got two different property saver and save but that's not working also.

SharedScreenshot

@xfhg
Copy link

xfhg commented Feb 13, 2021

Use this :

this.$refs.editor._data.state.editor.save()

also the useful render() is on this path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants