Fixed bug with restore from history not working in new URL field
This commit is contained in:
@@ -16,18 +16,31 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
import { type } from "os"
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
value: { type: String },
|
value: { type: String },
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
unwatchValue: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$refs.editor.addEventListener("input", this.updateEditor)
|
this.$refs.editor.addEventListener("input", this.updateEditor)
|
||||||
this.$refs.editor.textContent = this.value || ""
|
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()
|
this.updateEditor()
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
this.unwatchValue()
|
||||||
this.$refs.editor.removeEventListener("input", this.updateEditor)
|
this.$refs.editor.removeEventListener("input", this.updateEditor)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
Reference in New Issue
Block a user