trix icon indicating copy to clipboard operation
trix copied to clipboard

trix-editor not submit my input using v-model in vue

Open shafiqruslan opened this issue 5 years ago • 2 comments

Steps to Reproduce

I have a form where one of the field is using trix-editor. When i submit the form, every field is submit properly except my input using trix-editor. Can anyone give me a clue about it?

          <div class="mt-1">
            <input id="x" type="hidden" v-model="post.description" />
            <trix-editor
              input="x"
              class="
                trix-content
                bg-white
                shadow-sm
                focus:ring-indigo-500
                focus:border-indigo-500
                mt-1
                block
                w-full
                text-sm
                border-gray-300
                rounded-md
              "
              placeholder="Enter your post"
            ></trix-editor>
          </div>
Details
  • Trix version: 1.31
  • Browser name and version: Chrome
  • Operating system: MacOS Big Sur

shafiqruslan avatar Jun 06 '21 06:06 shafiqruslan

Try to use this:

  methods: {
    setTextToTrix: function() {
        this.post.description = document.getElementById("x").value; 
    }
  },

mounted() {
    document.addEventListener("trix-change", this.setTextToTrix); // Listen to the changes on the editor
   }

gabrieelgomez avatar Jun 09 '21 16:06 gabrieelgomez

Hi. sorry for the late reply. Just got time to continuing my side project. Btw thanks, man.

shafiqruslan avatar Jul 04 '21 15:07 shafiqruslan