question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Why does the editor not reset when i reset test from v-model:content="test"

See original GitHub issue

The editor doesn’t change when it’s v-model variable changes. Why is that?

So testReset() does nothing visual in this example.

Code:

<QuillEditor
        :id="name"
        v-model:content="test"
        :name="name"
        theme="bubble"
        toolbar="essential"
        content-type="html"
></QuillEditor>

<button @click="testReset()">reset</button>

data: {
  return {
    test: ""
  }
}

methods: {
    testReset() {
      console.log(this.test);
      this.test = "resetted";
    },
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:21

github_iconTop GitHub Comments

3reactions
ttntmcommented, Aug 20, 2021

I encountered a similar issue yesterday. Needed to update the displayed editor content after fetching new data.

Didn’t get it to work until I put the editor right into the component fetching the data (so there’s no events in between), attached v-model:content to the correct key in my editable object (created by reactive()) and used setHTML() once (= 1 time) after the updated data came in.

No cursor issues that way; I also encountered them when working with the editor in its own compenent, using props/emit() to communicate with the parent.

PS: setHTML() needs a ref() when using Composition API, just in case that’s what you were asking @marzz17. So, if you do this

const editor = ref()
...
<QuillEditor ref="editor" ... />

then you can use editor.value.setHTML(yourHTML) anywhere in your setup() or <script setup>.

1reaction
ttntmcommented, Feb 11, 2022

Sure @bulich - line 104 in this component here: https://github.com/ttntm/recept0r-ts/blob/main/src/views/RecipeEditable.vue

Haven’t had any issues using it this way since posting my initial comment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio doesn't reset tests results
to get around it, i just unload/reload the test project, and it should reset the tests.
Read more >
Achieve, Sapling Learning (High School) > Editing/resetting ...
This article will show you how to edit or reset scores on an Assessment. You can edit or reset the entire assessment for...
Read more >
Solved: Resetting a test - Instructure Community
Solved: How do you re-set a test for a student to take? A student lost internet service after only answering 10 out of...
Read more >
Test results are reset - Visual Studio Feedback
There is no "not run" tests at all. While editing a failed test I run the test a few times. And after one...
Read more >
Variable doesn't reset between test session. Bug?
time+delay then checking if time.time > this to no avail. What happens is the first time I run the code in test mode...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found