diff --git a/docs/APIs.md b/docs/APIs.md index 2fbda8ba..1bb21f35 100644 --- a/docs/APIs.md +++ b/docs/APIs.md @@ -64,7 +64,8 @@ var view = new vega.View(runtime) | `disableDefaultStyle` | Boolean | Disable the default style completely. | | `sanitize` | Function | Function to convert value to string, and sanitize the HTML. | | `maxDepth` | Number | The maximum recursion depth when printing objects in the tooltip. | -| `formatTooltip` | Function | Function to specify custom HTML inside tooltip element. It is highly recommended to `sanitize` any data from `value` before returning an HTML string. | +| `formatTooltip` | Function | Function to specify custom HTML inside tooltip element. It is highly recommended to `sanitize` any data from `value` before returning an HTML string. | +| `baseURL` | String | The base URL to use for resolving relative URLs for images. | The default values are: @@ -79,7 +80,8 @@ var DEFAULT_OPTIONS = theme: 'light', disableDefaultStyle: false, sanitize: (value) => String(value).replace(/&/g, '&').replace(/; diff --git a/src/formatValue.ts b/src/formatValue.ts index 97d85629..b7346a41 100644 --- a/src/formatValue.ts +++ b/src/formatValue.ts @@ -6,7 +6,12 @@ import {isArray, isObject, isString} from 'vega-util'; * @param value The value to show in the tooltip. * @param valueToHtml Function to convert a single cell value to an HTML string */ -export function formatValue(value: any, valueToHtml: (value: any) => string, maxDepth: number): string { +export function formatValue( + value: any, + valueToHtml: (value: any) => string, + maxDepth: number, + baseURL: string, +): string { if (isArray(value)) { return `[${value.map((v) => valueToHtml(isString(v) ? v : stringify(v, maxDepth))).join(', ')}]`; } @@ -21,7 +26,7 @@ export function formatValue(value: any, valueToHtml: (value: any) => string, max } if (image) { - content += ``; + content += ``; } const keys = Object.keys(rest);