add example
This commit is contained in:
parent
e2b70660df
commit
6975f098f7
3 changed files with 6 additions and 0 deletions
|
|
@ -376,6 +376,7 @@ The HTML output accepts a Javascript object with configuration. Possible options
|
|||
`false`
|
||||
- `matchingMaxComparisons`: perform at most this much comparisons for line matching a block of changes, default is
|
||||
`2500`
|
||||
- `ignoreWhiteSpaces`: ignore line with only repeated white spacings (Only in Side by side View).
|
||||
- `maxLineSizeInBlockForComparison`: maximum number os characters of the bigger line in a block to apply comparison,
|
||||
default is `200`
|
||||
- `compiledTemplates`: object ([Hogan.js](https://github.com/twitter/hogan.js/) template values) with previously
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ export interface RenderConfig {
|
|||
matchWordsThreshold?: number;
|
||||
maxLineLengthHighlight?: number;
|
||||
diffStyle?: DiffStyleType;
|
||||
ignoreWhiteSpaces?: boolean;
|
||||
}
|
||||
|
||||
export const defaultRenderConfig = {
|
||||
|
|
@ -44,6 +45,7 @@ export const defaultRenderConfig = {
|
|||
matchWordsThreshold: 0.25,
|
||||
maxLineLengthHighlight: 10000,
|
||||
diffStyle: DiffStyleType.WORD,
|
||||
ignoreWhiteSpaces: false,
|
||||
};
|
||||
|
||||
const separator = '/';
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ type Elements = {
|
|||
};
|
||||
checkboxes: {
|
||||
drawFileList: HTMLInputElement;
|
||||
ignoreWhiteSpaces: HTMLInputElement;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -265,6 +266,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
},
|
||||
checkboxes: {
|
||||
drawFileList: getHTMLInputElementById('diff-url-options-show-files'),
|
||||
ignoreWhiteSpaces: getHTMLInputElementById('diff-url-options-ignore-w-spaces'),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -277,6 +279,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
config.matchWordsThreshold && (elements.options.wordsThreshold.value = config.matchWordsThreshold.toString());
|
||||
config.matchingMaxComparisons &&
|
||||
(elements.options.matchingMaxComparisons.value = config.matchingMaxComparisons.toString());
|
||||
config.ignoreWhiteSpaces && (elements.checkboxes.ignoreWhiteSpaces.checked = config.ignoreWhiteSpaces);
|
||||
|
||||
Object.entries(elements.options).forEach(([option, element]) =>
|
||||
element.addEventListener('change', () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue