0

toast-ui vue-editor doesn't support v-model to bind the value. What should be done to bind the input value while using toast-ui vue-editor? I have setup toast-ui:

import '@toast-ui/editor/dist/toastui-editor.css';
import { Editor } from '@toast-ui/vue-editor';
export default {
  components: {
    editor: Editor
  }
}
<editor
    :initialValue="form.explanation"
    height="500px"
    initialEditType="markdown"
    previewStyle="vertical"
    ref="toastuiEditor"
  />

I need to bind my form data and save it to database.

3
  • Do you want to read back data or insert data?
    – JohnRambo
    Commented Sep 17, 2020 at 14:06
  • I want to insert data. Commented Sep 17, 2020 at 14:09
  • you can reference your editor and invoke its value than you can couple this value to your variable. See their documentation npmjs.com/package/@toast-ui/vue-editor You can search here for getHtml it is pretty well documented
    – JohnRambo
    Commented Sep 17, 2020 at 14:16

1 Answer 1

0

A simple and quick solution is to use

   @ change = "getHtml" 

in the data create

form: {
       text: ""
}

then create a method called

getHtml () {
  let html = this. $ refs.toastuiEditor.invoke ('getHtml');

  this.form.text= html;
} 

where form.text would be who would get the value of the editor

My mother tongue is not English so I apologize if I made a spelling mistake

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.