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 =
|
const maxLabelSize = truncation_size.value;
|
||||||
truncation_size.value > 0 ? truncatedLabel.substring(0, truncation_size.value) : truncatedLabel;
|
|
||||||
|
let mediaLabel = truncatedLabel;
|
||||||
|
|
||||||
|
if (maxLabelSize > 0 && truncatedLabel.length > maxLabelSize) {
|
||||||
|
mediaLabel = `${truncatedLabel.substring(0, maxLabelSize)}...`;
|
||||||
|
}
|
||||||
|
|
||||||
return mediaLabel.length ? mediaLabel : 'Media';
|
return mediaLabel.length ? mediaLabel : 'Media';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user