@theseam/ui-common 0.4.25 → 0.4.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/data-filters/filters/data-filter-search/data-filter-search.component.mjs +1 -1
- package/esm2020/data-filters/filters/data-filter-text/data-filter-text.component.mjs +1 -1
- package/esm2020/datatable/datatable-column-preferences/datatable-column-preferences.component.mjs +1 -1
- package/esm2020/form-field/input.directive.mjs +8 -4
- package/esm2020/framework/schema-form-controls/schema-form-input/schema-form-input.component.mjs +1 -1
- package/esm2020/framework/schema-form-controls/schema-form-number/schema-form-number.component.mjs +1 -1
- package/esm2020/framework/schema-form-controls/schema-form-select/schema-form-select.component.mjs +2 -2
- package/esm2020/framework/schema-form-controls/schema-form-tel/schema-form-tel.component.mjs +2 -2
- package/esm2020/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.component.mjs +1 -1
- package/esm2020/rich-text/public-api.mjs +5 -0
- package/esm2020/rich-text/rich-text/rich-text.component.mjs +573 -0
- package/esm2020/rich-text/rich-text.module.mjs +32 -0
- package/esm2020/rich-text/theseam-ui-common-rich-text.mjs +5 -0
- package/esm2020/rich-text/utils/models.mjs +24 -0
- package/esm2020/rich-text/utils/utils.mjs +123 -0
- package/esm2020/tel-input/tel-input/tel-input.component.mjs +2 -2
- package/esm2020/utils/is-null-or-undefined-or-empty.mjs +4 -0
- package/esm2020/utils/not-null-or-undefined-or-empty.mjs +4 -0
- package/esm2020/utils/public-api.mjs +3 -1
- package/fesm2015/theseam-ui-common-data-filters.mjs +2 -2
- package/fesm2015/theseam-ui-common-data-filters.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-datatable.mjs +1 -1
- package/fesm2015/theseam-ui-common-datatable.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-form-field.mjs +7 -3
- package/fesm2015/theseam-ui-common-form-field.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-framework.mjs +4 -4
- package/fesm2015/theseam-ui-common-framework.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-google-maps.mjs +1 -1
- package/fesm2015/theseam-ui-common-google-maps.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-rich-text.mjs +744 -0
- package/fesm2015/theseam-ui-common-rich-text.mjs.map +1 -0
- package/fesm2015/theseam-ui-common-tel-input.mjs +1 -1
- package/fesm2015/theseam-ui-common-tel-input.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-utils.mjs +9 -1
- package/fesm2015/theseam-ui-common-utils.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-data-filters.mjs +2 -2
- package/fesm2020/theseam-ui-common-data-filters.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-datatable.mjs +1 -1
- package/fesm2020/theseam-ui-common-datatable.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-form-field.mjs +7 -3
- package/fesm2020/theseam-ui-common-form-field.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-framework.mjs +4 -4
- package/fesm2020/theseam-ui-common-framework.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-google-maps.mjs +1 -1
- package/fesm2020/theseam-ui-common-google-maps.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-rich-text.mjs +752 -0
- package/fesm2020/theseam-ui-common-rich-text.mjs.map +1 -0
- package/fesm2020/theseam-ui-common-tel-input.mjs +1 -1
- package/fesm2020/theseam-ui-common-tel-input.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-utils.mjs +9 -1
- package/fesm2020/theseam-ui-common-utils.mjs.map +1 -1
- package/form-field/input.directive.d.ts +2 -1
- package/package.json +9 -1
- package/rich-text/index.d.ts +5 -0
- package/rich-text/public-api.d.ts +4 -0
- package/rich-text/rich-text/rich-text.component.d.ts +192 -0
- package/rich-text/rich-text.module.d.ts +10 -0
- package/rich-text/utils/models.d.ts +343 -0
- package/rich-text/utils/utils.d.ts +14 -0
- package/styles/vendor/quill/_quill.scss +162 -10
- package/utils/is-null-or-undefined-or-empty.d.ts +1 -0
- package/utils/not-null-or-undefined-or-empty.d.ts +1 -0
- package/utils/public-api.d.ts +2 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { AfterViewInit, EventEmitter, OnInit, Provider, Renderer2, TemplateRef } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, FormControl } from '@angular/forms';
|
|
3
|
+
import { Blur, ContentChange, EditorChangeContent, EditorChangeSelection, Focus, QuillEditorComponent, SelectionChange } from 'ngx-quill';
|
|
4
|
+
import 'quill-mention';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
6
|
+
import { TheSeamCharacterCounterFn, TheSeamQuillEditorConfig, TheSeamQuillMentionMenuItem, TheSeamQuillMentionMenuOption, TheSeamQuillMentionSearchFn, TheSeamQuillMentionSourceFn } from '../utils/models';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare const RICH_TEXT_VALUE_ACCESSOR: Provider;
|
|
9
|
+
export declare class RichTextComponent implements OnInit, AfterViewInit, ControlValueAccessor {
|
|
10
|
+
private readonly _renderer;
|
|
11
|
+
private _customConfig?;
|
|
12
|
+
onChange: any;
|
|
13
|
+
onTouched: any;
|
|
14
|
+
val: string | undefined;
|
|
15
|
+
formControl: FormControl<string | null>;
|
|
16
|
+
get required(): boolean;
|
|
17
|
+
set required(value: boolean | null | undefined);
|
|
18
|
+
private _required;
|
|
19
|
+
/** @default '' (empty string) */
|
|
20
|
+
get placeholder(): string;
|
|
21
|
+
set placeholder(value: string | null | undefined);
|
|
22
|
+
private _placeholder;
|
|
23
|
+
/**
|
|
24
|
+
* Initial rows visible in text area, set using `height` and `minHeight`.
|
|
25
|
+
*
|
|
26
|
+
* NOTE: Resizable editors will not be able to size below the height calculated from this value.
|
|
27
|
+
*
|
|
28
|
+
* @default 5
|
|
29
|
+
*/
|
|
30
|
+
get rows(): number;
|
|
31
|
+
set rows(value: number | null | undefined);
|
|
32
|
+
private _rows;
|
|
33
|
+
/**
|
|
34
|
+
* When `true`, text area can be resized vertically.
|
|
35
|
+
*
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
get resizable(): boolean;
|
|
39
|
+
set resizable(value: boolean | null | undefined);
|
|
40
|
+
private _resizable;
|
|
41
|
+
/** @default false */
|
|
42
|
+
get readOnly(): boolean;
|
|
43
|
+
set readOnly(value: boolean | null | undefined);
|
|
44
|
+
private _readOnly;
|
|
45
|
+
/**
|
|
46
|
+
* When `true`, overrides all other provided settings to present the editor
|
|
47
|
+
* as a standard textbox.
|
|
48
|
+
*
|
|
49
|
+
* NOTE: For the moment, `<p></p>` tags are still allowed, triggered by the `Enter` key.
|
|
50
|
+
* https://github.com/slab/quill/issues/1432
|
|
51
|
+
*
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
get disableRichText(): boolean;
|
|
55
|
+
set disableRichText(value: boolean | null | undefined);
|
|
56
|
+
private _disableRichText;
|
|
57
|
+
/**
|
|
58
|
+
* When `true`, displays a character counter at the bottom of the editor.
|
|
59
|
+
* Character counter text is determined by values provided in `minLength`
|
|
60
|
+
* and `maxLength`.
|
|
61
|
+
*
|
|
62
|
+
* The default count algorithm strips out html entities and replaces them
|
|
63
|
+
* with spaces to get the string length. To override this behavior, pass
|
|
64
|
+
* a custom function to `characterCounterFn`.
|
|
65
|
+
*
|
|
66
|
+
* To override default character counter display, pass a custom template to `characterCountTpl`.
|
|
67
|
+
*
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
get displayCharacterCounter(): boolean;
|
|
71
|
+
set displayCharacterCounter(value: boolean | null | undefined);
|
|
72
|
+
private _displayCharacterCounter;
|
|
73
|
+
get minLength(): number | undefined;
|
|
74
|
+
set minLength(value: number | undefined);
|
|
75
|
+
private _minLength;
|
|
76
|
+
get maxLength(): number | undefined;
|
|
77
|
+
set maxLength(value: number | undefined);
|
|
78
|
+
private _maxLength;
|
|
79
|
+
/**
|
|
80
|
+
* Set to override default character counter display.
|
|
81
|
+
*
|
|
82
|
+
* Template context includes variables `minLength`, `maxLength`, and `characterCount`.
|
|
83
|
+
*/
|
|
84
|
+
get characterCounterTpl(): TemplateRef<any> | null;
|
|
85
|
+
set characterCounterTpl(value: TemplateRef<any> | null);
|
|
86
|
+
private _characterCounterTpl;
|
|
87
|
+
/**
|
|
88
|
+
* Set to override default counter function, which strips html entities and
|
|
89
|
+
* replaces them with a space.
|
|
90
|
+
*/
|
|
91
|
+
get characterCounterFn(): TheSeamCharacterCounterFn;
|
|
92
|
+
set characterCounterFn(value: TheSeamCharacterCounterFn | null | undefined);
|
|
93
|
+
private _characterCounterFn;
|
|
94
|
+
/**
|
|
95
|
+
* If `true`, component will configure the Quill editor with the quill-mentions extension
|
|
96
|
+
* and listen for values passed to `mentionItems` to populate the mentions menu.
|
|
97
|
+
*
|
|
98
|
+
* @default false
|
|
99
|
+
*/
|
|
100
|
+
get useMentions(): boolean;
|
|
101
|
+
set useMentions(value: boolean | null | undefined);
|
|
102
|
+
private _useMentions;
|
|
103
|
+
/**
|
|
104
|
+
* List of users, user groups, or other entities to display in mentions menu.
|
|
105
|
+
* Minimum required properties are `id` (unique) and `value`, which acts as the label.
|
|
106
|
+
*
|
|
107
|
+
* By default, the menu is triggered by typing the `@` symbol into the text area.
|
|
108
|
+
*/
|
|
109
|
+
get mentionItems(): TheSeamQuillMentionMenuItem[] | null | undefined;
|
|
110
|
+
set mentionItems(value: TheSeamQuillMentionMenuItem[] | null | undefined);
|
|
111
|
+
private _mentionItems;
|
|
112
|
+
mentionItems$: Observable<TheSeamQuillMentionMenuItem[] | null | undefined>;
|
|
113
|
+
/**
|
|
114
|
+
* Set to override default search function when user is typing a mention.
|
|
115
|
+
*/
|
|
116
|
+
get mentionSearchFn(): TheSeamQuillMentionSearchFn;
|
|
117
|
+
set mentionSearchFn(value: TheSeamQuillMentionSearchFn | null | undefined);
|
|
118
|
+
private _mentionSearchFn;
|
|
119
|
+
/**
|
|
120
|
+
* Set to override default render function for mentions list.
|
|
121
|
+
*
|
|
122
|
+
* Function should call `renderList`.
|
|
123
|
+
*/
|
|
124
|
+
get mentionRenderListFn(): TheSeamQuillMentionSourceFn;
|
|
125
|
+
set mentionRenderListFn(value: TheSeamQuillMentionSourceFn | null | undefined);
|
|
126
|
+
private _mentionRenderListFn;
|
|
127
|
+
/**
|
|
128
|
+
* Set to override default text shown while mention items are loading.
|
|
129
|
+
*
|
|
130
|
+
* @default 'Loading...'
|
|
131
|
+
*/
|
|
132
|
+
get mentionListLoadingText(): string;
|
|
133
|
+
set mentionListLoadingText(value: string | null | undefined);
|
|
134
|
+
private _mentionListLoadingText;
|
|
135
|
+
/**
|
|
136
|
+
* Set to override default text shown when a mention search returns no items.
|
|
137
|
+
*
|
|
138
|
+
* @default 'No matches found.'
|
|
139
|
+
*/
|
|
140
|
+
get mentionListEmptyText(): string;
|
|
141
|
+
set mentionListEmptyText(value: string | null | undefined);
|
|
142
|
+
private _mentionListEmptyText;
|
|
143
|
+
get mentionListEmptyItem(): TheSeamQuillMentionMenuOption;
|
|
144
|
+
quillEditorCreated: EventEmitter<any>;
|
|
145
|
+
quillEditorChanged: EventEmitter<EditorChangeContent | EditorChangeSelection>;
|
|
146
|
+
quillContentChanged: EventEmitter<ContentChange>;
|
|
147
|
+
quillSelectionChanged: EventEmitter<SelectionChange>;
|
|
148
|
+
quillFocus: EventEmitter<Focus>;
|
|
149
|
+
quillBlur: EventEmitter<Blur>;
|
|
150
|
+
mentionsUpdated: EventEmitter<TheSeamQuillMentionMenuOption[]>;
|
|
151
|
+
get quillEditor(): TemplateRef<QuillEditorComponent> | undefined;
|
|
152
|
+
set quillEditor(value: TemplateRef<QuillEditorComponent> | undefined);
|
|
153
|
+
private _quillEditor;
|
|
154
|
+
defaultCharacterCounterTpl: TemplateRef<any> | undefined;
|
|
155
|
+
private _isWritingValue;
|
|
156
|
+
private _pollCalculatedRowHeight;
|
|
157
|
+
private _configSet;
|
|
158
|
+
configSet$: Observable<boolean>;
|
|
159
|
+
private _stylesSet;
|
|
160
|
+
private _templateSet;
|
|
161
|
+
initialized$: Observable<boolean>;
|
|
162
|
+
characterCount$: Observable<number>;
|
|
163
|
+
private _config;
|
|
164
|
+
config$: Observable<TheSeamQuillEditorConfig | undefined>;
|
|
165
|
+
private _selectedMentions;
|
|
166
|
+
selectedMentions$: Observable<TheSeamQuillMentionMenuOption[]>;
|
|
167
|
+
constructor(_renderer: Renderer2, _customConfig?: TheSeamQuillEditorConfig | undefined);
|
|
168
|
+
ngOnInit(): void;
|
|
169
|
+
ngAfterViewInit(): void;
|
|
170
|
+
private _buildQuillConfig;
|
|
171
|
+
private _getConfigOrDefault;
|
|
172
|
+
private _updateQuillConfig;
|
|
173
|
+
get value(): string | undefined | null;
|
|
174
|
+
set value(value: string | undefined | null);
|
|
175
|
+
private _value;
|
|
176
|
+
writeValue(value: any): void;
|
|
177
|
+
registerOnChange(fn: any): void;
|
|
178
|
+
registerOnTouched(fn: any): void;
|
|
179
|
+
setDisabledState(isDisabled: boolean): void;
|
|
180
|
+
_onEditorCreated(event: any): void;
|
|
181
|
+
_onEditorChanged(event: EditorChangeContent | EditorChangeSelection): void;
|
|
182
|
+
_onContentChanged(event: ContentChange): void;
|
|
183
|
+
_onSelectionChanged(event: SelectionChange): void;
|
|
184
|
+
_onFocus(event: Focus): void;
|
|
185
|
+
_onBlur(event: Blur): void;
|
|
186
|
+
/**
|
|
187
|
+
* Hacky way to track mention inserts/deletes
|
|
188
|
+
*/
|
|
189
|
+
private _updateMentionsFromDelta;
|
|
190
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RichTextComponent, [null, { optional: true; }]>;
|
|
191
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RichTextComponent, "seam-rich-text", never, { "val": "value"; "required": "required"; "placeholder": "placeholder"; "rows": "rows"; "resizable": "resizable"; "disableRichText": "disableRichText"; "displayCharacterCounter": "displayCharacterCounter"; "minLength": "minLength"; "maxLength": "maxLength"; "characterCounterTpl": "characterCounterTpl"; "characterCounterFn": "characterCounterFn"; "useMentions": "useMentions"; "mentionItems": "mentionItems"; "mentionSearchFn": "mentionSearchFn"; "mentionRenderListFn": "mentionRenderListFn"; "mentionListLoadingText": "mentionListLoadingText"; "mentionListEmptyText": "mentionListEmptyText"; }, { "quillEditorCreated": "quillEditorCreated"; "quillEditorChanged": "quillEditorChanged"; "quillContentChanged": "quillContentChanged"; "quillSelectionChanged": "quillSelectionChanged"; "quillFocus": "quillFocus"; "quillBlur": "quillBlur"; "mentionsUpdated": "mentionsUpdated"; }, never, never, false, never>;
|
|
192
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./rich-text/rich-text.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "@angular/forms";
|
|
5
|
+
import * as i4 from "ngx-quill";
|
|
6
|
+
export declare class TheSeamRichTextModule {
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TheSeamRichTextModule, never>;
|
|
8
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<TheSeamRichTextModule, [typeof i1.RichTextComponent], [typeof i2.CommonModule, typeof i3.ReactiveFormsModule, typeof i4.QuillModule], [typeof i1.RichTextComponent]>;
|
|
9
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<TheSeamRichTextModule>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { CustomModule, CustomOption, QuillModules } from 'ngx-quill';
|
|
2
|
+
import QuillType from 'quill';
|
|
3
|
+
export interface TheSeamQuillMentionMenuOption {
|
|
4
|
+
/** Must be unique. */
|
|
5
|
+
id: string;
|
|
6
|
+
/**
|
|
7
|
+
* The value is used as the label for the mentions,
|
|
8
|
+
* both in the text area and in the menu.
|
|
9
|
+
*/
|
|
10
|
+
value: string;
|
|
11
|
+
/**
|
|
12
|
+
* When `true`, this item will be included in the menu,
|
|
13
|
+
* regardless of the search function applied.
|
|
14
|
+
*/
|
|
15
|
+
searchIgnore?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* If provided, will group items with the same `groupName`
|
|
18
|
+
* under one header.
|
|
19
|
+
*/
|
|
20
|
+
groupName?: string;
|
|
21
|
+
/** Any additional optional parameters */
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
export interface TheSeamQuillMentionMenuDivider {
|
|
25
|
+
type: 'divider';
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface TheSeamQuillMentionMenuHeader {
|
|
29
|
+
value: string;
|
|
30
|
+
type: 'groupName';
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export type TheSeamQuillMentionMenuItem = TheSeamQuillMentionMenuOption | TheSeamQuillMentionMenuDivider | TheSeamQuillMentionMenuHeader;
|
|
34
|
+
export type TheSeamQuillMentionSearchFn = (source: TheSeamQuillMentionMenuItem[], textAfter: string, mentionChar: string) => TheSeamQuillMentionMenuItem[];
|
|
35
|
+
export type TheSeamQuillMentionSourceFn = (source: TheSeamQuillMentionMenuItem[], searchFn: TheSeamQuillMentionSearchFn, emptyListItem: TheSeamQuillMentionMenuItem | undefined, textAfter: string, renderList: (matches: {
|
|
36
|
+
id: string;
|
|
37
|
+
value: string;
|
|
38
|
+
[key: string]: string | undefined;
|
|
39
|
+
}[], searchTerm: string) => void, mentionChar: string) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Typed version of Options object, copied from quill-mention@v6.0.1 (typescript version)
|
|
42
|
+
*/
|
|
43
|
+
export interface TheSeamQuillMentionOptions {
|
|
44
|
+
/**
|
|
45
|
+
* Specifies which characters will cause the mention autocomplete to open
|
|
46
|
+
* @default ['@']
|
|
47
|
+
*/
|
|
48
|
+
mentionDenotationChars?: string[];
|
|
49
|
+
/**
|
|
50
|
+
* Whether to show the used denotation character in the mention item or not
|
|
51
|
+
* @default true
|
|
52
|
+
*/
|
|
53
|
+
showDenotationChar?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Allowed characters in search term triggering a search request using regular expressions. Can be a function that takes the denotationChar and returns a regex.
|
|
56
|
+
* @default /^[a-zA-Z0-9_]*$/
|
|
57
|
+
*/
|
|
58
|
+
allowedChars?: RegExp | ((char: string) => RegExp);
|
|
59
|
+
/**
|
|
60
|
+
* Minimum number of characters after the @ symbol triggering a search request
|
|
61
|
+
* @default 0
|
|
62
|
+
*/
|
|
63
|
+
minChars?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Maximum number of characters after the @ symbol triggering a search request
|
|
66
|
+
* @default 31
|
|
67
|
+
*/
|
|
68
|
+
maxChars?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Additional top offset of the mention container position
|
|
71
|
+
* @default 2
|
|
72
|
+
*/
|
|
73
|
+
offsetTop?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Additional left offset of the mention container position
|
|
76
|
+
* @default 0
|
|
77
|
+
*/
|
|
78
|
+
offsetLeft?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Whether or not the denotation character(s) should be isolated. For example, to avoid mentioning in an email.
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
isolateCharacter?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Only works if isolateCharacter is set to true. Whether or not the denotation character(s) can appear inline of the mention text. For example, to allow mentioning an email with the @ symbol as the denotation character.
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
allowInlineMentionChar?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* When set to true, the mentions menu will be rendered above or below the quill container. Otherwise, the mentions menu will track the denotation character(s);
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
fixMentionsToQuill?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Options are 'normal' and 'fixed'. When 'fixed', the menu will be appended to the body and use fixed positioning. Use this if the menu is clipped by a parent element that's using `overflow:hidden
|
|
96
|
+
* @default 'normal'
|
|
97
|
+
*/
|
|
98
|
+
positioningStrategy?: 'normal' | 'fixed';
|
|
99
|
+
/**
|
|
100
|
+
* Options are 'bottom' and 'top'. Determines what the default orientation of the menu will be. Quill-mention will attempt to render the menu either above or below the editor. If 'top' is provided as a value, and there is not enough space above the editor, the menu will be rendered below. Vice versa, if there is not enough space below the editor, and 'bottom' is provided as a value (or no value is provided at all), the menu will be rendered above the editor.
|
|
101
|
+
* @default 'bottom'
|
|
102
|
+
*/
|
|
103
|
+
defaultMenuOrientation?: 'top' | 'bottom';
|
|
104
|
+
/**
|
|
105
|
+
* The name of the Quill Blot to be used for inserted mentions. A default implementation is provided named 'mention', which may be overridden with a custom blot.
|
|
106
|
+
* @default 'mention'
|
|
107
|
+
*/
|
|
108
|
+
blotName?: string;
|
|
109
|
+
/**
|
|
110
|
+
* A list of data values you wish to be passed from your list data to the html node. (id, value, denotationChar, link, target are included by default).
|
|
111
|
+
* @default ['id', 'value', 'denotationChar', 'link', 'target', 'disabled']
|
|
112
|
+
*/
|
|
113
|
+
dataAttributes?: string[];
|
|
114
|
+
/**
|
|
115
|
+
* Link target for mentions with a link
|
|
116
|
+
* @default '_blank'
|
|
117
|
+
*/
|
|
118
|
+
linkTarget?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Style class to be used for list items (may be null)
|
|
121
|
+
* @default 'ql-mention-list-item'
|
|
122
|
+
*/
|
|
123
|
+
listItemClass?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Style class to be used for the mention list container (may be null)
|
|
126
|
+
* @default 'ql-mention-list-container'
|
|
127
|
+
*/
|
|
128
|
+
mentionContainerClass?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Style class to be used for the mention list (may be null)
|
|
131
|
+
* @default 'ql-mention-list'
|
|
132
|
+
*/
|
|
133
|
+
mentionListClass?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Whether or not insert 1 space after mention block in text
|
|
136
|
+
* @default true
|
|
137
|
+
*/
|
|
138
|
+
spaceAfterInsert?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* An array of keyboard key codes that will trigger the select action for the mention dropdown. Default is ENTER key. See this reference for a list of numbers for each keyboard key.
|
|
141
|
+
* @default [13]
|
|
142
|
+
*/
|
|
143
|
+
selectKeys?: (string | number | string)[];
|
|
144
|
+
/**
|
|
145
|
+
* Required callback function to handle the search term and connect it to a data source for matches. The data source can be a local source or an AJAX request.
|
|
146
|
+
* The callback should call renderList(matches, searchTerm); with matches of JSON Objects in an array to show the result for the user. The JSON Objects should have id and value but can also have other values to be used in renderItem for custom display.
|
|
147
|
+
* @param textAfter
|
|
148
|
+
* @param render
|
|
149
|
+
* @param mentionChar
|
|
150
|
+
* @returns
|
|
151
|
+
*/
|
|
152
|
+
source: (textAfter: string, renderList: (matches: {
|
|
153
|
+
id: string;
|
|
154
|
+
value: string;
|
|
155
|
+
[key: string]: string | undefined;
|
|
156
|
+
}[], searchTerm: string) => void, mentionChar: string) => void;
|
|
157
|
+
/**
|
|
158
|
+
* Callback when mention dropdown is open.
|
|
159
|
+
* @returns
|
|
160
|
+
*/
|
|
161
|
+
onOpen?: () => boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Callback before the DOM of mention dropdown is removed.
|
|
164
|
+
* @returns
|
|
165
|
+
*/
|
|
166
|
+
onBeforeClose?: () => boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Callback when mention dropdown is closed.
|
|
169
|
+
* @returns
|
|
170
|
+
*/
|
|
171
|
+
onClose?: () => boolean;
|
|
172
|
+
/**
|
|
173
|
+
* A function that gives you control over how matches from source are displayed. You can use this function to highlight the search term or change the design with custom HTML. This function will need to return either a string possibly containing unsanitized user content, or a class implementing the Node interface which will be treated as a sanitized DOM node.
|
|
174
|
+
* @param item
|
|
175
|
+
* @param searchTerm
|
|
176
|
+
* @returns
|
|
177
|
+
*/
|
|
178
|
+
renderItem?: (item: {
|
|
179
|
+
id: string;
|
|
180
|
+
value: string;
|
|
181
|
+
[key: string]: unknown;
|
|
182
|
+
}, searchTerm: string) => string | HTMLElement;
|
|
183
|
+
/**
|
|
184
|
+
* A function that returns the HTML for a loading message during async calls from source. The function will need to return either a string possibly containing unsanitized user content, or a class implementing the Node interface which will be treated as a sanitized DOM node. The default functions returns null to prevent a loading message.
|
|
185
|
+
* @returns
|
|
186
|
+
*/
|
|
187
|
+
renderLoading?: () => string | HTMLElement | null;
|
|
188
|
+
/**
|
|
189
|
+
* Callback for a selected item. When overriding this method, insertItem should be used to insert item to the editor. This makes async requests possible.
|
|
190
|
+
* @param item
|
|
191
|
+
* @param insertItem
|
|
192
|
+
*/
|
|
193
|
+
onSelect?: (item: DOMStringMap, insertItem: (data: Record<string, unknown>, programmaticInsert?: boolean, overriddenOptions?: object) => void) => void;
|
|
194
|
+
}
|
|
195
|
+
export interface TheSeamQuillModules extends QuillModules {
|
|
196
|
+
mention?: Partial<TheSeamQuillMentionOptions>;
|
|
197
|
+
}
|
|
198
|
+
export declare const THESEAM_QUILL_FORMATS: readonly ["align", "background", "blockquote", "bold", "code-block", "code", "color", "direction", "font", "header", "image", "indent", "italic", "link", "list", "script", "size", "strike", "underline", "video", "mention"];
|
|
199
|
+
export type TheSeamQuillStyleFormat = (typeof THESEAM_QUILL_FORMATS)[number];
|
|
200
|
+
export type TheSeamQuillInputFormat = 'object' | 'html' | 'text' | 'json';
|
|
201
|
+
export interface TheSeamQuillEditorConfig {
|
|
202
|
+
/**
|
|
203
|
+
* The format of the text inside the editor.
|
|
204
|
+
*
|
|
205
|
+
* @default 'html'
|
|
206
|
+
*/
|
|
207
|
+
format: TheSeamQuillInputFormat;
|
|
208
|
+
/** @default 'snow' */
|
|
209
|
+
theme?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Used to set custom config for built-in and add-on modules.
|
|
212
|
+
*
|
|
213
|
+
* See `SEAM_QUILL_MODULES_DEFAULT` for default value.
|
|
214
|
+
*/
|
|
215
|
+
modules?: TheSeamQuillModules;
|
|
216
|
+
/**
|
|
217
|
+
* Console level for debug messages.
|
|
218
|
+
*
|
|
219
|
+
* @default `warn`
|
|
220
|
+
*/
|
|
221
|
+
debug?: 'warn' | 'log' | 'error' | false;
|
|
222
|
+
/**
|
|
223
|
+
* List of formats allowed in editor.
|
|
224
|
+
*
|
|
225
|
+
* See `SEAM_QUILL_FORMATS_DEFAULT` for default value.
|
|
226
|
+
*
|
|
227
|
+
* NOTE: Adding or removing a value will enable/disable that format
|
|
228
|
+
* in the editor, but has no effect on the toolbar buttons.
|
|
229
|
+
* To modify the toolbar display, update `modules.toolbar`.
|
|
230
|
+
*/
|
|
231
|
+
formats?: TheSeamQuillStyleFormat[] | null;
|
|
232
|
+
/** @default 'top' */
|
|
233
|
+
customToolbarPosition: 'top' | 'bottom';
|
|
234
|
+
/**
|
|
235
|
+
* When `true`, runs the control value through Angular's DOM sanitizer
|
|
236
|
+
* before setting the value.
|
|
237
|
+
*
|
|
238
|
+
* @default false
|
|
239
|
+
*/
|
|
240
|
+
sanitize: boolean;
|
|
241
|
+
/** Custom css styles to add to the `.ql-container` element. */
|
|
242
|
+
styles?: {
|
|
243
|
+
[key: string]: string;
|
|
244
|
+
} | null;
|
|
245
|
+
/**
|
|
246
|
+
* When `false`, user interactions in the toolbar will emit even
|
|
247
|
+
* if the editor is marked as `readOnly`. This allows the user to
|
|
248
|
+
* make some formatting changes (e.g. creating a list) to a value
|
|
249
|
+
* that should be disabled.
|
|
250
|
+
*
|
|
251
|
+
* @default true.
|
|
252
|
+
*/
|
|
253
|
+
strict: boolean;
|
|
254
|
+
/**
|
|
255
|
+
* An element or selector that specifies the scrolling element of the editor.
|
|
256
|
+
*
|
|
257
|
+
* Default scrollingContainer is the `.ql-editor` element.
|
|
258
|
+
*/
|
|
259
|
+
scrollingContainer?: HTMLElement | string | null;
|
|
260
|
+
/**
|
|
261
|
+
* An element or selector that specifies the confining element of the editor.
|
|
262
|
+
*
|
|
263
|
+
* Default boundary container is the document's `body` element.
|
|
264
|
+
*/
|
|
265
|
+
bounds?: HTMLElement | string;
|
|
266
|
+
/**
|
|
267
|
+
* Defines custom formats for the editor. Can be used to overwrite existing options.
|
|
268
|
+
*
|
|
269
|
+
* TODO: Research this more.
|
|
270
|
+
*/
|
|
271
|
+
customOptions: CustomOption[];
|
|
272
|
+
/**
|
|
273
|
+
* Defines custom modules for the editor. Can be used to overwrite existing modules.
|
|
274
|
+
*
|
|
275
|
+
* TODO: Research this more.
|
|
276
|
+
*/
|
|
277
|
+
customModules: CustomModule[];
|
|
278
|
+
/**
|
|
279
|
+
* When `user`, only change events from the user will trigger a model change.
|
|
280
|
+
* This is the default behavior, and is preferred.
|
|
281
|
+
*
|
|
282
|
+
* Changing to `all` is not recommended.
|
|
283
|
+
*/
|
|
284
|
+
trackChanges?: 'user' | 'all';
|
|
285
|
+
/**
|
|
286
|
+
* When `true`, preserves duplicated whitespaces.
|
|
287
|
+
*
|
|
288
|
+
* @default false
|
|
289
|
+
*/
|
|
290
|
+
preserveWhitespace: boolean;
|
|
291
|
+
/** Custom classes to add to the `.ql-container` element. */
|
|
292
|
+
classes?: string;
|
|
293
|
+
/**
|
|
294
|
+
* When `true`, trims leading/trailing newlines when validation is run.
|
|
295
|
+
*
|
|
296
|
+
* @default false
|
|
297
|
+
*/
|
|
298
|
+
trimOnValidation: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Sets a placeholder for the link input in the hyperlink form.
|
|
301
|
+
*
|
|
302
|
+
* @default 'https://quilljs.com'
|
|
303
|
+
*/
|
|
304
|
+
linkPlaceholder?: string;
|
|
305
|
+
/**
|
|
306
|
+
* When `true`, does a basic compare (using JSON.stringify) between the old
|
|
307
|
+
* and new value on `writeValue()`. If the values are the same, it skips the update.
|
|
308
|
+
*
|
|
309
|
+
* @default false
|
|
310
|
+
*/
|
|
311
|
+
compareValues: boolean;
|
|
312
|
+
/**
|
|
313
|
+
* When `true`, skips the update for null values on `writeValue()`.
|
|
314
|
+
*
|
|
315
|
+
* @default false
|
|
316
|
+
*/
|
|
317
|
+
filterNull: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Debounces `onContentChanged()`, `onEditorChanged()`, `ngModel` and form control `valueChange()`.
|
|
320
|
+
*
|
|
321
|
+
* Defaults to `undefined`, so changes always emit immediately.
|
|
322
|
+
*
|
|
323
|
+
* @default undefined
|
|
324
|
+
*/
|
|
325
|
+
debounceTime?: number;
|
|
326
|
+
/**
|
|
327
|
+
* @deprecated The `ngx-quill` library doesn't accurately handle undefined
|
|
328
|
+
* inputs, and the default `valueGetter` function is impossible to reference here,
|
|
329
|
+
* so this config option is not used.
|
|
330
|
+
*
|
|
331
|
+
* Defines custom logic for reading the html value of the editor.
|
|
332
|
+
*/
|
|
333
|
+
valueGetter?: (quillEditor: QuillType, editorElement: HTMLElement) => string | any;
|
|
334
|
+
/**
|
|
335
|
+
* @deprecated The `ngx-quill` library doesn't accurately handle undefined
|
|
336
|
+
* inputs, and the default `valueSetter` function is impossible to reference here,
|
|
337
|
+
* so this config option is not used.
|
|
338
|
+
*
|
|
339
|
+
* Defines custom logic for setting the html value of the editor.
|
|
340
|
+
*/
|
|
341
|
+
valueSetter?: (quillEditor: QuillType, value: any) => any;
|
|
342
|
+
}
|
|
343
|
+
export type TheSeamCharacterCounterFn = (value: string, format: TheSeamQuillInputFormat | undefined) => number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InjectionToken } from "@angular/core";
|
|
2
|
+
import { QuillToolbarConfig } from "ngx-quill";
|
|
3
|
+
import { TheSeamQuillModules, TheSeamQuillStyleFormat, TheSeamQuillEditorConfig, TheSeamQuillMentionMenuOption, TheSeamQuillMentionOptions, TheSeamQuillMentionSourceFn, TheSeamQuillMentionSearchFn, TheSeamCharacterCounterFn, TheSeamQuillMentionMenuItem } from "./models";
|
|
4
|
+
export declare const HTML_ENTITY_REGEX: RegExp;
|
|
5
|
+
export declare const THESEAM_QUILL_TOOLBAR_OPTIONS_DEFAULT: QuillToolbarConfig;
|
|
6
|
+
export declare const THESEAM_QUILL_MENTION_OPTIONS_DEFAULT: Partial<TheSeamQuillMentionOptions>;
|
|
7
|
+
export declare const THESEAM_QUILL_MODULES_DEFAULT: TheSeamQuillModules;
|
|
8
|
+
export declare const THESEAM_QUILL_FORMATS_DEFAULT: TheSeamQuillStyleFormat[];
|
|
9
|
+
export declare const THESEAM_QUILL_EDITOR_CONFIG_DEFAULT: TheSeamQuillEditorConfig;
|
|
10
|
+
export declare const THESEAM_QUILL_EDITOR_CONFIG: InjectionToken<TheSeamQuillEditorConfig>;
|
|
11
|
+
export declare const defaultHtmlCharacterCounterFn: TheSeamCharacterCounterFn;
|
|
12
|
+
export declare function isMentionMenuOption(value: TheSeamQuillMentionMenuItem | undefined): value is TheSeamQuillMentionMenuOption;
|
|
13
|
+
export declare const defaultMentionSearchFn: TheSeamQuillMentionSearchFn;
|
|
14
|
+
export declare const defaultMentionRenderListFn: TheSeamQuillMentionSourceFn;
|