Fixed bug with restore from history not working in new URL field

This commit is contained in:
Andrew Bastin
2020-09-19 01:30:22 +00:00
parent b6eb581192
commit 5810c5544a

View File

@@ -16,18 +16,31 @@
}
</style>
<script>
import { type } from "os"
export default {
props: {
value: { type: String },
},
data() {
return {
unwatchValue: null,
}
},
mounted() {
this.$refs.editor.addEventListener("input", this.updateEditor)
this.$refs.editor.textContent = this.value || ""
this.unwatchValue = this.$watch(
() => this.value,
(newVal) => {
if (this.$refs.editor) this.$refs.editor.textContent = newVal || ""
this.updateEditor()
}
)
this.updateEditor()
},
beforeDestroy() {
this.unwatchValue()
this.$refs.editor.removeEventListener("input", this.updateEditor)
},
methods: {