How to use the react-diff-view.expandFromRawCode function in react-diff-view

To help you get started, we’ve selected a few react-diff-view examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github otakustay / react-diff-view / demo / selectors / index.js View on Github external
(canExpand, hunks) => {
        if (canExpand) {
            // Expand a normal section to demostrate util function
            return expandCollapsedBlockBy(
                expandFromRawCode(hunks, rawCode, 18, 22),
                rawCode,
                lines => lines <= 10
            );
        }

        return hunks;
    }
);
github otakustay / react-diff-view / demo / components / File / index.js View on Github external
loadCollapsedCode(start, end) {
        const {hunks} = this.state;
        const hunksWithoutStub = last(hunks).content === 'STUB' ? hunks.slice(0, -1) : hunks;
        const newHunks = expandFromRawCode(hunksWithoutStub, rawCodeLines, start, end);
        this.setState({hunks: newHunks});
    }