@@ -210,7 +210,7 @@ export default class MarkdownPreview extends React.Component {
210
210
this . saveAsHtmlHandler = ( ) => this . handleSaveAsHtml ( )
211
211
this . printHandler = ( ) => this . handlePrint ( )
212
212
213
- this . linkClickHandler = this . handlelinkClick . bind ( this )
213
+ this . linkClickHandler = this . handleLinkClick . bind ( this )
214
214
this . initMarkdown = this . initMarkdown . bind ( this )
215
215
this . initMarkdown ( )
216
216
}
@@ -413,6 +413,8 @@ export default class MarkdownPreview extends React.Component {
413
413
}
414
414
415
415
componentDidMount ( ) {
416
+ const { onDrop } = this . props
417
+
416
418
this . refs . root . setAttribute ( 'sandbox' , 'allow-scripts' )
417
419
this . refs . root . contentWindow . document . body . addEventListener (
418
420
'contextmenu' ,
@@ -450,7 +452,7 @@ export default class MarkdownPreview extends React.Component {
450
452
)
451
453
this . refs . root . contentWindow . document . addEventListener (
452
454
'drop' ,
453
- this . preventImageDroppedHandler
455
+ onDrop || this . preventImageDroppedHandler
454
456
)
455
457
this . refs . root . contentWindow . document . addEventListener (
456
458
'dragover' ,
@@ -467,6 +469,8 @@ export default class MarkdownPreview extends React.Component {
467
469
}
468
470
469
471
componentWillUnmount ( ) {
472
+ const { onDrop } = this . props
473
+
470
474
this . refs . root . contentWindow . document . body . removeEventListener (
471
475
'contextmenu' ,
472
476
this . contextMenuHandler
@@ -485,7 +489,7 @@ export default class MarkdownPreview extends React.Component {
485
489
)
486
490
this . refs . root . contentWindow . document . removeEventListener (
487
491
'drop' ,
488
- this . preventImageDroppedHandler
492
+ onDrop || this . preventImageDroppedHandler
489
493
)
490
494
this . refs . root . contentWindow . document . removeEventListener (
491
495
'dragover' ,
@@ -840,7 +844,7 @@ export default class MarkdownPreview extends React.Component {
840
844
return new window . Notification ( title , options )
841
845
}
842
846
843
- handlelinkClick ( e ) {
847
+ handleLinkClick ( e ) {
844
848
e . preventDefault ( )
845
849
e . stopPropagation ( )
846
850
0 commit comments