Last active
November 19, 2021 21:53
-
-
Save silkentrance/917b6ba0017eeb9684379073a51b63aa to your computer and use it in GitHub Desktop.
Confluence Server : Display Embedded SVG inline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add the following to your confluence server Custom HTML (At end of HEAD) | |
``` | |
<style type="text/css"> | |
.confluence-embedded-file[data-mime-type="image/svg+xml"] span { | |
display: none; | |
visibility: hidden; | |
} | |
</style> | |
<script> | |
AJS.$(document).ready(function() { | |
AJS.$(".confluence-embedded-file[data-mime-type='image/svg+xml'").each(function () { | |
const elem = $(this); | |
const url = elem.data('file-src'); | |
const children = elem.children(); | |
children[0].src = url; | |
}); | |
}); | |
</script> | |
``` | |
This will replace the placeholder URL of the img with the actual URL of the attachment. | |
It will also hide the span. | |
Tested with both page local attachments and attachments from other pages. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A plugin for confluence server
https://github.com/coldrye-confluence/svg-embedded-display-plugin