Added ellipses to truncated media label if the media label is larger than the truncation size. (#471)
This commit is contained in:
@@ -73,8 +73,13 @@ export const generateMediaLabel = (
|
||||
},
|
||||
);
|
||||
|
||||
const mediaLabel =
|
||||
truncation_size.value > 0 ? truncatedLabel.substring(0, truncation_size.value) : truncatedLabel;
|
||||
const maxLabelSize = truncation_size.value;
|
||||
|
||||
let mediaLabel = truncatedLabel;
|
||||
|
||||
if (maxLabelSize > 0 && truncatedLabel.length > maxLabelSize) {
|
||||
mediaLabel = `${truncatedLabel.substring(0, maxLabelSize)}...`;
|
||||
}
|
||||
|
||||
return mediaLabel.length ? mediaLabel : 'Media';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user