mirror of
https://github.com/codex-team/editor.js
synced 2024-05-06 16:36:47 +02:00
63eeec0f3b
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com> Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com> Co-authored-by: tasuku-s <tasuku@freemind.co.jp> Co-authored-by: Athul Anil Kumar <athul7744@outlook.com> Co-authored-by: Taly <vitalik7tv@yandex.ru> Co-authored-by: flaming-cl <51183663+flaming-cl@users.noreply.github.com> Co-authored-by: Nguyen Ngoc Son <sonnn.se@gmail.com> Co-authored-by: Sisir Das K <37764463+sis-dk@users.noreply.github.com> Co-authored-by: Sisir <sisir@hellosivi.com>
33 lines
840 B
TypeScript
33 lines
840 B
TypeScript
import Module from '../../__module';
|
|
import { Sanitizer } from '../../../../types/api';
|
|
import { SanitizerConfig } from '../../../../types/configs';
|
|
|
|
/**
|
|
* @class SanitizerAPI
|
|
* Provides Editor.js Sanitizer that allows developers to clean their HTML
|
|
*/
|
|
export default class SanitizerAPI extends Module {
|
|
/**
|
|
* Available methods
|
|
*
|
|
* @returns {Sanitizer}
|
|
*/
|
|
public get methods(): Sanitizer {
|
|
return {
|
|
clean: (taintString, config): string => this.clean(taintString, config),
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Perform sanitizing of a string
|
|
*
|
|
* @param {string} taintString - what to sanitize
|
|
* @param {SanitizerConfig} config - sanitizer config
|
|
*
|
|
* @returns {string}
|
|
*/
|
|
public clean(taintString: string, config: SanitizerConfig): string {
|
|
return this.Editor.Sanitizer.clean(taintString, config);
|
|
}
|
|
}
|