progress for file update inapp

This commit is contained in:
Julien Calixte
2023-08-20 23:55:25 +02:00
parent 767e238848
commit ccb486a0b6
6 changed files with 118 additions and 24 deletions

View File

@@ -1,24 +1,24 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
defineProps<{
modelValue: string
}>()
const props = defineProps<{ sha: string; initialContent: string }>()
const content = ref('')
onMounted(() => {
content.value = props.initialContent
})
const emits = defineEmits<{
(event: 'update:modelValue', payload: string): void
}>()
const handleInput = (input: string) => {
content.value = input
emits('update:modelValue', input)
}
</script>
<template>
<div>
<pre
v-once
contenteditable
@input="(e) => handleInput((e.target as any)?.innerText ?? '')"
>{{ initialContent }}</pre
>{{ modelValue }}</pre
>
</div>
</template>