| 19 | const INLINE_IMAGE_HEIGHT = 3 |
| 20 | |
| 21 | const truncateFilename = (filename: string): string => { |
| 22 | if (filename.length <= MAX_FILENAME_LENGTH) { |
| 23 | return filename |
| 24 | } |
| 25 | const lastDot = filename.lastIndexOf('.') |
| 26 | const ext = lastDot !== -1 ? filename.slice(lastDot) : '' |
| 27 | const baseName = lastDot !== -1 ? filename.slice(0, lastDot) : filename |
| 28 | const maxBaseLength = MAX_FILENAME_LENGTH - ext.length - 1 // -1 for ellipsis |
| 29 | return baseName.slice(0, maxBaseLength) + '…' + ext |
| 30 | } |
| 31 | |
| 32 | export interface ImageCardImage { |
| 33 | path: string |