OptionalaiOptionalbaseOptionalbaseoptional
This allows you to overwrite the auto-detected URL for all NutrientViewer assets. This setting is necessary when you load Text Comparison UI for Web JavaScript from a different URL.
If your assets are served from a different origin, you have to include proper CORS headers: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
Optionalcomparisonoptional
Configuration for the comparison sidebar, including color customization for highlighting differences and whether the sidebar opens by default.
required
Selector or element where Text Comparison UI for Web will be mounted.
The element must have a width and height that's greater than zero. Text Comparison UI for Web adapts to the dimensions
of this element. This way, applying responsive rules will work as expected.
The element can be styled using relative values as you would expect it to (CSS media queries are encouraged).
// In your HTML
<div class="foo"></div>
// In your JavaScript
NutrientViewer.loadTextComparison({ container: '.foo', documentA: ..., documentB: ..., ... });
// or
const element = document.getElementsByClassName('foo')[0]
NutrientViewer.loadTextComparison({ container: element, documentA: ..., documentB: ..., ... });
Standalonedocumentrequired, Standalone only
The URL for the base document or its content as ArrayBuffer used for comparison.
When providing a URL keep in mind that Cross-Origin Resource Sharing (CORS) apply.
Standalonedocumentrequired, Standalone only
The URL for the second document or its content as ArrayBuffer used for comparison.
When providing a URL keep in mind that Cross-Origin Resource Sharing (CORS) apply.
Optionalinneroptional
This property allows you to set an initial list of inner toolbar items for instanceA (left) and instanceB (right) for the Text Comparison UI. This can be used to customize the inner toolbar before the application mounts.
When omitted, it will default to NutrientViewer.defaultTextComparisonInnerToolbarItems.
const innerToolbarItems = NutrientViewer.defaultTextComparisonInnerToolbarItems;
innerToolbarItems.reverse();
NutrientViewer.loadTextComparison({ innerToolbarItems: toolbarItems, ... });
Default NutrientViewer.defaultTextComparisonInnerToolbarItems
Optional StandalonelicenseStandalone only
Nutrient Web SDK license key from https://my.nutrient.io/.
If not provided, the Text Comparison UI will run in trial mode for a limited time and then request the user to visit https://www.nutrient.io/try/ to request a trial license.
OptionallocaleThe initial locale (language) for the application.
All the available locales are defined in NutrientViewer.I18n.locales.
When a locale is not provided Text Comparison UI for Web tries to autodetect the locale using window.navigator.language.
If the detected locale is not supported then the en locale is used instead.
Optionalserveroptional
This allows you to overwrite the auto-detected Text Comparison UI Document Engine URL. This setting is necessary when your Text Comparison UI Document Engine is located under a different URL.
Optionalstyleoptional
This will load your custom CSS as a <link rel="stylesheet"> inside the Text Comparison UI. This
is necessary to isolate styling of the primary toolbar, comparison sidebar from the outside application and avoid external
stylesheets overwriting important viewer attributes.
An array is allowed to load multiple stylesheets. The order in the array will also be the order in which the stylesheets get loaded.
The array will be copied by us on start up time, which means that you can not mutate it after the viewer has started.
More information on how to style Nutrient Web SDK can be found in our guides.
Optionalthemeoptional
This property allows you to set theme to use for the UI. See NutrientViewer.Theme
Note: Themes are not supported in IE and setting this option won't have any effect: IE users will get the default light theme. You can customize the appearance of the UI using our public CSS classes. Please refer to guide article for information on how to customize the appearance.
Optionaltoolbaroptional
This property allows you to set an initial list of main toolbar items for the Text Comparison UI. This can be used to customize the main toolbar before the application mounts.
When omitted, it will default to NutrientViewer.defaultTextComparisonToolbarItems.
Optionalword
optional
This allows you to overwrite the auto-detected URL for the Core worker Text Comparison UI assets in Standalone mode. This setting may be necessary when you integrate TextComparison UI for Web JavaScript in an environment that limits the size of the static assets, like Salesforce.
If your Core assets are served from a different origin, you have to include proper CORS headers: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
and
nutrient-viewer-[hash].wasm) must be located in anutrient-viewer-libsubfolder accessible from thebaseCoreUrl.