Merge pull request #5821 from backstage/iameap/techdocs-respect-download-attr
[TechDocs] Respect download attribute
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@backstage/plugin-techdocs': patch
|
||||
---
|
||||
|
||||
TechDocs now respects the `download` attribute on anchor tags in generated
|
||||
markup, allowing documentation authors to bundle downloadable files with their
|
||||
documentation.
|
||||
@@ -37,6 +37,7 @@ const fixture = `
|
||||
<body>
|
||||
<img src="test.jpg" />
|
||||
<script type="javascript" src="script.js"></script>
|
||||
<a href="afile.pdf" download>Download Now</a>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
@@ -78,5 +79,11 @@ describe('addBaseUrl', () => {
|
||||
mockEntityId,
|
||||
'',
|
||||
);
|
||||
expect(techdocsStorageApi.getBaseUrl).toHaveBeenNthCalledWith(
|
||||
4,
|
||||
'afile.pdf',
|
||||
mockEntityId,
|
||||
'',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,6 +48,7 @@ export const addBaseUrl = ({
|
||||
updateDom<HTMLImageElement>(dom.querySelectorAll('img'), 'src');
|
||||
updateDom<HTMLScriptElement>(dom.querySelectorAll('script'), 'src');
|
||||
updateDom<HTMLLinkElement>(dom.querySelectorAll('link'), 'href');
|
||||
updateDom<HTMLAnchorElement>(dom.querySelectorAll('a[download]'), 'href');
|
||||
|
||||
return dom;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user