I’m writing a dynamic content macro for confluence with atlassian connect which just inserts a bit of inline text into the page. At the moment this works fine except the text is always about 5px above where it should be. This seems to be caused by the position of the iframe itself.
Is there anything I can do to bring the text down into line?
Here is my code:
atlassian-connect.json
{
"name": "CDOX",
"description": "CDOX Add-on",
"key": "com.cognidox.cdox",
"baseUrl": "https://www.example.com/atlassian",
"vendor": {
"name": "Cognidox Ltd.",
"url": "http://www.cognidox.com"
},
"authentication": {
"type": "none"
},
"modules": {
"dynamicContentMacros": [
{
"key": "cdox",
"name": {
"value": "CDOX"
},
"url": "/part.php",
"description": {
"value": "Link to CDOX part numbers"
},
"outputType": "INLINE",
"output-type": "INLINE",
"bodyType": "none",
}
]
}
}
part.php
<!doctype html>
<html>
<head>
<title>CogniDox</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link rel="stylesheet" href="//aui-cdn.atlassian.com/aui-adg/6.0.6/css/aui.min.css" media="all">
<link rel="stylesheet" href="//aui-cdn.atlassian.com/aui-adg/6.0.6/css/aui-experimental.min.css" media="all">
<script src="//aui-cdn.atlassian.com/aui-adg/6.0.6/js/aui.min.js"></script>
<script src="//aui-cdn.atlassian.com/aui-adg/6.0.6/js/aui-experimental.min.js"></script>
<script src="//aui-cdn.atlassian.com/aui-adg/6.0.6/js/aui-datepicker.min.js"></script>
<script src="//aui-cdn.atlassian.com/aui-adg/6.0.6/js/aui-soy.min.js"></script>
<style>
a {
text-decoration: none;
}
body, html {
background-color: #fff;
padding: 0;
margin: 0;
white-space:nowrap;
overflow: visible;
}
#container {
display: inline-block;
white-space:nowrap;
margin: 0;
white-space:nowrap;
overflow: visible;
position: fixed;
bottom: 0px;
}
#content {
position: relative;
margin: 0;
display: block;
white-space:nowrap;
overflow: visible;
}
img {
padding-right: 3px;
}
</style>
</head>
<body>
<span id='container'>
<span id="content" class='ac-content'>
foo
</span>
</span>
<div data-options="resize: false; margin: false"></div>
<script data-options='resize: false; margin: false'>
function resize() {
var elem = $("#container");
var width = elem.width();
var height = elem.height();
AP.resize(width, height);
}
$(function() {
var getUrlParam = function (param) {
var codedParam = (new RegExp(param + '=([^&]+)')).exec(window.location.search)[1];
return decodeURIComponent(codedParam);
};
var baseUrl = getUrlParam('xdm_e') + getUrlParam('cp');
$.getScript(baseUrl + '/atlassian-connect/all.js', function() {
console.log("I can use AP now");
setTimeout(resize, 200);
});
});
</script>
</body>
</html>
