ok, let's try to fix scroll to parent again

This commit is contained in:
igoradamenko
2018-05-12 14:51:18 +03:00
parent 3bd4edbce3
commit b5f49c2c38
2 changed files with 14 additions and 4 deletions
+11 -1
View File
@@ -185,11 +185,21 @@ export default class Comment extends Component {
scrollToParent(e) {
const { data: { pid } } = this.props;
const hash = `#${COMMENT_NODE_CLASSNAME_PREFIX}${pid}`;
e.preventDefault();
// reset old hash
postMessage({ hash: '' });
postMessage({ hash: `#${COMMENT_NODE_CLASSNAME_PREFIX}${pid}` });
// set new hash
postMessage({ hash });
// try to scroll into view
const parentCommentNode = document.querySelector(hash);
if (parentCommentNode) {
parentCommentNode.scrollIntoView();
}
}
render(props, { guest, isUserIdVisible, userBlocked, pinned, score, scoreIncreased, scoreDecreased, deleted, isInputVisible }) {
+3 -3
View File
@@ -24,13 +24,13 @@
<script>
var remark_config = {
site_id: 'radiot',
url: 'https://radio-t.com/p/2017/12/16/podcast-576/',
ё site_id: 'remark',
url: 'https://remark42.com/demo/',
};
(function() {
var d = document, s = d.createElement('script');
var baseurl = '';
var baseurl = 'https://demo.remark42.com/';
s.src = baseurl + '/web/embed.js';
s.type = 'text/javascript';
(d.head || d.body).appendChild(s);