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:
32
client/components/open/editors/UndoRedo.vue
Normal file
32
client/components/open/editors/UndoRedo.vue
Normal 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>
|
||||
Reference in New Issue
Block a user