mirror of
https://github.com/codex-team/editor.js
synced 2024-06-07 08:22:16 +02:00
b223d63c59
This reverts commit 78775703c9
.
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);
|
|
}
|
|
}
|