This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IFrame extends PureComponent { | |
constructor(props) { | |
super(props); | |
this.iframeElement = React.createRef(); | |
this.handleLoad = this.handleLoad.bind(this); | |
} | |
handleLoad() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IFrame extends PureComponent { | |
// ... | |
bindEventsToAnchorsInIFrame(iframeElement) { | |
const { history, location } = this.props; | |
const { contentDocument, contentWindow } = iframeElement; | |
const { jQuery } = contentWindow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IFrame extends PureComponent { | |
// ... | |
bindEventsToAnchorsInIFrame(iframeElement) { | |
const { history, location } = this.props; | |
const { contentDocument, contentWindow } = iframeElement; | |
const { jQuery } = contentWindow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IFrame extends PureComponent { | |
// ... | |
setTitle(iframeElement) { | |
const { contentDocument } = iframeElement; | |
document.title = contentDocument.title; | |
} | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IFrame extends PureComponent { | |
constructor(props) { | |
super(props); | |
this.iframeElement = React.createRef(); | |
this.state = { | |
location: props.location, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IFrame extends PureComponent { | |
// ... | |
getSnapshotBeforeUpdate(prevProps, prevState) { | |
const snapshot = { | |
hash: false, | |
redirect: false, | |
}; | |
const { location: prevLocation } = prevProps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IFrame extends PureComponent { | |
// ... | |
bindEventsToFormsInIframe(iframeElement) { | |
const { contentDocument, contentWindow } = iframeElement; | |
jQuery(contentDocument).on('submit', '#account-form', () => { | |
jQuery(contentWindow).on('unload', () => { | |
// Dispatch redux action responsible for fetching and updating the account | |
dispatch({ type: 'FETCH_ACCOUNT' }); |