<commit_before>import React, { Component } from 'react';

/**
 * Will inject the following functions as properties into the component which is using this.
 *
 *  * scrollBottom
 *  * scrollToAnchorTimeOut
 *  * scrollToAnchor
 *
 *  Sample usage:
 * @example export default scrollHelper(LogConsole);
 *
 * @param ComposedComponent
 */
export const scrollHelper = ComposedComponent => class extends Component {
    // Find the modal view container and adopt the scrollTop to focus the end
    scrollBottom() {
        const nodes = document.getElementsByClassName('content');
        const element = nodes[0];
        if (element) {
            element.scrollTop = element.scrollHeight - element.clientHeight;
        }
    }

    // This will scroll to the hash that is selected in the window.location
    // We assume an element having the id
    scrollToAnchor() {
        const anchorName = window.location.hash;
        if (anchorName) {
            const anchorElement = document.getElementById(anchorName.replace('#', ''));
            if (anchorElement) {
                anchorElement.scrollIntoView();
            }
        }
    }

    render() {
        // React needs the timeout to have the dom ready
        const scrollToAnchorTimeOut = (timeout = 1) => setTimeout(() => this.scrollToAnchor(), timeout);
        // create a composedComponent and inject the functions we want to expose
        return (<ComposedComponent
          {...this.props}
          {...this.state}
          scrollBottom={this.scrollBottom}
          scrollToAnchorTimeOut={scrollToAnchorTimeOut}
          scrollToAnchor={this.scrollToAnchor}
        />);
    }
};
<commit_msg>bug/JENKINS-41784-autoscroll * Fix auto-scroll regression (#795)<commit_after>import React, { Component } from 'react';

/**
 * Will inject the following functions as properties into the component which is using this.
 *
 *  * scrollBottom
 *  * scrollToAnchorTimeOut
 *  * scrollToAnchor
 *
 *  Sample usage:
 * @example export default scrollHelper(LogConsole);
 *
 * @param ComposedComponent
 */
export const scrollHelper = ComposedComponent => class extends Component {
    // Find the modal view container and adopt the scrollTop to focus the end
    scrollBottom() {
        const nodes = document.getElementsByClassName('FullScreen-contents');
        const element = nodes[0];
        if (element) {
            element.scrollTop = element.scrollHeight - element.clientHeight;
        }
    }

    // This will scroll to the hash that is selected in the window.location
    // We assume an element having the id
    scrollToAnchor() {
        const anchorName = window.location.hash;
        if (anchorName) {
            const anchorElement = document.getElementById(anchorName.replace('#', ''));
            if (anchorElement) {
                anchorElement.scrollIntoView();
            }
        }
    }

    render() {
        // React needs the timeout to have the dom ready
        const scrollToAnchorTimeOut = (timeout = 1) => setTimeout(() => this.scrollToAnchor(), timeout);
        // create a composedComponent and inject the functions we want to expose
        return (<ComposedComponent
          {...this.props}
          {...this.state}
          scrollBottom={this.scrollBottom}
          scrollToAnchorTimeOut={scrollToAnchorTimeOut}
          scrollToAnchor={this.scrollToAnchor}
        />);
    }
};

{'fraction_non_alphanumeric': 0.0968501619075655, 'fraction_numerical': 0.003532528701795702, 'mean_word_length': 2.513960703205791, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '934781', 'n_tokens_mistral': 858, 'n_tokens_neox': 842, 'n_words': 260}