diff --git a/src/components/change-view.jsx b/src/components/change-view.jsx index a36671d5..c1ca0133 100644 --- a/src/components/change-view.jsx +++ b/src/components/change-view.jsx @@ -66,6 +66,7 @@ export default class ChangeView extends React.Component { collapsedView: true, diffSettings: { removeFormatting: false, + useWaybackResources: true, }, diffType: undefined, updating: false, diff --git a/src/components/diff-settings-form.jsx b/src/components/diff-settings-form.jsx index 28cbc8c2..5b77efaa 100644 --- a/src/components/diff-settings-form.jsx +++ b/src/components/diff-settings-form.jsx @@ -3,6 +3,9 @@ import React from 'react'; // Diff types that we can remove formatting from const typesWithFormatting = ['SIDE_BY_SIDE_RENDERED', 'HIGHLIGHTED_RENDERED']; +// Shallow-merge multiple objects +const mergeObjects = (...objects) => Object.assign({}, ...objects); + /** * @typedef DiffSettingsFormProps * @property {string} diffType The current diff type to render controls for @@ -20,7 +23,7 @@ export default class DiffSettingsForm extends React.PureComponent { constructor (props) { super(props); - this._handleRemoveFormattingChange = this._handleRemoveFormattingChange.bind(this); + this._handleCheckboxChange = this._handleCheckboxChange.bind(this); } render () { @@ -29,21 +32,36 @@ export default class DiffSettingsForm extends React.PureComponent { } return ( - +
); } - _handleRemoveFormattingChange (event) { - this.props.onChange({ - removeFormatting: event.target.checked - }); + _handleCheckboxChange (event) { + const field = event.target.name; + this.props.onChange(mergeObjects(this.props.settings, { + [field]: event.target.checked + })); } } diff --git a/src/components/diff-view.jsx b/src/components/diff-view.jsx index 64176751..566a6e8b 100644 --- a/src/components/diff-view.jsx +++ b/src/components/diff-view.jsx @@ -117,13 +117,19 @@ export default class DiffView extends React.Component { } renderDiff () { + const commonProps = { + page: this.props.page, + a: this.props.a, + b: this.props.b, + diffData: this.state.diffData + }; // TODO: if we have multiple ways to render content from a single service // in the future (e.g. inline vs. side-by-side text), we need a better // way to ensure we use the correct rendering and avoid race conditions switch (this.props.diffType) { case diffTypes.RAW_SIDE_BY_SIDE.value: return ( -