fix links to comments

This commit is contained in:
igoradamenko
2018-04-17 12:08:34 +03:00
parent 09c93627b6
commit d29981868f
4 changed files with 20 additions and 3 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
const BASE_URL = '/';
const BASE_URL = 'https://remark42.radio-t.com/';
const API_BASE = '/api/v1';
const NODE_ID = 'remark42';
const COUNTER_NODE_CLASSNAME = 'remark42__counter';
+1 -1
View File
@@ -66,7 +66,7 @@ export default class Root extends Component {
setTimeout(() => {
comment.scrollIntoView();
window.scrollTo(window.scrollX, 0); // sometimes smth goes wrong and iframe scrolls; we return it here
}, 1000);
}, 500);
}
}
}
+8
View File
@@ -51,11 +51,19 @@ function init() {
window.addEventListener('message', updateIframeHeight);
window.addEventListener('hashchange', postHashToIframe);
setTimeout(postHashToIframe, 1000);
function updateIframeHeight(event) {
try {
const data = JSON.parse(event.data);
iframe.style.height = `${data.remarkIframeHeight}px`;
} catch (e) {}
}
function postHashToIframe() {
iframe.contentWindow.postMessage(JSON.stringify({ hash: location.hash }), '*');
}
}
+10 -1
View File
@@ -8,7 +8,6 @@
</head>
<body>
<div id="remark42"></div>
<script type="text/javascript" src="remark.js"></script>
<script>
var lastHeight = 0;
setInterval(() => {
@@ -17,6 +16,16 @@
window.parent.postMessage(JSON.stringify({ remarkIframeHeight: lastHeight }), '*');
}
}, 200);
window.addEventListener('message', updateHash);
function updateHash(event) {
try {
const data = JSON.parse(event.data);
location.hash = data.hash;
} catch (e) {}
}
</script>
<script type="text/javascript" src="remark.js"></script>
</body>
</html>