Roo-Code/webview-ui/src/utils/imageUtils.ts
Will Li fb374b3e94
Message edit/delete overhaul (#5538)
* improved chat row first pass

* big UI improvements

* working functionality

* tests working

* ok finally tests working for real!

* translations

* add back hidden flag

* remove option to skip notif

* fixed image issue

* ui fix

* put back edit flag

* oops test fix

* reduce margins

* code review
2025-07-17 10:16:57 -04:00

17 lines
598 B
TypeScript

/**
* Utility function to append new images to existing images array
* while respecting the maximum image limit
*
* @param currentImages - The current array of images
* @param newImages - The new images to append
* @param maxImages - The maximum number of images allowed
* @returns The updated images array
*/
export function appendImages(currentImages: string[], newImages: string[] | undefined, maxImages: number): string[] {
const imagesToAdd = newImages ?? []
if (imagesToAdd.length === 0) {
return currentImages
}
return [...currentImages, ...imagesToAdd].slice(0, maxImages)
}