@yogiswara/honcho-editor-ui 1.4.6 → 1.4.7
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.
|
@@ -298,14 +298,13 @@ export function useHonchoEditor(controller, initImageId, firebaseUid) {
|
|
|
298
298
|
const file = new File([blob], filename, { type: blob.type });
|
|
299
299
|
await editorRef.current.loadImageFromFile(file);
|
|
300
300
|
setIsImageLoaded(true);
|
|
301
|
-
updateCanvasEditor();
|
|
302
301
|
}
|
|
303
302
|
catch (error) {
|
|
304
303
|
console.error(error);
|
|
305
304
|
setEditorStatus("Error: Could not load image from URL.");
|
|
306
305
|
setIsImageLoaded(false);
|
|
307
306
|
}
|
|
308
|
-
}, [editorRef.current
|
|
307
|
+
}, [editorRef.current]);
|
|
309
308
|
const handleScriptReady = useCallback(async () => {
|
|
310
309
|
console.log("[Editor] Script tag is ready."); // Log entry
|
|
311
310
|
if (typeof window.Module === 'function' && !editorRef.current) {
|
|
@@ -662,11 +661,11 @@ export function useHonchoEditor(controller, initImageId, firebaseUid) {
|
|
|
662
661
|
}, [galleryImageData, editorRef.current]);
|
|
663
662
|
useEffect(() => {
|
|
664
663
|
// Render photo if adjustmentState change;
|
|
665
|
-
if (!editorRef.current)
|
|
664
|
+
if (!editorRef.current || !isImageLoaded)
|
|
666
665
|
return;
|
|
667
666
|
editorRef.current.setAdjustments(mapAdjustmentStateToAdjustmentEditor(currentAdjustmentsState));
|
|
668
667
|
updateCanvasEditor();
|
|
669
|
-
}, [editorRef.current, currentAdjustmentsState]);
|
|
668
|
+
}, [editorRef.current, currentAdjustmentsState, isImageLoaded]);
|
|
670
669
|
useEffect(() => {
|
|
671
670
|
window.addEventListener('keydown', handleKeyDown);
|
|
672
671
|
return () => {
|