@yogiswara/honcho-editor-ui 1.0.14 → 1.0.16
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.
|
@@ -275,6 +275,8 @@ export function useHonchoEditor(controller, initImageId, firebaseUid) {
|
|
|
275
275
|
? gallery.raw_edited.path
|
|
276
276
|
: gallery?.download?.path;
|
|
277
277
|
if (imagePath) {
|
|
278
|
+
console.log(imagePath);
|
|
279
|
+
console.log({ ...gallery });
|
|
278
280
|
await loadImageFromUrl(imagePath);
|
|
279
281
|
}
|
|
280
282
|
else {
|
|
@@ -287,17 +289,27 @@ export function useHonchoEditor(controller, initImageId, firebaseUid) {
|
|
|
287
289
|
}
|
|
288
290
|
}, [controller, loadImageFromUrl]);
|
|
289
291
|
const handlePrev = useCallback(async (firebaseUid) => {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
292
|
+
// Find the current image index
|
|
293
|
+
const currentIndex = imageList.findIndex(img => img.id === currentImageId);
|
|
294
|
+
// If not the first image, go to previous
|
|
295
|
+
if (currentIndex > 0) {
|
|
296
|
+
const prevImageId = imageList[currentIndex - 1]?.id;
|
|
297
|
+
if (prevImageId) {
|
|
298
|
+
setCurrentImageId(prevImageId);
|
|
299
|
+
}
|
|
293
300
|
}
|
|
294
|
-
}, [imageList]);
|
|
301
|
+
}, [imageList, currentImageId]);
|
|
295
302
|
const handleNext = useCallback(async (firebaseUid) => {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
303
|
+
// Find the current image index
|
|
304
|
+
const currentIndex = imageList.findIndex(img => img.id === currentImageId);
|
|
305
|
+
// If not the last image, go to next
|
|
306
|
+
if (currentIndex < imageList.length - 1 && currentIndex !== -1) {
|
|
307
|
+
const nextImageId = imageList[currentIndex + 1]?.id;
|
|
308
|
+
if (nextImageId) {
|
|
309
|
+
setCurrentImageId(nextImageId);
|
|
310
|
+
}
|
|
299
311
|
}
|
|
300
|
-
}, [imageList]);
|
|
312
|
+
}, [imageList, currentImageId]);
|
|
301
313
|
useEffect(() => {
|
|
302
314
|
if (currentImageId && firebaseUid) {
|
|
303
315
|
loadImageFromId(firebaseUid, currentImageId);
|