CroudTech / vue-quill

Quill component for vue
MIT License
121 stars 22 forks source link

Access quill objects and methods from vue-quill #34

Open towfiles opened 4 years ago

towfiles commented 4 years ago

How can I be able to access the quill instance from a vue-quill implementation?. without using vue-quill and just the normal package, I am aware I can do this

`const editor = new Quill('#quill-editor', { bounds: '#quill-editor', modules: { toolbar: this.toolbarOptions }, placeholder: 'Free Write...', theme: 'snow' });

const range = editor.getSelection(); `

how can we be able to do this in vue-quill?

BrockReece commented 4 years ago

The quill editor instance is exposed through the editor property in the vue-quill component. So, for example, you can set a ref on the component in your html markup

<quill ref="quill" v-model="content"></quill>

and access the editor property through this.$refs.quill.editor, for example...

const range = this.$refs.quill.editor.getSelection();
towfiles commented 4 years ago

Thanks, found the solution already this.$refs.quill[0].editor