feat: check if alt text present in img tag
This commit is contained in:
@@ -30,10 +30,14 @@ const getAttributeOptions = (tagName: string, elementInfo: ElementInfo | null):
|
|||||||
{ label: `URL: ${elementInfo.url}`, value: 'href' }
|
{ label: `URL: ${elementInfo.url}`, value: 'href' }
|
||||||
];
|
];
|
||||||
case 'img':
|
case 'img':
|
||||||
return [
|
const options: AttributeOption[] = [];
|
||||||
{ label: `Alt Text: ${elementInfo.innerText}`, value: 'alt' },
|
if (elementInfo.innerText) {
|
||||||
{ label: `Source URL: ${elementInfo.imageUrl}`, value: 'src' }
|
options.push({ label: `Alt Text: ${elementInfo.innerText}`, value: 'alt' });
|
||||||
];
|
}
|
||||||
|
if (elementInfo.imageUrl) {
|
||||||
|
options.push({ label: `Source URL: ${elementInfo.imageUrl}`, value: 'src' });
|
||||||
|
}
|
||||||
|
return options;
|
||||||
default:
|
default:
|
||||||
return [{ label: `Text: ${elementInfo.innerText}`, value: 'innerText' }];
|
return [{ label: `Text: ${elementInfo.innerText}`, value: 'innerText' }];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user