Skip to content

How to use methods ? #33

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

Closed
igorraphael opened this issue May 27, 2021 · 6 comments
Closed

How to use methods ? #33

igorraphael opened this issue May 27, 2021 · 6 comments
Assignees
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@igorraphael
Copy link

How to use methods Vuequill, like setHTML,getHTML ...

I try use setHTML on ready event but return setHTML is not a function..

@luthfimasruri
Copy link
Collaborator

which version did you use?

@igorraphael
Copy link
Author

1.0.0-beta-5

@luthfimasruri
Copy link
Collaborator

can you share the source code?

@igorraphael
Copy link
Author

`
const quillReady = (quill) => {

 quill.setHTML('<h1>Hi</h1>');
 //quill.getEditor();
 //quill.setText('hi');

}

<QuillEditor onReady={(quill) => this.quillReady(quill)} contetType='html' />
`

Well, i want to add html inside the editor, through a button and also through drag and drop. But only setText () works, and the others return : is not a function...

@luthfimasruri
Copy link
Collaborator

luthfimasruri commented Jun 4, 2021

How to use methods in composition API:

<template>
  <QuillEditor ref="myEditor" />
</template>

<script>
import { QuillEditor } from '@vueup/vue-quill'
import { ref, onMounted } from 'vue'
export default {
  components: {
    QuillEditor,
  },
  setup() {
    const myEditor= ref(null)
    onMounted(()=> {
      console.log(myEditor.value.getEditor())
    })
    return { myEditor }
  }
};
</script>

sorry for the delayed reply.

@luthfimasruri luthfimasruri reopened this Jun 4, 2021
@luthfimasruri
Copy link
Collaborator

Usage in option API:

<template>
  <QuillEditor ref="myEditor" />
</template>

<script>
import { QuillEditor } from '@vueup/vue-quill'
export default {
  components: {
    QuillEditor,
  },
  mounted() {
    console.log(this.$refs.myEditor.getEditor())
  }
};
</script>

@luthfimasruri luthfimasruri added documentation Improvements or additions to documentation question Further information is requested labels Jun 5, 2021
@luthfimasruri luthfimasruri self-assigned this Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants