import angular, { sanitize } from 'angular' import { Inject, Injectable } from '../decorators' // text editor requires sanitization but also needs to allow for style attributes which are removed by default angular.module('app').config(['$sanitizeProvider', ($sanitizeProvider: ng.sanitize.ISanitizeProvider) => { $sanitizeProvider.addValidAttrs(['style']) // Quill uses data-list to distinguish bulleted lists from numbered lists (they are both provided as
    ) $sanitizeProvider.addValidAttrs(['data-list']) // Allow target attribute on anchor tags $sanitizeProvider.addValidAttrs(['target']) }]) @Injectable('richTextService') export default class RichTextService { constructor( @Inject('$sanitize') private $sanitize: sanitize.ISanitizeService, ) { } /** Older versions of Quill rendered some things differently. Patch those up. */ backwardsCompatibleHtml(html: string): string { html = this.removeZeroWidthNoBreakSpaces(html) html = this.removeCursor(html) html = this.fixWrappingCursor(html) html = this.fixFontTags(html) html = this.fixBulletPoints(html) html = this.fixStrongBold(html) return html } /** * Transform