Skip to content

Conversation

@ahnv
Copy link
Member

@ahnv ahnv commented Dec 5, 2025

This pull request introduces several improvements and breaking changes to the ImageKit Editor, focusing on enhanced type safety, better image metadata handling, and improved export functionality. The most significant changes include updating the editor's core types to explicitly track image dimensions, refactoring export option APIs for richer data, and upgrading the example and package versions to reflect these changes.

Major API and Type Changes

  • Introduced a new imageDimensions property to the FileElement type, and created an InputFileElement type for inputs without dimensions. The store and editor APIs now use InputFileElement for incoming images and ensure FileElement always includes imageDimensions. Added a setImageDimensions action to update dimensions after image load. [1] [2] [3] [4] [5]
  • Updated the HeaderProps and export option types so that export callbacks now receive richer objects containing both the image URL and the full FileElement (including metadata and dimensions), instead of just URLs. This enables more powerful export workflows. [1] [2] [3]
  • Refactored all relevant component props and usages (ImageKitEditorProps, loadImage, addImage, etc.) to use the new types and propagate image dimension handling throughout the editor. [1] [2] [3]

Improved Image Dimension Handling

  • Added logic in GridView, ListView, and Toolbar components to set image dimensions in the store when images are loaded. Updated ActionBar to use memoized dimension data from the store for the currently selected image, removing redundant local state and effects. [1] [2] [3] [4] [5] [6] [7] [8]

Example and Package Updates

  • Upgraded the example app and main editor package to version 2.0.0, reflecting breaking changes in the API. Updated the example's usage of metadata to include fileName, and adjusted export option callbacks to match the new API. [1] [2] [3] [4]

Build and Tooling Enhancements

  • Modified the root package.json to include the shx dependency and ensure the README.md is copied before packaging or releasing the editor, improving the release process.

Minor Fixes

  • Fixed the RetryableImage component to call the provided onLoad prop when the image is loaded, improving compatibility with parent components. [1] [2]

@ahnv ahnv requested a review from Copilot December 5, 2025 11:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces breaking API changes to enhance type safety and metadata handling in the ImageKit Editor. The changes enable the editor to track image dimensions internally and provide richer export functionality by exposing full FileElement objects instead of just URLs.

Key Changes

  • Introduced imageDimensions property to FileElement and created InputFileElement type to distinguish between input images (without dimensions) and stored images (with dimensions)
  • Updated export option callbacks to receive objects containing both URLs and full FileElement metadata instead of just URL strings
  • Refactored image dimension handling to use centralized store state instead of local component state

Reviewed changes

Copilot reviewed 12 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/imagekit-editor/package.json Bumped version to 2.0.0 to reflect breaking API changes
packages/imagekit-editor-dev/src/store.ts Added imageDimensions to FileElement, created InputFileElement type, and added setImageDimensions action
packages/imagekit-editor-dev/src/components/header/index.tsx Updated export callbacks to receive objects with URL and FileElement instead of just URLs
packages/imagekit-editor-dev/src/components/toolbar/toolbar.tsx Added onLoad handler to set image dimensions when thumbnails load
packages/imagekit-editor-dev/src/components/editor/ListView.tsx Added onLoad handler to set image dimensions for list view images
packages/imagekit-editor-dev/src/components/editor/GridView.tsx Added onLoad handler to set image dimensions for grid view images
packages/imagekit-editor-dev/src/components/editor/ActionBar.tsx Replaced local state and useEffect with memoized selector for image dimensions from store
packages/imagekit-editor-dev/src/components/RetryableImage.tsx Fixed component to call parent onLoad prop when image loads
packages/imagekit-editor-dev/src/ImageKitEditor.tsx Updated types to use InputFileElement for API inputs
package.json Added shx dependency and updated build scripts to copy README during packaging
examples/react-example/package.json Updated dependency to 2.0.0
examples/react-example/src/index.tsx Updated metadata to include fileName and adjusted export callback signatures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

},
],
},
// {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this commented out menu option?

@ahnv ahnv merged commit aa41bad into main Dec 8, 2025
2 checks passed
@ahnv ahnv deleted the IK-2406 branch December 8, 2025 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants