File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -558,7 +558,9 @@ export default class MarkdownPreview extends React.Component {
558
558
}
559
559
560
560
componentDidUpdate ( prevProps ) {
561
- if ( prevProps . value !== this . props . value ) this . rewriteIframe ( )
561
+ // actual rewriteIframe function should be called only once
562
+ let needsRewriteIframe = false
563
+ if ( prevProps . value !== this . props . value ) needsRewriteIframe = true
562
564
if (
563
565
prevProps . smartQuotes !== this . props . smartQuotes ||
564
566
prevProps . sanitize !== this . props . sanitize ||
@@ -568,7 +570,7 @@ export default class MarkdownPreview extends React.Component {
568
570
prevProps . lineThroughCheckbox !== this . props . lineThroughCheckbox
569
571
) {
570
572
this . initMarkdown ( )
571
- this . rewriteIframe ( )
573
+ needsRewriteIframe = true
572
574
}
573
575
if (
574
576
prevProps . fontFamily !== this . props . fontFamily ||
@@ -583,6 +585,10 @@ export default class MarkdownPreview extends React.Component {
583
585
prevProps . customCSS !== this . props . customCSS
584
586
) {
585
587
this . applyStyle ( )
588
+ needsRewriteIframe = true
589
+ }
590
+
591
+ if ( needsRewriteIframe ) {
586
592
this . rewriteIframe ( )
587
593
}
588
594
}
You can’t perform that action at this time.
0 commit comments