@antscorp/antsomi-ui 1.3.5-beta.269 → 1.3.5-beta.270
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.d.ts +1 -0
- package/es/components/molecules/ImageEditor/ImageEditor.js +5 -1
- package/es/components/molecules/ImageEditor/reducer.d.ts +3 -0
- package/es/components/molecules/ImageEditor/reducer.js +3 -0
- package/es/components/template/TemplateListing/Loadable.d.ts +1 -0
- package/package.json +1 -1
|
@@ -48,8 +48,12 @@ export const ImageEditor = React.forwardRef((props, ref) => {
|
|
|
48
48
|
? { history: [defaultValue], historyStep: 0, current: defaultValue }
|
|
49
49
|
: initialReducer);
|
|
50
50
|
const { current: { arrows, circles, imageCoordinate, rectangles, scribbles, image }, } = state;
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
// NOTE: reset initial reducer when change image (in ImageSlider)
|
|
53
|
+
dispatch({ type: 'RESET', payload: defaultValue ? defaultValue : initialReducer.current });
|
|
54
|
+
}, [defaultValue]);
|
|
51
55
|
// const [imageFromUrl] = useImage(imageUrl);
|
|
52
|
-
// console.log(imageUrl, '🚀 ~ ImageEditor ~ imageFromUrl:',
|
|
56
|
+
// console.log(imageUrl, '🚀 ~ ImageEditor ~ imageFromUrl:', imageUrl);
|
|
53
57
|
const stageRef = useRef(null);
|
|
54
58
|
const transformerRef = useRef(null);
|
|
55
59
|
const selectionRectangleRef = useRef(null);
|
|
@@ -44,6 +44,9 @@ export const reducer = (state, action) => {
|
|
|
44
44
|
}
|
|
45
45
|
return Object.assign(Object.assign({}, state), { historyStep: state.historyStep + 1, current: state.history[state.historyStep + 1] });
|
|
46
46
|
}
|
|
47
|
+
case 'RESET': {
|
|
48
|
+
return { history: [payload], historyStep: 0, current: payload };
|
|
49
|
+
}
|
|
47
50
|
default:
|
|
48
51
|
break;
|
|
49
52
|
}
|