fix links to comments
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user