-
Notifications
You must be signed in to change notification settings - Fork 0
IK-2406 Expose full FileElement as part of export and compute imageDimensions using the image element #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…tored file elements
There was a problem hiding this 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
imageDimensionsproperty toFileElementand createdInputFileElementtype to distinguish between input images (without dimensions) and stored images (with dimensions) - Updated export option callbacks to receive objects containing both URLs and full
FileElementmetadata 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.
| }, | ||
| ], | ||
| }, | ||
| // { |
There was a problem hiding this comment.
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?
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
imageDimensionsproperty to theFileElementtype, and created anInputFileElementtype for inputs without dimensions. The store and editor APIs now useInputFileElementfor incoming images and ensureFileElementalways includesimageDimensions. Added asetImageDimensionsaction to update dimensions after image load. [1] [2] [3] [4] [5]HeaderPropsand export option types so that export callbacks now receive richer objects containing both the image URL and the fullFileElement(including metadata and dimensions), instead of just URLs. This enables more powerful export workflows. [1] [2] [3]ImageKitEditorProps,loadImage,addImage, etc.) to use the new types and propagate image dimension handling throughout the editor. [1] [2] [3]Improved Image Dimension Handling
GridView,ListView, andToolbarcomponents to set image dimensions in the store when images are loaded. UpdatedActionBarto 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
2.0.0, reflecting breaking changes in the API. Updated the example's usage of metadata to includefileName, and adjusted export option callbacks to match the new API. [1] [2] [3] [4]Build and Tooling Enhancements
package.jsonto include theshxdependency and ensure theREADME.mdis copied before packaging or releasing the editor, improving the release process.Minor Fixes
RetryableImagecomponent to call the providedonLoadprop when the image is loaded, improving compatibility with parent components. [1] [2]