feat: add more transform trigger point
All checks were successful
/ deploy_site (push) Successful in 3m46s
All checks were successful
/ deploy_site (push) Successful in 3m46s
This commit is contained in:
parent
735284416a
commit
c56390050d
@ -32,6 +32,14 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
value: ''
|
value: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const triggerTransform = async () =>
|
||||||
|
await transform
|
||||||
|
.fn(value, options)
|
||||||
|
.then((result) => {
|
||||||
|
setResult(result)
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setAlreadyClosed(closed)
|
setAlreadyClosed(closed)
|
||||||
}, [])
|
}, [])
|
||||||
@ -40,9 +48,7 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
if (closed)
|
if (closed)
|
||||||
return
|
return
|
||||||
|
|
||||||
transform
|
triggerTransform()
|
||||||
.fn(value, options)
|
|
||||||
.then(setResult.bind(this))
|
|
||||||
}, [value, options, closed])
|
}, [value, options, closed])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -54,6 +60,7 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
|
|
||||||
if (previewDisabled) {
|
if (previewDisabled) {
|
||||||
setClosed(alreadyClosed)
|
setClosed(alreadyClosed)
|
||||||
|
triggerTransform()
|
||||||
setPreviewDisabled(false)
|
setPreviewDisabled(false)
|
||||||
}
|
}
|
||||||
}, [value])
|
}, [value])
|
||||||
@ -107,17 +114,23 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
setOptions(new Map(options))
|
setOptions(new Map(options))
|
||||||
}
|
}
|
||||||
|
|
||||||
const onForwardButtonPressed = () => {
|
const onForwardButtonPressed = async () => {
|
||||||
|
const result =
|
||||||
|
await triggerTransform()
|
||||||
|
|
||||||
if (result.error)
|
if (result.error)
|
||||||
return
|
return
|
||||||
|
|
||||||
setValue(result.value)
|
setValue(result.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onLabelClicked = () => {
|
const onLabelClicked = async () => {
|
||||||
if (previewDisabled)
|
if (previewDisabled)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if (closed)
|
||||||
|
triggerTransform()
|
||||||
|
|
||||||
setClosed(!closed)
|
setClosed(!closed)
|
||||||
setAlreadyClosed(!closed)
|
setAlreadyClosed(!closed)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user