Skip to content

Commit 931953e

Browse files
committed
feat(FormEditor): Remember last used Editor Tab
1 parent d45698f commit 931953e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dev/pages/samples/FormEditor.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ const { generateId } = useFormKitSection()
1313
1414
const formSchema = ref(editorSchema)
1515
const formData = ref(null)
16+
const lastSelection = ref('showBasic')
1617
1718
function enhanceValuesForInputList(values: any[]): any[] {
18-
const result = []
19+
const result: any[] = []
1920
values.forEach((value) => {
20-
result.push({ ...value, editableItemId: generateId(), selectButton: 'showBasic' })
21+
result.push({ ...value, editableItemId: generateId(), selectButton: lastSelection.value })
2122
})
2223
return result
2324
}
@@ -31,7 +32,7 @@ function actionDelete(schema: any) {
3132
function actionEdit(schema: any) {
3233
const data = schemaToEditorData({ ...schema })
3334
addListGroupFunctions(data)
34-
formData.value = data
35+
formData.value = { ...data, selectButton: lastSelection.value }
3536
}
3637
3738
function actionInsert(schema: any) {
@@ -50,6 +51,7 @@ function actionUpdateInputs() {
5051
const schema = formInputList.value.find(input => input.editableItemId === formData.value.editableItemId)
5152
const index = formInputList.value.indexOf(schema)
5253
formInputList.value.splice(index, 1, editorDataToSchema(formData.value))
54+
lastSelection.value = formData.value ? formData.value.selectButton : 'showBasic'
5355
formData.value = null
5456
}
5557

0 commit comments

Comments
 (0)