Skip to content

Commit

Permalink
fix: ctrl-z working properly in code editor
Browse files Browse the repository at this point in the history
  • Loading branch information
cadriel committed Dec 19, 2020
1 parent e79feaf commit 4ac441b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/widgets/filesystem/FileEditorWidget.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<template>
<prism-editor
v-if="code && code.length"
class="file-editor"
:value="newValue"
v-model="code"
@input="emitChange($event)"
:highlight="highlighter"
:readonly="readonly"
Expand Down Expand Up @@ -36,10 +37,11 @@ export default class FileEditorWidget extends Vue {
@Watch('value')
onContentsChange (val: string) {
this.newValue = val
this.code = val
}
newValue = ''
code: string | null = null
langMap: {[key: string]: string} = {
md: 'markdown',
cfg: 'ini',
Expand All @@ -48,11 +50,10 @@ export default class FileEditorWidget extends Vue {
}
mounted () {
this.newValue = this.value
this.code = this.value
}
emitChange (val: string) {
this.newValue = val
this.$emit('input', val)
}
Expand Down

0 comments on commit 4ac441b

Please sign in to comment.