Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit fc804bd

Browse files
authored
fix(rdmd): don't set scrollTop if el is undefined (#793)
1 parent ea7f9f5 commit fc804bd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/markdown/components/Image/index.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ class Image extends React.Component {
3535

3636
lightboxSetup() {
3737
const $el = this.lightbox.current;
38-
setTimeout(() => {
39-
$el.scrollTop = ($el.scrollHeight - $el.offsetHeight) / 2;
40-
}, 0);
38+
if ($el)
39+
setTimeout(() => {
40+
$el.scrollTop = ($el.scrollHeight - $el.offsetHeight) / 2;
41+
}, 0);
4142
}
4243

4344
handleKey(e) {

0 commit comments

Comments
 (0)