Skip to content

Commit

Permalink
fix(tooltip): don't sanitize empty text, fixes empty tooltip being sh…
Browse files Browse the repository at this point in the history
…own (#1495)
  • Loading branch information
ghiscoding committed May 1, 2024
1 parent 4c63bcd commit dcc693b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/common/src/services/domUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,12 @@ export function buildMsSelectCollectionList(type: 'editor' | 'filter', collectio
*/
export function sanitizeTextByAvailableSanitizer(gridOptions: GridOption, dirtyHtml: string, sanitizerOptions?: DOMPurify.Config): string {
let sanitizedText = dirtyHtml;
if (typeof gridOptions?.sanitizer === 'function') {
sanitizedText = gridOptions.sanitizer(dirtyHtml || '');
} else if (typeof DOMPurify?.sanitize === 'function') {
sanitizedText = (DOMPurify.sanitize(dirtyHtml || '', sanitizerOptions || { ADD_ATTR: ['level'], RETURN_TRUSTED_TYPE: true }) || '') as string;
if (dirtyHtml) {
if (typeof gridOptions?.sanitizer === 'function') {
sanitizedText = gridOptions.sanitizer(dirtyHtml || '');
} else if (typeof DOMPurify?.sanitize === 'function') {
sanitizedText = (DOMPurify.sanitize(dirtyHtml || '', sanitizerOptions || { ADD_ATTR: ['level'], RETURN_TRUSTED_TYPE: true }) || '') as string;
}
}

return sanitizedText;
Expand Down

0 comments on commit dcc693b

Please sign in to comment.