Undo/redo form editor (#452)

* Undo/redo form editor

* Fix undo/redo

* Fix history with version check

* Increase default history size

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Chirag Chhatrala
2024-06-25 19:18:20 +05:30
committed by GitHub
parent f40b95977d
commit 0334f7c883
7 changed files with 217 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<template>
<UButtonGroup
size="sm"
orientation="horizontal"
>
<UButton
:disabled="!canUndo"
color="white"
icon="i-material-symbols-undo"
class="disabled:text-gray-500"
@click="undo"
/>
<UButton
:disabled="!canRedo"
icon="i-material-symbols-redo"
color="white"
class="disabled:text-gray-500"
@click="redo"
/>
</UButtonGroup>
</template>
<script setup>
const workingFormStore = useWorkingFormStore()
const { undo, redo, clearHistory } = workingFormStore
const { canUndo, canRedo } = storeToRefs(workingFormStore)
onMounted(() => {
setTimeout(() => { clearHistory() }, 500)
})
</script>