ngx-quill
Version:
Angular components for the easy use of the QuillJS richt text editor.
75 lines (67 loc) • 2.88 kB
JavaScript
import * as i0 from '@angular/core';
import { InjectionToken, NgModule, makeEnvironmentProviders } from '@angular/core';
const defaultModules = {
toolbar: [
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'code-block'],
[{ header: 1 }, { header: 2 }], // custom button values
[{ list: 'ordered' }, { list: 'bullet' }],
[{ script: 'sub' }, { script: 'super' }], // superscript/subscript
[{ indent: '-1' }, { indent: '+1' }], // outdent/indent
[{ direction: 'rtl' }], // text direction
[{ size: ['small', false, 'large', 'huge'] }], // custom dropdown
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[
{ color: [] },
{ background: [] }
], // dropdown with defaults from theme
[{ font: [] }],
[{ align: [] }],
['clean'], // remove formatting button
['link', 'image', 'video'], // link and image, video
['table']
]
};
const QUILL_CONFIG_TOKEN = new InjectionToken('config', {
providedIn: 'root',
factory: () => ({ modules: defaultModules })
});
/**
* This `NgModule` provides a global Quill config on the root level, e.g., in `AppModule`.
* But this eliminates the need to import the entire `ngx-quill` library into the main bundle.
* The `quill-editor` itself may be rendered in any lazy-loaded module, but importing `QuillModule`
* into the `AppModule` will bundle the `ngx-quill` into the vendor.
*/
class QuillConfigModule {
static forRoot(config) {
return {
ngModule: QuillConfigModule,
providers: [{ provide: QUILL_CONFIG_TOKEN,
useValue: config }],
};
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: QuillConfigModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: QuillConfigModule }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: QuillConfigModule }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: QuillConfigModule, decorators: [{
type: NgModule
}] });
/**
* Provides Quill configuration at the root level:
* ```ts
* bootstrapApplication(AppComponent, {
* providers: [provideQuillConfig(...)]
* });
* ```
*/
const provideQuillConfig = (config) => makeEnvironmentProviders([{ provide: QUILL_CONFIG_TOKEN,
useValue: config }]);
/*
* Public API Surface of ngx-quill/config
*/
/**
* Generated bundle index. Do not edit.
*/
export { QUILL_CONFIG_TOKEN, QuillConfigModule, defaultModules, provideQuillConfig };
//# sourceMappingURL=ngx-quill-config.mjs.map