in frontend/src/common/components/hocr/hocr-document/hocr-document.component.tsx [113:140]
public componentWillReceiveProps(nextProps: HocrDocumentProps) {
if( this.props.hocr !== nextProps.hocr) {
this.setState({
...this.state,
docBody: getDocumentBody(nextProps.hocr)
})
} else if (
this.props.targetWords !== nextProps.targetWords ||
this.props.caseSensitiveComparison !== nextProps.caseSensitiveComparison
) {
this.setState({
...this.state,
wordCompare: CreateWordComparator(nextProps.targetWords, nextProps.caseSensitiveComparison),
});
} else if ( this.props.userStyle != nextProps.userStyle ) {
this.setState({
...this.state,
safeStyle: injectDefaultDocumentStyle(nextProps.userStyle),
});
}
if (this.props.autoFocusId !== nextProps.autoFocusId) {
this.autoFocusToNode(nextProps.autoFocusId);
}
if (this.props.hightlightPageIndex !== nextProps.hightlightPageIndex) {
this.hightlightPage(nextProps.hightlightPageIndex);
}
}