Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

95
Views
Updating tinymce editor text between components

So I'm using the tinymce editor for Vue. I'm displaying one Editor in the parent component, and then rendering another Editor in the child which reactively displays what has been typed in the parent. The problem I'm running into is that the child is one character behind. I tried making the editor content its own variable in the child instead of being passed via props, but I couldn't figure out a way to update correctly while also saving the HTML tags that tinymce adds.

Here's what I have:

The parent component:

                        <Editor
                          v-model="body"
                          api-key=****
                          model-events="change keydown blur focus paste undo redo"
                          :init="{
                            height: 300,
                            menubar: false,
                            nonbreaking_force_tab: true,
                            branding: false,
                            init_instance_callback: function (editor) {
                              editor.on('Change', function (e) {
                                setHasChanges(); //this just says the form has updates
                              });
                            },
                            plugins: [
                              'advlist autolink lists link image charmap',
                              'searchreplace visualblocks code fullscreen',
                              'print preview anchor insertdatetime media',
                              'paste code help wordcount table'
                            ],
                            toolbar:
                              'undo redo | formatselect | bold italic | \
                            bullist numlist | \
                            alignleft aligncenter alignright outdent indent | help'
                          }"
                        >
                        </Editor>

And the child:

        <Editor
          :value="body"
          api-key=***
          model-events="change keydown blur focus paste undo redo"
          disabled="true"
          :init="{
            menubar: false,
            branding: false,
            toolbar: false,
            statusbar: false,
            content_style:
              'body { font-size: 12px; line-height: 1.35; margin: 10px auto 0; display: block; position: relative; height: 100px; overflow-x: hidden }'
          }"
        >
        </Editor>

So if the editor of the parent component had this:

<h2>Here is a title!</h2>
<ul>
 <li>and a bullet point</li>
 <li>and another</li>
</ul>

The child would display:

Here is a title!

  1. and a bullet point
  2. and another

How can I update the child reactively while still keeping the HTML tags?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

So I figured it out. All I had to do was add "input" into the model-events of the editor on the parent component.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!