Your IP : 13.59.195.78


Current Path : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/ui/bbcode/encoder/src/
Upload File :
Current File : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/ui/bbcode/encoder/src/encoder.js

export class BBCodeEncoder
{
	encodeText(source: string): string
	{
		return String(source)
			.replaceAll('&', '&')
			.replaceAll('[', '[')
			.replaceAll(']', ']')
			.replaceAll('\'', ''')
			.replaceAll('"', '"')
			.replaceAll('<', '&lt;')
			.replaceAll('>', '&gt;');
	}

	decodeText(source: string): string
	{
		return String(source)
			.replaceAll('&#91;', '[')
			.replaceAll('&#93;', ']')
			.replaceAll('&#39;', '\'')
			.replaceAll('&quot;', '"')
			.replaceAll('&lt;', '<')
			.replaceAll('&gt;', '>')
			.replaceAll('&amp;', '&');
	}

	encodeAttribute(source: string): string
	{
		return this.encodeText(source);
	}

	decodeAttribute(source: string): string
	{
		return this.decodeText(source);
	}
}