@yogiswara/honcho-editor-ui 1.4.11 → 1.4.13

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.
@@ -301,12 +301,6 @@ export function useHonchoEditor(controller, initImageId, firebaseUid) {
301
301
  handleOpenCopyDialog(); // Assumes handleOpenCopyDialog is defined in the hook
302
302
  }
303
303
  }, [ /* handleOpenCopyDialog dependency */]);
304
- const updateCanvasEditor = useCallback(() => {
305
- if ((editorRef.current?.getInitialized() === true) && canvasRef.current) {
306
- editorRef.current.processImage();
307
- editorRef.current.renderToCanvas(canvasRef.current);
308
- }
309
- }, [canvasRef.current, editorRef.current]);
310
304
  const extractPathFromGallery = useCallback((data) => {
311
305
  const imagePath = data?.raw_edited?.path
312
306
  ? data.raw_edited.path
@@ -634,14 +628,14 @@ export function useHonchoEditor(controller, initImageId, firebaseUid) {
634
628
  // will trigger when currentImageId change
635
629
  if (!galleryImageData)
636
630
  return;
637
- console.log("++ USEEFFECT FOR NEXT AND PREV");
631
+ console.log("++ USE EFFECT FOR NEXT AND PREV");
638
632
  const init = async () => {
639
633
  console.log("1. INIT EDITOR");
640
634
  if (editorRef.current?.getInitialized() === false) {
641
635
  await editorRef.current?.initialize();
642
636
  }
643
637
  const adjustmentData = galleryImageData.editor_config?.color_adjustment;
644
- console.log("2. ADJUSTMENTDATA: ", adjustmentData, galleryImageData);
638
+ console.log("2. ADJUSTMENT DATA: ", adjustmentData, galleryImageData);
645
639
  // set event
646
640
  setEventId(galleryImageData.event_id);
647
641
  console.log("3. EVENTID: ", eventId);
@@ -649,32 +643,35 @@ export function useHonchoEditor(controller, initImageId, firebaseUid) {
649
643
  // set to imageList
650
644
  const pathGallery = extractPathFromGallery(galleryImageData);
651
645
  // load image to editor
652
- console.log("4. PATHGALLERY: ", pathGallery);
646
+ console.log("4. PATH GALLERY: ", pathGallery);
653
647
  await loadImageEditorFromUrl(pathGallery);
654
648
  console.log("5. LOAD IMAGE TO EDITOR");
655
- updateCanvasEditor();
656
- console.log("6. UPDATE CANVAS EDITOR");
657
649
  // adjustment setup
658
650
  if (adjustmentData) {
659
- console.log("7. ADJUSTMENTDATA FOUND");
651
+ console.log("7. ADJUSTMENT DATA FOUND");
660
652
  const adjustmentState = mapColorAdjustmentToAdjustmentState(adjustmentData);
661
653
  // set adjustment to editor to make adjustmentState change
662
654
  console.log("8. SYNC HISTORY");
663
655
  historyActions.syncHistory([adjustmentState]);
664
656
  }
665
657
  else {
658
+ historyActions.syncHistory([initialAdjustments]);
666
659
  console.log("no adjustment found, use default");
667
660
  }
668
661
  };
669
662
  init();
670
- }, [galleryImageData, editorRef.current, updateCanvasEditor]);
663
+ }, [galleryImageData, editorRef.current]);
671
664
  useEffect(() => {
672
665
  // Render photo if adjustmentState change;
673
666
  if (!editorRef.current || !isImageLoaded)
674
667
  return;
675
- editorRef.current.setAdjustments(mapAdjustmentStateToAdjustmentEditor(currentAdjustmentsState));
676
- updateCanvasEditor();
677
- }, [editorRef.current, currentAdjustmentsState, isImageLoaded]);
668
+ console.log("Rendering adjustments to editor...", currentAdjustmentsState);
669
+ if ((editorRef.current?.getInitialized() === true) && canvasRef.current) {
670
+ editorRef.current.setAdjustments(mapAdjustmentStateToAdjustmentEditor(currentAdjustmentsState));
671
+ editorRef.current.processImage();
672
+ editorRef.current.renderToCanvas(canvasRef.current);
673
+ }
674
+ }, [editorRef.current, currentAdjustmentsState, isImageLoaded, canvasRef.current]);
678
675
  useEffect(() => {
679
676
  window.addEventListener('keydown', handleKeyDown);
680
677
  return () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yogiswara/honcho-editor-ui",
3
- "version": "1.4.11",
3
+ "version": "1.4.13",
4
4
  "description": "A complete UI component library for the Honcho photo editor.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",