mirror of
https://github.com/codex-team/editor.js
synced 2024-05-03 07:03:47 +02:00
3272efc3f7
* update eslint + autofix * a bunch of eslint fixes * some spelling & eslint fixes * fix some eslint errors and spells * Update __module.ts * a bunch of eslint fixes in tests * Update cypress.yml * Update cypress.yml * fix cypress docker image name * fixes for tests * more tests fixed * rm rule ignore * rm another ignored rule * Update .eslintrc
33 lines
881 B
TypeScript
33 lines
881 B
TypeScript
import { Sanitizer as ISanitizer } from '../../../../types/api';
|
|
import { SanitizerConfig } from '../../../../types/configs';
|
|
import Module from '../../__module';
|
|
import { clean } from '../../utils/sanitizer';
|
|
|
|
/**
|
|
* @class SanitizerAPI
|
|
* Provides Editor.js Sanitizer that allows developers to clean their HTML
|
|
*/
|
|
export default class SanitizerAPI extends Module {
|
|
/**
|
|
* Available methods
|
|
*
|
|
* @returns {SanitizerConfig}
|
|
*/
|
|
public get methods(): ISanitizer {
|
|
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 clean(taintString, config);
|
|
}
|
|
}
|