UNPKG

ngx-quill

Version:

Angular components for the easy use of the QuillJS richt text editor.

1 lines 73.2 kB
{"version":3,"file":"ngx-quill.mjs","sources":["../../../projects/ngx-quill/src/lib/helpers.ts","../../../projects/ngx-quill/src/lib/quill.service.ts","../../../projects/ngx-quill/src/lib/quill-editor.component.ts","../../../projects/ngx-quill/src/lib/quill-view-html.component.ts","../../../projects/ngx-quill/src/lib/quill-view.component.ts","../../../projects/ngx-quill/src/lib/quill.module.ts","../../../projects/ngx-quill/src/public-api.ts","../../../projects/ngx-quill/src/ngx-quill.ts"],"sourcesContent":["import { QuillFormat } from 'ngx-quill/config'\n\nexport const getFormat = (format?: QuillFormat, configFormat?: QuillFormat): QuillFormat => {\n const passedFormat = format || configFormat\n return passedFormat || 'html'\n}\n","import { DOCUMENT } from '@angular/common'\nimport { Injectable, Inject, Injector, Optional } from '@angular/core'\nimport { defer, firstValueFrom, isObservable, Observable } from 'rxjs'\nimport { shareReplay } from 'rxjs/operators'\n\nimport {\n defaultModules,\n QUILL_CONFIG_TOKEN,\n QuillConfig,\n CustomModule,\n} from 'ngx-quill/config'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class QuillService {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private Quill!: any\n private document: Document\n private quill$: Observable<any> = defer(async () => {\n if (!this.Quill) {\n // Quill adds events listeners on import https://github.com/quilljs/quill/blob/develop/core/emitter.js#L8\n // We'd want to use the unpatched `addEventListener` method to have all event callbacks to be run outside of zone.\n // We don't know yet if the `zone.js` is used or not, just save the value to restore it back further.\n const maybePatchedAddEventListener = this.document.addEventListener\n // There're 2 types of Angular applications:\n // 1) zone-full (by default)\n // 2) zone-less\n // The developer can avoid importing the `zone.js` package and tells Angular that he/she is responsible for running\n // the change detection by himself. This is done by \"nooping\" the zone through `CompilerOptions` when bootstrapping\n // the root module. We fallback to `document.addEventListener` if `__zone_symbol__addEventListener` is not defined,\n // this means the `zone.js` is not imported.\n // The `__zone_symbol__addEventListener` is basically a native DOM API, which is not patched by zone.js, thus not even going\n // through the `zone.js` task lifecycle. You can also access the native DOM API as follows `target[Zone.__symbol__('methodName')]`.\n this.document.addEventListener =\n // eslint-disable-next-line @typescript-eslint/dot-notation\n this.document['__zone_symbol__addEventListener'] ||\n this.document.addEventListener\n const quillImport = await import(/* webpackChunkName: 'quill' */ 'quill')\n this.document.addEventListener = maybePatchedAddEventListener\n\n this.Quill = (\n quillImport.default ? quillImport.default : quillImport\n ) as any\n }\n\n // Only register custom options and modules once\n this.config.customOptions?.forEach((customOption) => {\n const newCustomOption = this.Quill.import(customOption.import)\n newCustomOption.whitelist = customOption.whitelist\n this.Quill.register(\n newCustomOption,\n true,\n this.config.suppressGlobalRegisterWarning\n )\n })\n\n return await this.registerCustomModules(\n this.Quill,\n this.config.customModules,\n this.config.suppressGlobalRegisterWarning\n )\n }).pipe(shareReplay({ bufferSize: 1, refCount: true }))\n\n constructor(\n injector: Injector,\n @Optional() @Inject(QUILL_CONFIG_TOKEN) public config: QuillConfig\n ) {\n this.document = injector.get(DOCUMENT)\n\n if (!this.config) {\n this.config = { modules: defaultModules }\n }\n }\n\n getQuill() {\n return this.quill$\n }\n\n /**\n * Marked as internal so it won't be available for `ngx-quill` consumers, this is only\n * internal method to be used within the library.\n *\n * @internal\n */\n async registerCustomModules(\n Quill: any,\n customModules: CustomModule[] | undefined,\n suppressGlobalRegisterWarning?: boolean\n ): Promise<any> {\n if (Array.isArray(customModules)) {\n // eslint-disable-next-line prefer-const\n for (let { implementation, path } of customModules) {\n // The `implementation` might be an observable that resolves the actual implementation,\n // e.g. if it should be lazy loaded.\n if (isObservable(implementation)) {\n implementation = await firstValueFrom(implementation)\n }\n Quill.register(path, implementation, suppressGlobalRegisterWarning)\n }\n }\n\n // Return `Quill` constructor so we'll be able to re-use its return value except of using\n // `map` operators, etc.\n return Quill\n }\n}\n","import { DOCUMENT, isPlatformServer, CommonModule } from '@angular/common'\nimport { DomSanitizer } from '@angular/platform-browser'\n\nimport QuillType, { Delta } from 'quill'\n\nimport {\n AfterViewInit,\n ChangeDetectorRef,\n Component,\n Directive,\n ElementRef,\n EventEmitter,\n forwardRef,\n inject,\n Input,\n NgZone,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n PLATFORM_ID,\n Renderer2,\n SecurityContext,\n SimpleChanges,\n ViewEncapsulation\n} from '@angular/core'\nimport { fromEvent, Subscription } from 'rxjs'\nimport { debounceTime, mergeMap } from 'rxjs/operators'\n\nimport { ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, Validator } from '@angular/forms'\n\nimport { defaultModules, QuillModules, CustomOption, CustomModule } from 'ngx-quill/config'\n\nimport { getFormat } from './helpers'\nimport { QuillService } from './quill.service'\n\nexport interface Range {\n index: number\n length: number\n}\n\nexport interface ContentChange {\n content: any\n delta: Delta\n editor: QuillType\n html: string | null\n oldDelta: Delta\n source: string\n text: string\n}\n\nexport interface SelectionChange {\n editor: QuillType\n oldRange: Range | null\n range: Range | null\n source: string\n}\n\nexport interface Blur {\n editor: QuillType\n source: string\n}\n\nexport interface Focus {\n editor: QuillType\n source: string\n}\n\nexport type EditorChangeContent = ContentChange & { event: 'text-change' }\nexport type EditorChangeSelection = SelectionChange & { event: 'selection-change' }\n\n@Directive()\n// eslint-disable-next-line @angular-eslint/directive-class-suffix\nexport abstract class QuillEditorBase implements AfterViewInit, ControlValueAccessor, OnChanges, OnInit, OnDestroy, Validator {\n @Input() format?: 'object' | 'html' | 'text' | 'json'\n @Input() theme?: string\n @Input() modules?: QuillModules\n @Input() debug?: 'warn' | 'log' | 'error' | false\n @Input() readOnly?: boolean\n @Input() placeholder?: string\n @Input() maxLength?: number\n @Input() minLength?: number\n @Input() required = false\n @Input() formats?: string[] | null\n @Input() customToolbarPosition: 'top' | 'bottom' = 'top'\n @Input() sanitize?: boolean\n @Input() beforeRender?: () => Promise<void>\n @Input() styles: any = null\n @Input() strict = true\n @Input() scrollingContainer?: HTMLElement | string | null\n @Input() bounds?: HTMLElement | string\n @Input() customOptions: CustomOption[] = []\n @Input() customModules: CustomModule[] = []\n @Input() trackChanges?: 'user' | 'all'\n @Input() preserveWhitespace = false\n @Input() classes?: string\n @Input() trimOnValidation = false\n @Input() linkPlaceholder?: string\n @Input() compareValues = false\n @Input() filterNull = false\n @Input() debounceTime?: number\n /*\n https://github.com/KillerCodeMonkey/ngx-quill/issues/1257 - fix null value set\n\n provide default empty value\n by default null\n\n e.g. defaultEmptyValue=\"\" - empty string\n\n <quill-editor\n defaultEmptyValue=\"\"\n formControlName=\"message\"\n ></quill-editor>\n */\n @Input() defaultEmptyValue?: any = null\n\n @Output() onEditorCreated: EventEmitter<any> = new EventEmitter()\n @Output() onEditorChanged: EventEmitter<EditorChangeContent | EditorChangeSelection> = new EventEmitter()\n @Output() onContentChanged: EventEmitter<ContentChange> = new EventEmitter()\n @Output() onSelectionChanged: EventEmitter<SelectionChange> = new EventEmitter()\n @Output() onFocus: EventEmitter<Focus> = new EventEmitter()\n @Output() onBlur: EventEmitter<Blur> = new EventEmitter()\n @Output() onNativeFocus: EventEmitter<Focus> = new EventEmitter()\n @Output() onNativeBlur: EventEmitter<Blur> = new EventEmitter()\n\n quillEditor!: QuillType\n editorElem!: HTMLElement\n content: any\n disabled = false // used to store initial value before ViewInit\n preserve = false\n toolbarPosition = 'top'\n\n onModelChange: (modelValue?: any) => void\n onModelTouched: () => void\n onValidatorChanged: () => void\n\n private subscription: Subscription | null = null\n private quillSubscription: Subscription | null = null\n\n private elementRef = inject(ElementRef)\n private document = inject(DOCUMENT)\n\n private cd = inject(ChangeDetectorRef)\n private domSanitizer = inject(DomSanitizer)\n private platformId = inject<string>(PLATFORM_ID)\n private renderer = inject(Renderer2)\n private zone = inject(NgZone)\n private service = inject(QuillService)\n\n static normalizeClassNames(classes: string): string[] {\n const classList = classes.trim().split(' ')\n return classList.reduce((prev: string[], cur: string) => {\n const trimmed = cur.trim()\n if (trimmed) {\n prev.push(trimmed)\n }\n\n return prev\n }, [])\n }\n\n @Input()\n valueGetter = (quillEditor: QuillType, editorElement: HTMLElement): string | any => {\n let html: string | null = editorElement.querySelector('.ql-editor')!.innerHTML\n if (html === '<p><br></p>' || html === '<div><br></div>') {\n html = this.defaultEmptyValue\n }\n let modelValue: string | Delta | null = html\n const format = getFormat(this.format, this.service.config.format)\n\n if (format === 'text') {\n modelValue = quillEditor.getText()\n } else if (format === 'object') {\n modelValue = quillEditor.getContents()\n } else if (format === 'json') {\n try {\n modelValue = JSON.stringify(quillEditor.getContents())\n } catch (e) {\n modelValue = quillEditor.getText()\n }\n }\n\n return modelValue\n }\n\n @Input()\n valueSetter = (quillEditor: QuillType, value: any): any => {\n const format = getFormat(this.format, this.service.config.format)\n if (format === 'html') {\n const sanitize = [true, false].includes(this.sanitize) ? this.sanitize : (this.service.config.sanitize || false)\n if (sanitize) {\n value = this.domSanitizer.sanitize(SecurityContext.HTML, value)\n }\n return quillEditor.clipboard.convert(value)\n } else if (format === 'json') {\n try {\n return JSON.parse(value)\n } catch (e) {\n return [{ insert: value }]\n }\n }\n\n return value\n }\n\n ngOnInit() {\n this.preserve = this.preserveWhitespace\n this.toolbarPosition = this.customToolbarPosition\n }\n\n ngAfterViewInit() {\n if (isPlatformServer(this.platformId)) {\n return\n }\n\n // The `quill-editor` component might be destroyed before the `quill` chunk is loaded and its code is executed\n // this will lead to runtime exceptions, since the code will be executed on DOM nodes that don't exist within the tree.\n\n this.quillSubscription = this.service.getQuill().pipe(\n mergeMap((Quill) => {\n const promises = [this.service.registerCustomModules(Quill, this.customModules)]\n const beforeRender = this.beforeRender ?? this.service.config.beforeRender\n if (beforeRender) {\n promises.push(beforeRender())\n }\n return Promise.all(promises).then(() => Quill)\n })\n ).subscribe(Quill => {\n this.editorElem = this.elementRef.nativeElement.querySelector(\n '[quill-editor-element]'\n )\n\n const toolbarElem = this.elementRef.nativeElement.querySelector(\n '[quill-editor-toolbar]'\n )\n const modules = Object.assign({}, this.modules || this.service.config.modules)\n\n if (toolbarElem) {\n modules.toolbar = toolbarElem\n } else if (modules.toolbar === undefined) {\n modules.toolbar = defaultModules.toolbar\n }\n\n let placeholder = this.placeholder !== undefined ? this.placeholder : this.service.config.placeholder\n if (placeholder === undefined) {\n placeholder = 'Insert text here ...'\n }\n\n if (this.styles) {\n Object.keys(this.styles).forEach((key: string) => {\n this.renderer.setStyle(this.editorElem, key, this.styles[key])\n })\n }\n\n if (this.classes) {\n this.addClasses(this.classes)\n }\n\n this.customOptions.forEach((customOption) => {\n const newCustomOption = Quill.import(customOption.import)\n newCustomOption.whitelist = customOption.whitelist\n Quill.register(newCustomOption, true)\n })\n\n let bounds = this.bounds && this.bounds === 'self' ? this.editorElem : this.bounds\n if (!bounds) {\n bounds = this.service.config.bounds ? this.service.config.bounds : this.document.body\n }\n\n let debug = this.debug\n if (!debug && debug !== false && this.service.config.debug) {\n debug = this.service.config.debug\n }\n\n let readOnly = this.readOnly\n if (!readOnly && this.readOnly !== false) {\n readOnly = this.service.config.readOnly !== undefined ? this.service.config.readOnly : false\n }\n\n let defaultEmptyValue = this.defaultEmptyValue\n // eslint-disable-next-line no-prototype-builtins\n if (this.service.config.hasOwnProperty('defaultEmptyValue')) {\n defaultEmptyValue = this.service.config.defaultEmptyValue\n }\n\n let scrollingContainer = this.scrollingContainer\n if (!scrollingContainer && this.scrollingContainer !== null) {\n scrollingContainer =\n this.service.config.scrollingContainer === null\n || this.service.config.scrollingContainer ? this.service.config.scrollingContainer : null\n }\n\n let formats = this.formats\n if (!formats && formats === undefined) {\n formats = this.service.config.formats ? [...this.service.config.formats] : (this.service.config.formats === null ? null : undefined)\n }\n\n this.zone.runOutsideAngular(() => {\n this.quillEditor = new Quill(this.editorElem, {\n bounds,\n debug: debug as any,\n formats: formats as any,\n modules,\n placeholder,\n readOnly,\n defaultEmptyValue,\n scrollingContainer: scrollingContainer as any,\n strict: this.strict,\n theme: this.theme || (this.service.config.theme ? this.service.config.theme : 'snow')\n })\n\n if (this.onNativeBlur.observed) {\n // https://github.com/quilljs/quill/issues/2186#issuecomment-533401328\n this.quillEditor.scroll.domNode.addEventListener('blur', () => this.onNativeBlur.next({\n editor: this.quillEditor,\n source: 'dom'\n }))\n // https://github.com/quilljs/quill/issues/2186#issuecomment-803257538\n this.quillEditor.getModule('toolbar').container.addEventListener('mousedown', (e) => e.preventDefault())\n }\n\n if (this.onNativeFocus.observed) {\n this.quillEditor.scroll.domNode.addEventListener('focus', () => this.onNativeFocus.next({\n editor: this.quillEditor,\n source: 'dom'\n }))\n }\n\n // Set optional link placeholder, Quill has no native API for it so using workaround\n if (this.linkPlaceholder) {\n const tooltip = (this.quillEditor as any)?.theme?.tooltip\n const input = tooltip?.root?.querySelector('input[data-link]')\n if (input?.dataset) {\n input.dataset.link = this.linkPlaceholder\n }\n }\n })\n\n if (this.content) {\n const format = getFormat(this.format, this.service.config.format)\n\n if (format === 'text') {\n this.quillEditor.setText(this.content, 'silent')\n } else {\n const newValue = this.valueSetter(this.quillEditor, this.content)\n this.quillEditor.setContents(newValue, 'silent')\n }\n\n this.quillEditor.getModule('history').clear()\n }\n\n // initialize disabled status based on this.disabled as default value\n this.setDisabledState()\n\n this.addQuillEventListeners()\n\n // The `requestAnimationFrame` triggers change detection. There's no sense to invoke the `requestAnimationFrame` if anyone is\n // listening to the `onEditorCreated` event inside the template, for instance `<quill-view (onEditorCreated)=\"...\">`.\n if (!this.onEditorCreated.observed && !this.onValidatorChanged) {\n return\n }\n\n // The `requestAnimationFrame` will trigger change detection and `onEditorCreated` will also call `markDirty()`\n // internally, since Angular wraps template event listeners into `listener` instruction. We're using the `requestAnimationFrame`\n // to prevent the frame drop and avoid `ExpressionChangedAfterItHasBeenCheckedError` error.\n requestAnimationFrame(() => {\n if (this.onValidatorChanged) {\n this.onValidatorChanged()\n }\n this.onEditorCreated.emit(this.quillEditor)\n this.onEditorCreated.complete()\n })\n })\n }\n\n selectionChangeHandler = (range: Range | null, oldRange: Range | null, source: string) => {\n const shouldTriggerOnModelTouched = !range && !!this.onModelTouched\n\n // only emit changes when there's any listener\n if (!this.onBlur.observed &&\n !this.onFocus.observed &&\n !this.onSelectionChanged.observed &&\n !shouldTriggerOnModelTouched) {\n return\n }\n\n this.zone.run(() => {\n if (range === null) {\n this.onBlur.emit({\n editor: this.quillEditor,\n source\n })\n } else if (oldRange === null) {\n this.onFocus.emit({\n editor: this.quillEditor,\n source\n })\n }\n\n this.onSelectionChanged.emit({\n editor: this.quillEditor,\n oldRange,\n range,\n source\n })\n\n if (shouldTriggerOnModelTouched) {\n this.onModelTouched()\n }\n\n this.cd.markForCheck()\n })\n }\n\n textChangeHandler = (delta: Delta, oldDelta: Delta, source: string): void => {\n // only emit changes emitted by user interactions\n const text = this.quillEditor.getText()\n const content = this.quillEditor.getContents()\n\n let html: string | null = this.editorElem!.querySelector('.ql-editor')!.innerHTML\n if (html === '<p><br></p>' || html === '<div><br></div>') {\n html = this.defaultEmptyValue\n }\n\n const trackChanges = this.trackChanges || this.service.config.trackChanges\n const shouldTriggerOnModelChange = (source === 'user' || trackChanges && trackChanges === 'all') && !!this.onModelChange\n\n // only emit changes when there's any listener\n if (!this.onContentChanged.observed && !shouldTriggerOnModelChange) {\n return\n }\n\n this.zone.run(() => {\n if (shouldTriggerOnModelChange) {\n this.onModelChange(\n this.valueGetter(this.quillEditor, this.editorElem!)\n )\n }\n\n this.onContentChanged.emit({\n content,\n delta,\n editor: this.quillEditor,\n html,\n oldDelta,\n source,\n text\n })\n\n this.cd.markForCheck()\n })\n }\n\n // eslint-disable-next-line max-len\n editorChangeHandler = (\n event: 'text-change' | 'selection-change',\n current: any | Range | null, old: any | Range | null, source: string\n ): void => {\n // only emit changes when there's any listener\n if (!this.onEditorChanged.observed) {\n return\n }\n\n // only emit changes emitted by user interactions\n if (event === 'text-change') {\n const text = this.quillEditor.getText()\n const content = this.quillEditor.getContents()\n\n let html: string | null = this.editorElem!.querySelector('.ql-editor')!.innerHTML\n if (html === '<p><br></p>' || html === '<div><br></div>') {\n html = this.defaultEmptyValue\n }\n\n this.zone.run(() => {\n this.onEditorChanged.emit({\n content,\n delta: current,\n editor: this.quillEditor,\n event,\n html,\n oldDelta: old,\n source,\n text\n })\n\n this.cd.markForCheck()\n })\n } else {\n this.zone.run(() => {\n this.onEditorChanged.emit({\n editor: this.quillEditor,\n event,\n oldRange: old,\n range: current,\n source\n })\n\n this.cd.markForCheck()\n })\n }\n }\n\n ngOnDestroy() {\n this.dispose()\n\n this.quillSubscription?.unsubscribe()\n this.quillSubscription = null\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.quillEditor) {\n return\n }\n /* eslint-disable @typescript-eslint/dot-notation */\n if (changes.readOnly) {\n this.quillEditor.enable(!changes.readOnly.currentValue)\n }\n if (changes.placeholder) {\n this.quillEditor.root.dataset.placeholder =\n changes.placeholder.currentValue\n }\n if (changes.defaultEmptyValue) {\n this.quillEditor.root.dataset.defaultEmptyValue =\n changes.defaultEmptyValue.currentValue\n }\n if (changes.styles) {\n const currentStyling = changes.styles.currentValue\n const previousStyling = changes.styles.previousValue\n\n if (previousStyling) {\n Object.keys(previousStyling).forEach((key: string) => {\n this.renderer.removeStyle(this.editorElem, key)\n })\n }\n if (currentStyling) {\n Object.keys(currentStyling).forEach((key: string) => {\n this.renderer.setStyle(this.editorElem, key, this.styles[key])\n })\n }\n }\n if (changes.classes) {\n const currentClasses = changes.classes.currentValue\n const previousClasses = changes.classes.previousValue\n\n if (previousClasses) {\n this.removeClasses(previousClasses)\n }\n\n if (currentClasses) {\n this.addClasses(currentClasses)\n }\n }\n // We'd want to re-apply event listeners if the `debounceTime` binding changes to apply the\n // `debounceTime` operator or vice-versa remove it.\n if (changes.debounceTime) {\n this.addQuillEventListeners()\n }\n /* eslint-enable @typescript-eslint/dot-notation */\n }\n\n addClasses(classList: string): void {\n QuillEditorBase.normalizeClassNames(classList).forEach((c: string) => {\n this.renderer.addClass(this.editorElem, c)\n })\n }\n\n removeClasses(classList: string): void {\n QuillEditorBase.normalizeClassNames(classList).forEach((c: string) => {\n this.renderer.removeClass(this.editorElem, c)\n })\n }\n\n writeValue(currentValue: any) {\n\n // optional fix for https://github.com/angular/angular/issues/14988\n if (this.filterNull && currentValue === null) {\n return\n }\n\n this.content = currentValue\n\n if (!this.quillEditor) {\n return\n }\n\n const format = getFormat(this.format, this.service.config.format)\n const newValue = this.valueSetter(this.quillEditor, currentValue)\n\n if (this.compareValues) {\n const currentEditorValue = this.quillEditor.getContents()\n if (JSON.stringify(currentEditorValue) === JSON.stringify(newValue)) {\n return\n }\n }\n\n if (currentValue) {\n if (format === 'text') {\n this.quillEditor.setText(currentValue)\n } else {\n this.quillEditor.setContents(newValue)\n }\n return\n }\n this.quillEditor.setText('')\n\n }\n\n setDisabledState(isDisabled: boolean = this.disabled): void {\n // store initial value to set appropriate disabled status after ViewInit\n this.disabled = isDisabled\n if (this.quillEditor) {\n if (isDisabled) {\n this.quillEditor.disable()\n this.renderer.setAttribute(this.elementRef.nativeElement, 'disabled', 'disabled')\n } else {\n if (!this.readOnly) {\n this.quillEditor.enable()\n }\n this.renderer.removeAttribute(this.elementRef.nativeElement, 'disabled')\n }\n }\n }\n\n registerOnChange(fn: (modelValue: any) => void): void {\n this.onModelChange = fn\n }\n\n registerOnTouched(fn: () => void): void {\n this.onModelTouched = fn\n }\n\n registerOnValidatorChange(fn: () => void) {\n this.onValidatorChanged = fn\n }\n\n validate() {\n if (!this.quillEditor) {\n return null\n }\n\n const err: {\n minLengthError?: {\n given: number\n minLength: number\n }\n maxLengthError?: {\n given: number\n maxLength: number\n }\n requiredError?: { empty: boolean }\n } = {}\n let valid = true\n\n const text = this.quillEditor.getText()\n // trim text if wanted + handle special case that an empty editor contains a new line\n const textLength = this.trimOnValidation ? text.trim().length : (text.length === 1 && text.trim().length === 0 ? 0 : text.length - 1)\n const deltaOperations = this.quillEditor.getContents().ops\n const onlyEmptyOperation = deltaOperations && deltaOperations.length === 1 && ['\\n', ''].includes(deltaOperations[0].insert)\n\n if (this.minLength && textLength && textLength < this.minLength) {\n err.minLengthError = {\n given: textLength,\n minLength: this.minLength\n }\n\n valid = false\n }\n\n if (this.maxLength && textLength > this.maxLength) {\n err.maxLengthError = {\n given: textLength,\n maxLength: this.maxLength\n }\n\n valid = false\n }\n\n if (this.required && !textLength && onlyEmptyOperation) {\n err.requiredError = {\n empty: true\n }\n\n valid = false\n }\n\n return valid ? null : err\n }\n\n private addQuillEventListeners(): void {\n this.dispose()\n\n // We have to enter the `<root>` zone when adding event listeners, so `debounceTime` will spawn the\n // `AsyncAction` there w/o triggering change detections. We still re-enter the Angular's zone through\n // `zone.run` when we emit an event to the parent component.\n this.zone.runOutsideAngular(() => {\n this.subscription = new Subscription()\n\n this.subscription.add(\n // mark model as touched if editor lost focus\n fromEvent(this.quillEditor, 'selection-change').subscribe(\n ([range, oldRange, source]) => {\n this.selectionChangeHandler(range as any, oldRange as any, source)\n }\n )\n )\n\n // The `fromEvent` supports passing JQuery-style event targets, the editor has `on` and `off` methods which\n // will be invoked upon subscription and teardown.\n let textChange$ = fromEvent(this.quillEditor, 'text-change')\n let editorChange$ = fromEvent(this.quillEditor, 'editor-change')\n\n if (typeof this.debounceTime === 'number') {\n textChange$ = textChange$.pipe(debounceTime(this.debounceTime))\n editorChange$ = editorChange$.pipe(debounceTime(this.debounceTime))\n }\n\n this.subscription.add(\n // update model if text changes\n textChange$.subscribe(([delta, oldDelta, source]) => {\n this.textChangeHandler(delta as any, oldDelta as any, source)\n })\n )\n\n this.subscription.add(\n // triggered if selection or text changed\n editorChange$.subscribe(([event, current, old, source]) => {\n this.editorChangeHandler(event as 'text-change' | 'selection-change', current, old, source)\n })\n )\n })\n }\n\n private dispose(): void {\n if (this.subscription !== null) {\n this.subscription.unsubscribe()\n this.subscription = null\n }\n }\n}\n\n@Component({\n encapsulation: ViewEncapsulation.Emulated,\n providers: [\n {\n multi: true,\n provide: NG_VALUE_ACCESSOR,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n useExisting: forwardRef(() => QuillEditorComponent)\n },\n {\n multi: true,\n provide: NG_VALIDATORS,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n useExisting: forwardRef(() => QuillEditorComponent)\n }\n ],\n selector: 'quill-editor',\n template: `\n <ng-template [ngIf]=\"toolbarPosition !== 'top'\">\n <pre quill-editor-element *ngIf=\"preserve; else noPreserveTpl\"></pre>\n </ng-template>\n <ng-content select=\"[quill-editor-toolbar]\"></ng-content>\n <ng-template [ngIf]=\"toolbarPosition === 'top'\">\n <pre quill-editor-element *ngIf=\"preserve; else noPreserveTpl\"></pre>\n </ng-template>\n <ng-template #noPreserveTpl>\n <div quill-editor-element></div>\n </ng-template>\n `,\n styles: [\n `\n :host {\n display: inline-block;\n }\n `\n ],\n standalone: true,\n imports: [CommonModule]\n})\nexport class QuillEditorComponent extends QuillEditorBase {}\n","import { DomSanitizer, SafeHtml } from '@angular/platform-browser'\nimport { QuillService } from './quill.service'\n\nimport {\n Component,\n Inject,\n Input,\n OnChanges,\n SimpleChanges,\n ViewEncapsulation\n} from '@angular/core'\nimport { CommonModule } from '@angular/common'\n\n@Component({\n encapsulation: ViewEncapsulation.None,\n selector: 'quill-view-html',\n styles: [`\n.ql-container.ngx-quill-view-html {\n border: 0;\n}\n`],\n template: `\n <div class=\"ql-container\" [ngClass]=\"themeClass\">\n <div class=\"ql-editor\" [innerHTML]=\"innerHTML\">\n </div>\n </div>\n`,\n standalone: true,\n imports: [CommonModule]\n})\nexport class QuillViewHTMLComponent implements OnChanges {\n @Input() content = ''\n @Input() theme?: string\n @Input() sanitize?: boolean\n\n innerHTML: SafeHtml = ''\n themeClass = 'ql-snow'\n\n constructor(\n @Inject(DomSanitizer) private sanitizer: DomSanitizer,\n protected service: QuillService\n ) {}\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes.theme) {\n const theme = changes.theme.currentValue || (this.service.config.theme ? this.service.config.theme : 'snow')\n this.themeClass = `ql-${theme} ngx-quill-view-html`\n } else if (!this.theme) {\n const theme = this.service.config.theme ? this.service.config.theme : 'snow'\n this.themeClass = `ql-${theme} ngx-quill-view-html`\n }\n if (changes.content) {\n const content = changes.content.currentValue\n const sanitize = [true, false].includes(this.sanitize) ? this.sanitize : (this.service.config.sanitize || false)\n\n this.innerHTML = sanitize ? content : this.sanitizer.bypassSecurityTrustHtml(content)\n }\n }\n}\n","import { CommonModule, isPlatformServer } from '@angular/common'\nimport QuillType from 'quill'\n\nimport {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n Inject,\n Input,\n Output,\n OnChanges,\n PLATFORM_ID,\n Renderer2,\n SimpleChanges,\n ViewEncapsulation,\n NgZone,\n SecurityContext,\n OnDestroy,\n OnInit\n} from '@angular/core'\nimport { Subscription } from 'rxjs'\nimport { mergeMap } from 'rxjs/operators'\n\nimport { CustomOption, CustomModule, QuillModules } from 'ngx-quill/config'\n\nimport {getFormat} from './helpers'\nimport { QuillService } from './quill.service'\nimport { DomSanitizer } from '@angular/platform-browser'\n\n@Component({\n encapsulation: ViewEncapsulation.None,\n selector: 'quill-view',\n styles: [`\n.ql-container.ngx-quill-view {\n border: 0;\n}\n`],\n template: `\n<div quill-view-element *ngIf=\"!preserve\"></div>\n<pre quill-view-element *ngIf=\"preserve\"></pre>\n`,\n standalone: true,\n imports: [CommonModule]\n})\nexport class QuillViewComponent implements AfterViewInit, OnChanges, OnDestroy, OnInit {\n @Input() format?: 'object' | 'html' | 'text' | 'json'\n @Input() theme?: string\n @Input() modules?: QuillModules\n @Input() debug?: 'warn' | 'log' | 'error' | false\n @Input() formats?: string[] | null\n @Input() sanitize?: boolean\n @Input() beforeRender?: () => Promise<void>\n @Input() strict = true\n @Input() content: any\n @Input() customModules: CustomModule[] = []\n @Input() customOptions: CustomOption[] = []\n @Input() preserveWhitespace = false\n\n @Output() onEditorCreated: EventEmitter<any> = new EventEmitter()\n\n quillEditor!: QuillType\n editorElem!: HTMLElement\n public preserve = false\n\n private quillSubscription: Subscription | null = null\n\n constructor(\n public elementRef: ElementRef,\n protected renderer: Renderer2,\n protected zone: NgZone,\n protected service: QuillService,\n protected domSanitizer: DomSanitizer,\n @Inject(PLATFORM_ID) protected platformId: any,\n ) {}\n\n valueSetter = (quillEditor: QuillType, value: any): any => {\n const format = getFormat(this.format, this.service.config.format)\n let content = value\n if (format === 'text') {\n quillEditor.setText(content)\n } else {\n if (format === 'html') {\n const sanitize = [true, false].includes(this.sanitize) ? this.sanitize : (this.service.config.sanitize || false)\n if (sanitize) {\n value = this.domSanitizer.sanitize(SecurityContext.HTML, value)\n }\n content = quillEditor.clipboard.convert(value)\n } else if (format === 'json') {\n try {\n content = JSON.parse(value)\n } catch (e) {\n content = [{ insert: value }]\n }\n }\n quillEditor.setContents(content)\n }\n }\n\n ngOnInit() {\n this.preserve = this.preserveWhitespace\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (!this.quillEditor) {\n return\n }\n if (changes.content) {\n this.valueSetter(this.quillEditor, changes.content.currentValue)\n }\n }\n\n ngAfterViewInit() {\n if (isPlatformServer(this.platformId)) {\n return\n }\n\n this.quillSubscription = this.service.getQuill().pipe(\n mergeMap((Quill) => {\n const promises = [this.service.registerCustomModules(Quill, this.customModules)]\n const beforeRender = this.beforeRender ?? this.service.config.beforeRender\n if (beforeRender) {\n promises.push(beforeRender())\n }\n return Promise.all(promises).then(() => Quill)\n })\n ).subscribe(Quill => {\n const modules = Object.assign({}, this.modules || this.service.config.modules)\n modules.toolbar = false\n\n this.customOptions.forEach((customOption) => {\n const newCustomOption = Quill.import(customOption.import)\n newCustomOption.whitelist = customOption.whitelist\n Quill.register(newCustomOption, true)\n })\n\n let debug = this.debug\n if (!debug && debug !== false && this.service.config.debug) {\n debug = this.service.config.debug\n }\n\n let formats = this.formats\n if (!formats && formats === undefined) {\n formats = this.service.config.formats ?\n Object.assign({}, this.service.config.formats) : (this.service.config.formats === null ? null : undefined)\n }\n const theme = this.theme || (this.service.config.theme ? this.service.config.theme : 'snow')\n\n this.editorElem = this.elementRef.nativeElement.querySelector(\n '[quill-view-element]'\n ) as HTMLElement\n\n this.zone.runOutsideAngular(() => {\n this.quillEditor = new Quill(this.editorElem, {\n debug: debug as any,\n formats: formats as any,\n modules,\n readOnly: true,\n strict: this.strict,\n theme\n })\n })\n\n this.renderer.addClass(this.editorElem, 'ngx-quill-view')\n\n if (this.content) {\n this.valueSetter(this.quillEditor, this.content)\n }\n\n // The `requestAnimationFrame` triggers change detection. There's no sense to invoke the `requestAnimationFrame` if anyone is\n // listening to the `onEditorCreated` event inside the template, for instance `<quill-view (onEditorCreated)=\"...\">`.\n if (!this.onEditorCreated.observers.length) {\n return\n }\n\n // The `requestAnimationFrame` will trigger change detection and `onEditorCreated` will also call `markDirty()`\n // internally, since Angular wraps template event listeners into `listener` instruction. We're using the `requestAnimationFrame`\n // to prevent the frame drop and avoid `ExpressionChangedAfterItHasBeenCheckedError` error.\n requestAnimationFrame(() => {\n this.onEditorCreated.emit(this.quillEditor)\n this.onEditorCreated.complete()\n })\n })\n }\n\n ngOnDestroy(): void {\n this.quillSubscription?.unsubscribe()\n this.quillSubscription = null\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core'\n\nimport { QUILL_CONFIG_TOKEN, QuillConfig } from 'ngx-quill/config'\n\nimport { QuillEditorComponent } from './quill-editor.component'\nimport { QuillViewHTMLComponent } from './quill-view-html.component'\nimport { QuillViewComponent } from './quill-view.component'\n\n@NgModule({\n imports: [QuillEditorComponent, QuillViewComponent, QuillViewHTMLComponent],\n exports: [QuillEditorComponent, QuillViewComponent, QuillViewHTMLComponent],\n})\nexport class QuillModule {\n static forRoot(config?: QuillConfig): ModuleWithProviders<QuillModule> {\n return {\n ngModule: QuillModule,\n providers: [\n {\n provide: QUILL_CONFIG_TOKEN,\n useValue: config\n }\n ]\n }\n }\n}\n","/*\n * Public API Surface of ngx-quill\n */\n\n// Re-export everything from the secondary entry-point so we can be backwards-compatible\n// and don't introduce breaking changes for consumers.\nexport * from 'ngx-quill/config'\n\nexport * from './lib/quill.module'\nexport * from './lib/quill.service'\nexport * from './lib/quill-editor.component'\nexport * from './lib/quill-view.component'\nexport * from './lib/quill-view-html.component'\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.QuillService","i2","i3"],"mappings":";;;;;;;;;;;;AAEO,MAAM,SAAS,GAAG,CAAC,MAAoB,EAAE,YAA0B,KAAiB;AACzF,IAAA,MAAM,YAAY,GAAG,MAAM,IAAI,YAAY,CAAA;IAC3C,OAAO,YAAY,IAAI,MAAM,CAAA;AAC/B,CAAC;;ACOD,MAGa,YAAY,CAAA;IAiDvB,WACE,CAAA,QAAkB,EAC6B,MAAmB,EAAA;QAAnB,IAAM,CAAA,MAAA,GAAN,MAAM,CAAa;AA/C5D,QAAA,IAAA,CAAA,MAAM,GAAoB,KAAK,CAAC,YAAW;AACjD,YAAA,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;;;;AAIf,gBAAA,MAAM,4BAA4B,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAA;;;;;;;;;;gBAUnE,IAAI,CAAC,QAAQ,CAAC,gBAAgB;;AAE5B,oBAAA,IAAI,CAAC,QAAQ,CAAC,iCAAiC,CAAC;AAChD,wBAAA,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAA;gBAChC,MAAM,WAAW,GAAG,MAAM,uCAAuC,OAAO,CAAC,CAAA;AACzE,gBAAA,IAAI,CAAC,QAAQ,CAAC,gBAAgB,GAAG,4BAA4B,CAAA;AAE7D,gBAAA,IAAI,CAAC,KAAK,IACR,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,GAAG,WAAW,CACjD,CAAA;AACT,aAAA;;YAGD,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,YAAY,KAAI;AAClD,gBAAA,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;AAC9D,gBAAA,eAAe,CAAC,SAAS,GAAG,YAAY,CAAC,SAAS,CAAA;AAClD,gBA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