Files
cloudbeaver/webapp/packages/core-utils/src/toSafeHtmlString.ts
T
9934ed9787 CB-4743 adds html sanitizer (#2420)
* CB-4743 adds html sanitizer

* CB-4743 adds license to sanitizeHtml

* CB-4743 do not use sanitize to purify the json line data

* CB-4743 fix: toSafeHtmlString test correct cases

---------

Co-authored-by: s.teleshev <s.teleshev@mu.se>
Co-authored-by: mr-anton-t <42037741+mr-anton-t@users.noreply.github.com>
2024-03-05 22:14:35 +03:00

15 lines
406 B
TypeScript

/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
export function toSafeHtmlString(dirty: string): string {
const el = document.createElement('div');
el.innerText = el.textContent = dirty;
dirty = el.innerHTML;
return dirty;
}