@skyux/text-editor 8.7.0 → 9.0.0-alpha.0
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/esm2022/lib/modules/rich-text-display/rich-text-display.component.mjs +42 -0
- package/{esm2020 → esm2022}/lib/modules/rich-text-display/rich-text-display.module.mjs +5 -5
- package/{esm2020 → esm2022}/lib/modules/shared/sky-text-editor-resources.module.mjs +11 -11
- package/esm2022/lib/modules/text-editor/menubar/text-editor-menubar.component.mjs +197 -0
- package/esm2022/lib/modules/text-editor/services/text-editor-adapter.service.mjs +431 -0
- package/{esm2020 → esm2022}/lib/modules/text-editor/services/text-editor-selection.service.mjs +4 -4
- package/esm2022/lib/modules/text-editor/services/text-editor.service.mjs +59 -0
- package/esm2022/lib/modules/text-editor/services/text-sanitization.service.mjs +38 -0
- package/esm2022/lib/modules/text-editor/text-editor.component.mjs +410 -0
- package/{esm2020 → esm2022}/lib/modules/text-editor/text-editor.module.mjs +41 -41
- package/esm2022/lib/modules/text-editor/toolbar/text-editor-toolbar.component.mjs +207 -0
- package/esm2022/lib/modules/text-editor/url-modal/text-editor-url-modal.component.mjs +119 -0
- package/fesm2022/skyux-text-editor.mjs +1828 -0
- package/{fesm2020 → fesm2022}/skyux-text-editor.mjs.map +1 -1
- package/lib/modules/rich-text-display/rich-text-display.component.d.ts +1 -1
- package/lib/modules/text-editor/menubar/text-editor-menubar.component.d.ts +1 -1
- package/lib/modules/text-editor/text-editor.component.d.ts +1 -1
- package/lib/modules/text-editor/toolbar/text-editor-toolbar.component.d.ts +1 -1
- package/package.json +20 -26
- package/esm2020/lib/modules/rich-text-display/rich-text-display.component.mjs +0 -44
- package/esm2020/lib/modules/text-editor/menubar/text-editor-menubar.component.mjs +0 -197
- package/esm2020/lib/modules/text-editor/services/text-editor-adapter.service.mjs +0 -421
- package/esm2020/lib/modules/text-editor/services/text-editor.service.mjs +0 -64
- package/esm2020/lib/modules/text-editor/services/text-sanitization.service.mjs +0 -43
- package/esm2020/lib/modules/text-editor/text-editor.component.mjs +0 -395
- package/esm2020/lib/modules/text-editor/toolbar/text-editor-toolbar.component.mjs +0 -204
- package/esm2020/lib/modules/text-editor/url-modal/text-editor-url-modal.component.mjs +0 -118
- package/fesm2015/skyux-text-editor.mjs +0 -1793
- package/fesm2015/skyux-text-editor.mjs.map +0 -1
- package/fesm2020/skyux-text-editor.mjs +0 -1804
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/shared/forms-utility.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/defaults/font-list-defaults.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/defaults/font-size-list-defaults.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/defaults/menu-defaults.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/defaults/style-state-defaults.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/defaults/toolbar-action-defaults.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/types/editor-command.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/types/editor-setting.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/types/font-state.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/types/menu-type.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/types/style-state.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/types/text-editor-merge-field.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/types/toolbar-action-type.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/url-modal/text-editor-url-modal-context.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/url-modal/text-editor-url-modal-result.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/text-editor/url-modal/text-editor-url-target.mjs +0 -0
- /package/{esm2020 → esm2022}/skyux-text-editor.mjs +0 -0
|
@@ -0,0 +1,1828 @@
|
|
|
1
|
+
import * as i3 from '@angular/common';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Injectable, Component, Input, NgModule, ChangeDetectionStrategy, inject, TemplateRef, ViewEncapsulation, ViewChild, HostBinding } from '@angular/core';
|
|
5
|
+
import * as i1 from '@angular/platform-browser';
|
|
6
|
+
import createDOMPurify from 'dompurify';
|
|
7
|
+
import * as i3$1 from '@angular/forms';
|
|
8
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
9
|
+
import * as i7$1 from '@skyux/colorpicker';
|
|
10
|
+
import { SkyColorpickerMessageType, SkyColorpickerModule } from '@skyux/colorpicker';
|
|
11
|
+
import * as i1$1 from '@skyux/core';
|
|
12
|
+
import { SkyCoreAdapterModule, SkyIdModule } from '@skyux/core';
|
|
13
|
+
import * as i6 from '@skyux/forms';
|
|
14
|
+
import { SkyInputBoxHostService, SkyInputBoxModule, SkyCheckboxModule } from '@skyux/forms';
|
|
15
|
+
import * as i2 from '@skyux/i18n';
|
|
16
|
+
import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
|
|
17
|
+
import * as i5$1 from '@skyux/indicators';
|
|
18
|
+
import { SkyIconModule } from '@skyux/indicators';
|
|
19
|
+
import * as i7 from '@skyux/layout';
|
|
20
|
+
import { SkyToolbarModule } from '@skyux/layout';
|
|
21
|
+
import * as i1$2 from '@skyux/modals';
|
|
22
|
+
import { SkyModalModule } from '@skyux/modals';
|
|
23
|
+
import * as i4 from '@skyux/popovers';
|
|
24
|
+
import { SkyDropdownMessageType, SkyDropdownModule } from '@skyux/popovers';
|
|
25
|
+
import * as i6$1 from '@skyux/tabs';
|
|
26
|
+
import { SkyTabsModule } from '@skyux/tabs';
|
|
27
|
+
import * as i5 from '@skyux/theme';
|
|
28
|
+
import { SkyThemeModule } from '@skyux/theme';
|
|
29
|
+
import he from 'he';
|
|
30
|
+
import { Subject } from 'rxjs';
|
|
31
|
+
import { takeUntil, take } from 'rxjs/operators';
|
|
32
|
+
import { SkyValidation } from '@skyux/validation';
|
|
33
|
+
|
|
34
|
+
const domPurify = createDOMPurify(window);
|
|
35
|
+
domPurify.addHook('afterSanitizeAttributes', (node) => {
|
|
36
|
+
// Set all elements owning target to target=_blank
|
|
37
|
+
// so we only allow the target attribute with that value.
|
|
38
|
+
if (node.getAttribute('target')) {
|
|
39
|
+
node.setAttribute('target', '_blank');
|
|
40
|
+
node.setAttribute('rel', 'noopener noreferrer');
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* The `SkyTextSanitizationService` user the `DOMPurify` library to sanitize strings for use
|
|
45
|
+
* in the DOM. `DOMPurify` allows more customization than Angular's internal `DomSanitizer` so we
|
|
46
|
+
* can preserve `<style>` tags and allow `target` attributes for new tab links.
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
class SkyTextSanitizationService {
|
|
50
|
+
#allowedAttributes = ['target'];
|
|
51
|
+
/**
|
|
52
|
+
* Returns a sanitized string, allowing target attribute for new tab links.
|
|
53
|
+
*/
|
|
54
|
+
sanitize(htmlString) {
|
|
55
|
+
return domPurify.sanitize(htmlString, {
|
|
56
|
+
ADD_ATTR: this.#allowedAttributes,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextSanitizationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
60
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextSanitizationService, providedIn: 'root' }); }
|
|
61
|
+
}
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextSanitizationService, decorators: [{
|
|
63
|
+
type: Injectable,
|
|
64
|
+
args: [{
|
|
65
|
+
providedIn: 'root',
|
|
66
|
+
}]
|
|
67
|
+
}] });
|
|
68
|
+
|
|
69
|
+
class SkyRichTextDisplayComponent {
|
|
70
|
+
/**
|
|
71
|
+
* The rich text to display.
|
|
72
|
+
*/
|
|
73
|
+
set richText(value) {
|
|
74
|
+
if (value) {
|
|
75
|
+
const cleaned = this.#sanitizationService.sanitize(value);
|
|
76
|
+
/* istanbul ignore else */
|
|
77
|
+
if (cleaned !== this.#_richText) {
|
|
78
|
+
this.#_richText = cleaned;
|
|
79
|
+
// Text has already been sanitized with DOMPurifier.
|
|
80
|
+
// Tell Angular to bypass its own internal sanitization.
|
|
81
|
+
this.sanitizedText = this.#sanitizer.bypassSecurityTrustHtml(cleaned);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
this.sanitizedText = '';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
#_richText;
|
|
89
|
+
#sanitizer;
|
|
90
|
+
#sanitizationService;
|
|
91
|
+
constructor(sanitizer, sanitizationService) {
|
|
92
|
+
this.sanitizedText = '';
|
|
93
|
+
this.#_richText = '';
|
|
94
|
+
this.#sanitizer = sanitizer;
|
|
95
|
+
this.#sanitizationService = sanitizationService;
|
|
96
|
+
}
|
|
97
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyRichTextDisplayComponent, deps: [{ token: i1.DomSanitizer }, { token: SkyTextSanitizationService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
98
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyRichTextDisplayComponent, selector: "sky-rich-text-display", inputs: { richText: "richText" }, ngImport: i0, template: "<span class=\"sky-rich-text-display-text\" [innerHTML]=\"sanitizedText\"></span>\n" }); }
|
|
99
|
+
}
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyRichTextDisplayComponent, decorators: [{
|
|
101
|
+
type: Component,
|
|
102
|
+
args: [{ selector: 'sky-rich-text-display', template: "<span class=\"sky-rich-text-display-text\" [innerHTML]=\"sanitizedText\"></span>\n" }]
|
|
103
|
+
}], ctorParameters: function () { return [{ type: i1.DomSanitizer }, { type: SkyTextSanitizationService }]; }, propDecorators: { richText: [{
|
|
104
|
+
type: Input
|
|
105
|
+
}] } });
|
|
106
|
+
|
|
107
|
+
class SkyRichTextDisplayModule {
|
|
108
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyRichTextDisplayModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
109
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyRichTextDisplayModule, declarations: [SkyRichTextDisplayComponent], imports: [CommonModule], exports: [SkyRichTextDisplayComponent] }); }
|
|
110
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyRichTextDisplayModule, imports: [CommonModule] }); }
|
|
111
|
+
}
|
|
112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyRichTextDisplayModule, decorators: [{
|
|
113
|
+
type: NgModule,
|
|
114
|
+
args: [{
|
|
115
|
+
imports: [CommonModule],
|
|
116
|
+
exports: [SkyRichTextDisplayComponent],
|
|
117
|
+
declarations: [SkyRichTextDisplayComponent],
|
|
118
|
+
}]
|
|
119
|
+
}] });
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
123
|
+
* The contents of this file were automatically generated by
|
|
124
|
+
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-text-editor' schematic.
|
|
125
|
+
* To update this file, simply rerun the command.
|
|
126
|
+
*/
|
|
127
|
+
const RESOURCES = {
|
|
128
|
+
'EN-US': {
|
|
129
|
+
skyux_text_editor_format_menu_action_bold_label: { message: 'Bold' },
|
|
130
|
+
skyux_text_editor_format_menu_action_bold_key_shortcut: {
|
|
131
|
+
message: 'Ctrl+B',
|
|
132
|
+
},
|
|
133
|
+
skyux_text_editor_format_menu_action_italic_label: { message: 'Italic' },
|
|
134
|
+
skyux_text_editor_format_menu_action_italic_key_shortcut: {
|
|
135
|
+
message: 'Ctrl+I',
|
|
136
|
+
},
|
|
137
|
+
skyux_text_editor_format_menu_action_underline_label: {
|
|
138
|
+
message: 'Underline',
|
|
139
|
+
},
|
|
140
|
+
skyux_text_editor_format_menu_action_underline_key_shortcut: {
|
|
141
|
+
message: 'Ctrl+U',
|
|
142
|
+
},
|
|
143
|
+
skyux_text_editor_format_menu_action_strikethrough_label: {
|
|
144
|
+
message: 'Strikethrough',
|
|
145
|
+
},
|
|
146
|
+
skyux_text_editor_format_menu_action_clear_formatting_label: {
|
|
147
|
+
message: 'Clear formatting',
|
|
148
|
+
},
|
|
149
|
+
skyux_text_editor_edit_menu_action_undo_label: { message: 'Undo' },
|
|
150
|
+
skyux_text_editor_edit_menu_action_undo_key_shortcut: { message: 'Ctrl+Z' },
|
|
151
|
+
skyux_text_editor_edit_menu_action_redo_label: { message: 'Redo' },
|
|
152
|
+
skyux_text_editor_edit_menu_action_redo_key_shortcut: { message: 'Ctrl+Y' },
|
|
153
|
+
skyux_text_editor_edit_menu_action_cut_label: { message: 'Cut' },
|
|
154
|
+
skyux_text_editor_edit_menu_action_cut_key_shortcut: { message: 'Ctrl+X' },
|
|
155
|
+
skyux_text_editor_edit_menu_action_copy_label: { message: 'Copy' },
|
|
156
|
+
skyux_text_editor_edit_menu_action_copy_key_shortcut: { message: 'Ctrl+C' },
|
|
157
|
+
skyux_text_editor_edit_menu_action_paste_label: { message: 'Paste' },
|
|
158
|
+
skyux_text_editor_edit_menu_action_paste_key_shortcut: {
|
|
159
|
+
message: 'Ctrl+V',
|
|
160
|
+
},
|
|
161
|
+
skyux_text_editor_edit_menu_action_select_all_label: {
|
|
162
|
+
message: 'Select all',
|
|
163
|
+
},
|
|
164
|
+
skyux_text_editor_edit_menu_action_select_all_key_shortcut: {
|
|
165
|
+
message: 'Ctrl+A',
|
|
166
|
+
},
|
|
167
|
+
skyux_text_editor_menubar_dropdown_button_edit_label: { message: 'Edit' },
|
|
168
|
+
skyux_text_editor_menubar_dropdown_button_format_label: {
|
|
169
|
+
message: 'Format',
|
|
170
|
+
},
|
|
171
|
+
skyux_text_editor_menubar_dropdown_button_insert_label: {
|
|
172
|
+
message: 'Insert merge field',
|
|
173
|
+
},
|
|
174
|
+
skyux_text_editor_url_modal_header_label: { message: 'Create link' },
|
|
175
|
+
skyux_text_editor_url_modal_url_label: {
|
|
176
|
+
message: 'Enter a URL to link to:',
|
|
177
|
+
},
|
|
178
|
+
skyux_text_editor_url_modal_open_label: {
|
|
179
|
+
message: 'Where should it open?',
|
|
180
|
+
},
|
|
181
|
+
skyux_text_editor_url_modal_current_option_label: {
|
|
182
|
+
message: 'Current window',
|
|
183
|
+
},
|
|
184
|
+
skyux_text_editor_url_modal_new_option_label: { message: 'New window' },
|
|
185
|
+
skyux_text_editor_url_modal_email_label: { message: 'Email address' },
|
|
186
|
+
skyux_text_editor_url_modal_subject_label: { message: 'Subject line' },
|
|
187
|
+
skyux_text_editor_url_modal_save_button_label: { message: 'Save' },
|
|
188
|
+
skyux_text_editor_url_modal_cancel_button_label: { message: 'Cancel' },
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
class SkyTextEditorResourcesProvider {
|
|
192
|
+
getString(localeInfo, name) {
|
|
193
|
+
return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Import into any component library module that needs to use resource strings.
|
|
198
|
+
*/
|
|
199
|
+
class SkyTextEditorResourcesModule {
|
|
200
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
201
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorResourcesModule, exports: [SkyI18nModule] }); }
|
|
202
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorResourcesModule, providers: [
|
|
203
|
+
{
|
|
204
|
+
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
205
|
+
useClass: SkyTextEditorResourcesProvider,
|
|
206
|
+
multi: true,
|
|
207
|
+
},
|
|
208
|
+
], imports: [SkyI18nModule] }); }
|
|
209
|
+
}
|
|
210
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorResourcesModule, decorators: [{
|
|
211
|
+
type: NgModule,
|
|
212
|
+
args: [{
|
|
213
|
+
exports: [SkyI18nModule],
|
|
214
|
+
providers: [
|
|
215
|
+
{
|
|
216
|
+
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
217
|
+
useClass: SkyTextEditorResourcesProvider,
|
|
218
|
+
multi: true,
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
}]
|
|
222
|
+
}] });
|
|
223
|
+
|
|
224
|
+
// Need to add the following to classes which contain static methods.
|
|
225
|
+
// See: https://github.com/ng-packagr/ng-packagr/issues/641
|
|
226
|
+
// @dynamic
|
|
227
|
+
class SkyFormsUtility {
|
|
228
|
+
/** Coerces a data-bound value (typically a string) to a boolean. */
|
|
229
|
+
static coerceBooleanProperty(value) {
|
|
230
|
+
return value !== undefined && `${value}` !== 'false';
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @internal
|
|
236
|
+
*/
|
|
237
|
+
const FONT_LIST_DEFAULTS = [
|
|
238
|
+
{
|
|
239
|
+
name: 'Blackbaud Sans',
|
|
240
|
+
value: '"Blackbaud Sans", Arial, sans-serif',
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'Arial',
|
|
244
|
+
value: 'Arial',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: 'Arial Black',
|
|
248
|
+
value: '"Arial Black"',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
name: 'Courier New',
|
|
252
|
+
value: '"Courier New"',
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: 'Georgia',
|
|
256
|
+
value: 'Georgia, serif',
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
name: 'Tahoma',
|
|
260
|
+
value: 'Tahoma, Geneva, sans-serif',
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: 'Times New Roman',
|
|
264
|
+
value: '"Times New Roman"',
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
name: 'Trebuchet MS',
|
|
268
|
+
value: '"Trebuchet MS", sans-serif',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
name: 'Verdana',
|
|
272
|
+
value: 'Verdana, Geneva, sans-serif',
|
|
273
|
+
},
|
|
274
|
+
];
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* @internal
|
|
278
|
+
*/
|
|
279
|
+
const STYLE_STATE_DEFAULTS = {
|
|
280
|
+
backColor: 'rgba(0, 0, 0, 0)',
|
|
281
|
+
fontColor: '#000',
|
|
282
|
+
fontSize: 14,
|
|
283
|
+
font: FONT_LIST_DEFAULTS[0].value,
|
|
284
|
+
boldState: false,
|
|
285
|
+
italicState: false,
|
|
286
|
+
underlineState: false,
|
|
287
|
+
linkState: false,
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* @internal
|
|
292
|
+
*/
|
|
293
|
+
var UrlTarget;
|
|
294
|
+
(function (UrlTarget) {
|
|
295
|
+
UrlTarget[UrlTarget["None"] = 0] = "None";
|
|
296
|
+
UrlTarget[UrlTarget["NewWindow"] = 1] = "NewWindow";
|
|
297
|
+
})(UrlTarget || (UrlTarget = {}));
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* @internal
|
|
301
|
+
*/
|
|
302
|
+
class SkyTextEditorSelectionService {
|
|
303
|
+
isElementSelected(documentEl, element) {
|
|
304
|
+
const selectedNode = this.getCurrentSelection(documentEl)?.anchorNode;
|
|
305
|
+
/* istanbul ignore next */
|
|
306
|
+
return !!(selectedNode &&
|
|
307
|
+
(element.contains(selectedNode) ||
|
|
308
|
+
(selectedNode.parentNode && element.contains(selectedNode.parentNode))));
|
|
309
|
+
}
|
|
310
|
+
getCurrentSelection(documentEl) {
|
|
311
|
+
return documentEl.getSelection();
|
|
312
|
+
}
|
|
313
|
+
getCurrentSelectionParentElement(documentEl) {
|
|
314
|
+
const selection = this.getCurrentSelection(documentEl);
|
|
315
|
+
let selectedEl;
|
|
316
|
+
/* istanbul ignore else */
|
|
317
|
+
if (selection &&
|
|
318
|
+
selection.getRangeAt &&
|
|
319
|
+
selection.getRangeAt(0).commonAncestorContainer) {
|
|
320
|
+
selectedEl = selection.getRangeAt(0).commonAncestorContainer;
|
|
321
|
+
selectedEl =
|
|
322
|
+
selectedEl.nodeType !== 1 ? selectedEl.parentElement : selectedEl;
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
return undefined;
|
|
326
|
+
}
|
|
327
|
+
return selectedEl;
|
|
328
|
+
}
|
|
329
|
+
getCurrentSelectionRange(documentEl, windowEl) {
|
|
330
|
+
/* istanbul ignore else */
|
|
331
|
+
if (windowEl.getSelection) {
|
|
332
|
+
const sel = windowEl.getSelection();
|
|
333
|
+
/* istanbul ignore else */
|
|
334
|
+
if (sel && sel.getRangeAt && sel.rangeCount) {
|
|
335
|
+
return sel.getRangeAt(0);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
else if (documentEl.getSelection()?.getRangeAt) {
|
|
339
|
+
return documentEl.getSelection()?.getRangeAt(0);
|
|
340
|
+
}
|
|
341
|
+
/* istanbul ignore next */
|
|
342
|
+
return undefined;
|
|
343
|
+
}
|
|
344
|
+
selectElement(documentEl, windowEl, element) {
|
|
345
|
+
/* istanbul ignore else */
|
|
346
|
+
if (element) {
|
|
347
|
+
/* istanbul ignore else */
|
|
348
|
+
if (windowEl.getSelection) {
|
|
349
|
+
const sel = windowEl.getSelection();
|
|
350
|
+
sel?.removeAllRanges();
|
|
351
|
+
const range = documentEl.createRange();
|
|
352
|
+
range.selectNodeContents(element);
|
|
353
|
+
sel?.addRange(range);
|
|
354
|
+
}
|
|
355
|
+
else if (documentEl.getSelection) {
|
|
356
|
+
const sel = documentEl.getSelection();
|
|
357
|
+
sel?.removeAllRanges();
|
|
358
|
+
const range = documentEl.createRange();
|
|
359
|
+
range.selectNodeContents(element);
|
|
360
|
+
sel?.addRange(range);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorSelectionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
365
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorSelectionService }); }
|
|
366
|
+
}
|
|
367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorSelectionService, decorators: [{
|
|
368
|
+
type: Injectable
|
|
369
|
+
}] });
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* @internal
|
|
373
|
+
*/
|
|
374
|
+
class SkyTextEditorService {
|
|
375
|
+
/**
|
|
376
|
+
* A dictionary representing all active text editors and their settings.
|
|
377
|
+
*/
|
|
378
|
+
set editor(value) {
|
|
379
|
+
this.#editor = value;
|
|
380
|
+
}
|
|
381
|
+
get editor() {
|
|
382
|
+
if (!this.#editor) {
|
|
383
|
+
throw new Error('Editor has not been initialized.');
|
|
384
|
+
}
|
|
385
|
+
return this.#editor;
|
|
386
|
+
}
|
|
387
|
+
get isInitialized() {
|
|
388
|
+
return this.#editor !== undefined;
|
|
389
|
+
}
|
|
390
|
+
#editor;
|
|
391
|
+
/**
|
|
392
|
+
* Returns the blur observable from the editor with the corresponding id.
|
|
393
|
+
*/
|
|
394
|
+
blurListener() {
|
|
395
|
+
return this.editor.blurObservable;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Returns the click observable from the editor with the corresponding id.
|
|
399
|
+
*/
|
|
400
|
+
clickListener() {
|
|
401
|
+
return this.editor.clickObservable;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Returns the command change observable from the editor with the corresponding id.
|
|
405
|
+
*/
|
|
406
|
+
commandChangeListener() {
|
|
407
|
+
return this.editor.commandChangeObservable;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Returns the input change observable from the editor with the corresponding id.
|
|
411
|
+
*/
|
|
412
|
+
inputListener() {
|
|
413
|
+
return this.editor.inputObservable;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Returns the selection change observable from the editor with the corresponding id.
|
|
417
|
+
*/
|
|
418
|
+
selectionChangeListener() {
|
|
419
|
+
return this.editor.selectionChangeObservable;
|
|
420
|
+
}
|
|
421
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
422
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorService }); }
|
|
423
|
+
}
|
|
424
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorService, decorators: [{
|
|
425
|
+
type: Injectable
|
|
426
|
+
}] });
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* @internal
|
|
430
|
+
*/
|
|
431
|
+
class SkyTextEditorAdapterService {
|
|
432
|
+
#selectionService;
|
|
433
|
+
#textEditorService;
|
|
434
|
+
#windowRef;
|
|
435
|
+
constructor(selectionService, textEditorService, windowService) {
|
|
436
|
+
this.#selectionService = selectionService;
|
|
437
|
+
this.#textEditorService = textEditorService;
|
|
438
|
+
this.#windowRef = windowService;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Creates a text editor inside the supplied iframe element.
|
|
442
|
+
*/
|
|
443
|
+
initEditor(id, iframeElement, styleState, placeholder) {
|
|
444
|
+
this.#textEditorService.editor = this.#createObservers(iframeElement);
|
|
445
|
+
const documentEl = this.#getIframeDocumentEl();
|
|
446
|
+
const styleEl = documentEl.createElement('style');
|
|
447
|
+
styleEl.innerHTML = `.editor:empty:before {
|
|
448
|
+
content: attr(data-placeholder);
|
|
449
|
+
font-family: "Blackbaud Sans", Arial, sans-serif;
|
|
450
|
+
color: #686c73;
|
|
451
|
+
font-weight: 400;
|
|
452
|
+
font-size: 15px;
|
|
453
|
+
font-style: italic;
|
|
454
|
+
}`;
|
|
455
|
+
documentEl.head.appendChild(styleEl);
|
|
456
|
+
const style = {
|
|
457
|
+
...STYLE_STATE_DEFAULTS,
|
|
458
|
+
...styleState,
|
|
459
|
+
};
|
|
460
|
+
const bodyStyle = `background-color: ${style.backColor};
|
|
461
|
+
color: ${style.fontColor};
|
|
462
|
+
font-family: ${style.font};
|
|
463
|
+
font-size: ${style.fontSize}px`;
|
|
464
|
+
documentEl.querySelector('html')?.setAttribute('lang', 'en');
|
|
465
|
+
documentEl.body.setAttribute('contenteditable', 'true');
|
|
466
|
+
documentEl.body.setAttribute('id', id);
|
|
467
|
+
documentEl.body.setAttribute('role', 'main');
|
|
468
|
+
documentEl.body.setAttribute('class', 'editor');
|
|
469
|
+
documentEl.body.setAttribute('style', bodyStyle);
|
|
470
|
+
documentEl.body.setAttribute('data-placeholder', placeholder || '');
|
|
471
|
+
}
|
|
472
|
+
disableEditor(focusableChildren, textEditorNativeElement) {
|
|
473
|
+
this.#setEditorDisabled(focusableChildren, textEditorNativeElement, true);
|
|
474
|
+
}
|
|
475
|
+
enableEditor(focusableChildren, textEditorNativeElement) {
|
|
476
|
+
this.#setEditorDisabled(focusableChildren, textEditorNativeElement, false);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Executes a command on the text editor with the corresponding id.
|
|
480
|
+
*/
|
|
481
|
+
execCommand(editorCommand) {
|
|
482
|
+
/* istanbul ignore else */
|
|
483
|
+
if (this.#textEditorService.editor) {
|
|
484
|
+
const documentEl = this.#getIframeDocumentEl();
|
|
485
|
+
/* istanbul ignore else */
|
|
486
|
+
if (this.editorSelected()) {
|
|
487
|
+
documentEl.execCommand(editorCommand.command, false, editorCommand.value);
|
|
488
|
+
this.focusEditor();
|
|
489
|
+
this.#textEditorService.editor.commandChangeObservable.next();
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
getCurrentSelection() {
|
|
494
|
+
return this.#selectionService.getCurrentSelection(this.#getIframeDocumentEl());
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Returns a data URI using the provided text string.
|
|
498
|
+
* Used to display a merge field inside a string of text.
|
|
499
|
+
*/
|
|
500
|
+
getMergeFieldDataURI(text) {
|
|
501
|
+
const documentEl = this.#windowRef.nativeWindow.document;
|
|
502
|
+
let textToUse = text;
|
|
503
|
+
if (text.length > 18) {
|
|
504
|
+
textToUse = text.substr(0, 15) + '...';
|
|
505
|
+
}
|
|
506
|
+
const canvasElement = documentEl.createElement('canvas');
|
|
507
|
+
canvasElement.setAttribute('height', '20');
|
|
508
|
+
canvasElement.setAttribute('width', '100');
|
|
509
|
+
canvasElement.style.backgroundColor = 'tan';
|
|
510
|
+
canvasElement.style.border = '1px solid #000000';
|
|
511
|
+
canvasElement.style.borderRadius = '5px';
|
|
512
|
+
const context = canvasElement.getContext('2d');
|
|
513
|
+
context.font = '12px Arial';
|
|
514
|
+
context.textAlign = 'center';
|
|
515
|
+
context.fillText(textToUse, 50, 15);
|
|
516
|
+
context.globalCompositeOperation = 'destination-over';
|
|
517
|
+
context.fillStyle = '#00FFFF';
|
|
518
|
+
context.fillRect(0, 0, 100, 20);
|
|
519
|
+
context.globalCompositeOperation = 'source-over';
|
|
520
|
+
context.lineWidth = 2;
|
|
521
|
+
context.strokeStyle = '#FF0000';
|
|
522
|
+
context.strokeRect(0, 0, 100, 20);
|
|
523
|
+
const result = canvasElement.toDataURL('image/png', 1.0);
|
|
524
|
+
return result;
|
|
525
|
+
}
|
|
526
|
+
getStyleState() {
|
|
527
|
+
const documentEl = this.#getIframeDocumentEl();
|
|
528
|
+
/* istanbul ignore else */
|
|
529
|
+
if (this.editorSelected()) {
|
|
530
|
+
return {
|
|
531
|
+
backColor: this.#getColor(documentEl, 'BackColor'),
|
|
532
|
+
fontColor: this.#getColor(documentEl, 'ForeColor'),
|
|
533
|
+
fontSize: parseInt(this.#getFontSize(), undefined),
|
|
534
|
+
font: documentEl.queryCommandValue('fontname'),
|
|
535
|
+
boldState: documentEl.queryCommandState('Bold'),
|
|
536
|
+
italicState: documentEl.queryCommandState('Italic'),
|
|
537
|
+
underlineState: documentEl.queryCommandState('Underline'),
|
|
538
|
+
linkState: this.#hasLink(),
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
/* istanbul ignore next */
|
|
542
|
+
return {};
|
|
543
|
+
}
|
|
544
|
+
getEditorInnerHtml() {
|
|
545
|
+
const documentEl = this.#getIframeDocumentEl();
|
|
546
|
+
if (documentEl) {
|
|
547
|
+
return this.#replaceHtmlCodes(documentEl.body.innerHTML);
|
|
548
|
+
}
|
|
549
|
+
return '';
|
|
550
|
+
}
|
|
551
|
+
setEditorInnerHtml(value) {
|
|
552
|
+
const documentEl = this.#getIframeDocumentEl();
|
|
553
|
+
const editorContent = documentEl.body;
|
|
554
|
+
/* istanbul ignore else */
|
|
555
|
+
if (editorContent.innerHTML !== value) {
|
|
556
|
+
editorContent.innerHTML = value;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
focusEditor() {
|
|
560
|
+
/* istanbul ignore else */
|
|
561
|
+
if (this.#textEditorService.editor) {
|
|
562
|
+
const windowEl = this.#getContentWindowEl();
|
|
563
|
+
const iframeDocumentEl = this.#getIframeDocumentEl();
|
|
564
|
+
const currentSelection = this.#selectionService.getCurrentSelectionRange(iframeDocumentEl, windowEl);
|
|
565
|
+
const cursorIsNotActiveAndHasReset = currentSelection &&
|
|
566
|
+
currentSelection.startOffset === 0 &&
|
|
567
|
+
currentSelection.endOffset === 0;
|
|
568
|
+
if (!this.editorSelected() || cursorIsNotActiveAndHasReset) {
|
|
569
|
+
// focus the end of the editor
|
|
570
|
+
const documentEl = this.#windowRef.nativeWindow.document;
|
|
571
|
+
const editor = iframeDocumentEl.body;
|
|
572
|
+
const range = documentEl.createRange();
|
|
573
|
+
this.#textEditorService.editor.iframeElementRef.focus();
|
|
574
|
+
editor.focus();
|
|
575
|
+
if (windowEl.getSelection && documentEl.createRange) {
|
|
576
|
+
range.selectNodeContents(editor);
|
|
577
|
+
range.collapse(false);
|
|
578
|
+
const sel = windowEl.getSelection();
|
|
579
|
+
sel?.removeAllRanges();
|
|
580
|
+
sel?.addRange(range);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
// Cursor may not be active, restore it
|
|
585
|
+
this.#textEditorService.editor.iframeElementRef.focus();
|
|
586
|
+
iframeDocumentEl.body.focus();
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
getLink() {
|
|
591
|
+
let link;
|
|
592
|
+
const anchorEl = this.getSelectedAnchorTag();
|
|
593
|
+
if (anchorEl && anchorEl.href) {
|
|
594
|
+
link = {
|
|
595
|
+
target: anchorEl.getAttribute('target') === '_blank'
|
|
596
|
+
? UrlTarget.NewWindow
|
|
597
|
+
: UrlTarget.None,
|
|
598
|
+
url: anchorEl.href,
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
return link;
|
|
602
|
+
}
|
|
603
|
+
getSelectedAnchorTag() {
|
|
604
|
+
const selectedEl = this.#getCurrentSelectionParentElement();
|
|
605
|
+
if (selectedEl) {
|
|
606
|
+
return this.#getParent(selectedEl, 'a');
|
|
607
|
+
}
|
|
608
|
+
/* istanbul ignore next */
|
|
609
|
+
return undefined;
|
|
610
|
+
}
|
|
611
|
+
saveSelection() {
|
|
612
|
+
return this.#selectionService.getCurrentSelectionRange(this.#getIframeDocumentEl(), this.#getContentWindowEl());
|
|
613
|
+
}
|
|
614
|
+
selectElement(element) {
|
|
615
|
+
this.#selectionService.selectElement(this.#getIframeDocumentEl(), this.#getContentWindowEl(), element);
|
|
616
|
+
}
|
|
617
|
+
setPlaceholder(placeholder) {
|
|
618
|
+
const documentEl = this.#getIframeDocumentEl();
|
|
619
|
+
documentEl.body.setAttribute('data-placeholder', placeholder || '');
|
|
620
|
+
}
|
|
621
|
+
setFontSize(fontSize) {
|
|
622
|
+
const doc = this.#getIframeDocumentEl();
|
|
623
|
+
this.execCommand({ command: 'fontSize', value: '1' });
|
|
624
|
+
const fontElements = Array.from(doc.querySelectorAll('font[size="1"]'));
|
|
625
|
+
for (const element of fontElements) {
|
|
626
|
+
element.removeAttribute('size');
|
|
627
|
+
element.style.fontSize = fontSize + 'px';
|
|
628
|
+
}
|
|
629
|
+
this.#cleanUpBlankStyleTags(doc);
|
|
630
|
+
this.focusEditor();
|
|
631
|
+
this.#textEditorService.editor.commandChangeObservable.next();
|
|
632
|
+
}
|
|
633
|
+
removeObservers(setting) {
|
|
634
|
+
/* istanbul ignore next */
|
|
635
|
+
const documentEl = setting.iframeElementRef.contentWindow
|
|
636
|
+
? setting.iframeElementRef.contentWindow.document
|
|
637
|
+
: setting.iframeElementRef.contentDocument;
|
|
638
|
+
setting.selectionChangeObservable.complete();
|
|
639
|
+
setting.clickObservable.complete();
|
|
640
|
+
setting.commandChangeObservable.complete();
|
|
641
|
+
if (documentEl) {
|
|
642
|
+
documentEl.removeEventListener('selectionchange', setting.selectionListener);
|
|
643
|
+
documentEl.removeEventListener('input', setting.selectionListener);
|
|
644
|
+
documentEl.removeEventListener('mousedown', setting.clickListener);
|
|
645
|
+
documentEl.body.removeEventListener('paste', setting.pasteListener);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
#getContentWindowEl() {
|
|
649
|
+
return this.#textEditorService.editor.iframeElementRef
|
|
650
|
+
.contentWindow;
|
|
651
|
+
}
|
|
652
|
+
#getChildSelectedAnchorTags() {
|
|
653
|
+
const selectedRange = this.getCurrentSelection()?.getRangeAt(0);
|
|
654
|
+
if (selectedRange && selectedRange.toString().length <= 0) {
|
|
655
|
+
return [];
|
|
656
|
+
}
|
|
657
|
+
const parentElement = this.#getCurrentSelectionParentElement();
|
|
658
|
+
let childElements = [];
|
|
659
|
+
/* istanbul ignore else */
|
|
660
|
+
if (parentElement) {
|
|
661
|
+
childElements = Array.from(parentElement.querySelectorAll('a'));
|
|
662
|
+
}
|
|
663
|
+
/* istanbul ignore next */
|
|
664
|
+
return childElements.filter((element) => {
|
|
665
|
+
// IE specific
|
|
666
|
+
if (selectedRange) {
|
|
667
|
+
if (!selectedRange.intersectsNode) {
|
|
668
|
+
if (!element || !element.href) {
|
|
669
|
+
return false;
|
|
670
|
+
}
|
|
671
|
+
const tempRange = document.createRange();
|
|
672
|
+
tempRange.selectNodeContents(element);
|
|
673
|
+
return ((selectedRange.compareBoundaryPoints(Range.START_TO_START, tempRange) !== -1 &&
|
|
674
|
+
selectedRange.compareBoundaryPoints(Range.START_TO_END, tempRange) !== 1) ||
|
|
675
|
+
(selectedRange.compareBoundaryPoints(Range.END_TO_START, tempRange) !== -1 &&
|
|
676
|
+
selectedRange.compareBoundaryPoints(Range.END_TO_END, tempRange) !== 1));
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
// Normal non-IE
|
|
680
|
+
return (!!element && !!element.href && selectedRange?.intersectsNode(element));
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
#getIframeDocumentEl() {
|
|
684
|
+
const contentWindowEl = this.#getContentWindowEl();
|
|
685
|
+
/* istanbul ignore else */
|
|
686
|
+
if (contentWindowEl) {
|
|
687
|
+
return contentWindowEl.document;
|
|
688
|
+
}
|
|
689
|
+
/* istanbul ignore next */
|
|
690
|
+
return this.#textEditorService.editor.iframeElementRef
|
|
691
|
+
.contentDocument;
|
|
692
|
+
}
|
|
693
|
+
#getFontSize() {
|
|
694
|
+
let fontSize = STYLE_STATE_DEFAULTS.fontSize.toString();
|
|
695
|
+
const selection = this.getCurrentSelection();
|
|
696
|
+
/* istanbul ignore else */
|
|
697
|
+
if (selection &&
|
|
698
|
+
selection.anchorNode &&
|
|
699
|
+
selection.anchorNode.parentElement) {
|
|
700
|
+
let element = selection.anchorNode;
|
|
701
|
+
if (element?.nodeType !== 1) {
|
|
702
|
+
element = element?.parentElement;
|
|
703
|
+
}
|
|
704
|
+
const computedStyle = window.getComputedStyle(element);
|
|
705
|
+
/* istanbul ignore else */
|
|
706
|
+
if (computedStyle) {
|
|
707
|
+
fontSize = computedStyle.getPropertyValue('font-size');
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
return fontSize;
|
|
711
|
+
}
|
|
712
|
+
#createObservers(element) {
|
|
713
|
+
/* istanbul ignore next */
|
|
714
|
+
const documentEl = element.contentWindow
|
|
715
|
+
? element.contentWindow.document
|
|
716
|
+
: element.contentDocument;
|
|
717
|
+
// Firefox bug where we need to open/close to cancel load so it doesn't overwrite attrs
|
|
718
|
+
documentEl.open();
|
|
719
|
+
documentEl.close();
|
|
720
|
+
const selectionObservable = new Subject();
|
|
721
|
+
const selectionListener = () => selectionObservable.next();
|
|
722
|
+
const clickObservable = new Subject();
|
|
723
|
+
const clickListener = () => clickObservable.next();
|
|
724
|
+
const pasteListener = this.#getPasteOverride();
|
|
725
|
+
const blurObservable = new Subject();
|
|
726
|
+
const blurListener = () => blurObservable.next();
|
|
727
|
+
const inputObservable = new Subject();
|
|
728
|
+
const inputListener = () => inputObservable.next();
|
|
729
|
+
documentEl.addEventListener('selectionchange', selectionListener);
|
|
730
|
+
documentEl.addEventListener('input', inputListener);
|
|
731
|
+
documentEl.addEventListener('mousedown', clickListener);
|
|
732
|
+
documentEl.body.addEventListener('paste', pasteListener);
|
|
733
|
+
documentEl.body.addEventListener('blur', blurListener);
|
|
734
|
+
return {
|
|
735
|
+
blurObservable,
|
|
736
|
+
clickObservable,
|
|
737
|
+
commandChangeObservable: new Subject(),
|
|
738
|
+
iframeElementRef: element,
|
|
739
|
+
inputObservable,
|
|
740
|
+
selectionChangeObservable: selectionObservable,
|
|
741
|
+
blurListener,
|
|
742
|
+
clickListener,
|
|
743
|
+
inputListener,
|
|
744
|
+
pasteListener,
|
|
745
|
+
selectionListener,
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
#getPasteOverride() {
|
|
749
|
+
/* istanbul ignore next */
|
|
750
|
+
return (e) => {
|
|
751
|
+
e.preventDefault();
|
|
752
|
+
const text = e.clipboardData?.getData('text/plain');
|
|
753
|
+
if (text !== undefined) {
|
|
754
|
+
this.execCommand({ command: 'insertHTML', value: text.toString() });
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
#getCurrentSelectionParentElement() {
|
|
759
|
+
return this.#selectionService.getCurrentSelectionParentElement(this.#getIframeDocumentEl());
|
|
760
|
+
}
|
|
761
|
+
#getColor(documentEl, selector) {
|
|
762
|
+
const commandValue = documentEl.queryCommandValue(selector);
|
|
763
|
+
// Edge is weird and returns numbers
|
|
764
|
+
/* istanbul ignore if */
|
|
765
|
+
if (typeof commandValue === 'number') {
|
|
766
|
+
/* istanbul ignore next */
|
|
767
|
+
return ('rgb(' +
|
|
768
|
+
(commandValue & 0xff) +
|
|
769
|
+
', ' +
|
|
770
|
+
((commandValue & 0xff00) >> 8) +
|
|
771
|
+
', ' +
|
|
772
|
+
((commandValue & 0xff0000) >> 16) +
|
|
773
|
+
')');
|
|
774
|
+
}
|
|
775
|
+
// Firefox uses 'Transparent' instead of a color value
|
|
776
|
+
/* istanbul ignore next */
|
|
777
|
+
if (commandValue.toString().toLowerCase() === 'transparent') {
|
|
778
|
+
return STYLE_STATE_DEFAULTS.backColor;
|
|
779
|
+
}
|
|
780
|
+
return commandValue;
|
|
781
|
+
}
|
|
782
|
+
#hasLink() {
|
|
783
|
+
const anchorEl = this.getSelectedAnchorTag();
|
|
784
|
+
const childAnchorEls = this.#getChildSelectedAnchorTags();
|
|
785
|
+
/* istanbul ignore next */
|
|
786
|
+
return childAnchorEls.length > 0 || (!!anchorEl && !!anchorEl.href);
|
|
787
|
+
}
|
|
788
|
+
#getParent(element, tag) {
|
|
789
|
+
let currentNode = element;
|
|
790
|
+
while (currentNode && currentNode.tagName.toUpperCase() !== 'BODY') {
|
|
791
|
+
if (currentNode.tagName.toUpperCase() === tag.toUpperCase()) {
|
|
792
|
+
return currentNode;
|
|
793
|
+
}
|
|
794
|
+
currentNode = currentNode.parentElement;
|
|
795
|
+
}
|
|
796
|
+
return undefined;
|
|
797
|
+
}
|
|
798
|
+
editorSelected() {
|
|
799
|
+
const documentEl = this.#getIframeDocumentEl();
|
|
800
|
+
return this.#selectionService.isElementSelected(documentEl, documentEl.body);
|
|
801
|
+
}
|
|
802
|
+
#cleanUpBlankStyleTags(doc) {
|
|
803
|
+
const orphanElements = Array.from(doc.querySelectorAll('font,span,*[style=""]'));
|
|
804
|
+
for (const element of orphanElements) {
|
|
805
|
+
if (!element.getAttribute('style')) {
|
|
806
|
+
element.removeAttribute('style');
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
const removableElements = orphanElements.filter((element) => {
|
|
810
|
+
const tagName = element.tagName.toUpperCase();
|
|
811
|
+
return ((tagName === 'FONT' || tagName === 'SPAN') &&
|
|
812
|
+
(element.attributes.length === 0 || !element.hasChildNodes));
|
|
813
|
+
});
|
|
814
|
+
for (const element of removableElements) {
|
|
815
|
+
const parent = element.parentNode;
|
|
816
|
+
/* istanbul ignore else */
|
|
817
|
+
if (parent) {
|
|
818
|
+
while (element.firstChild) {
|
|
819
|
+
parent.insertBefore(element.firstChild, element);
|
|
820
|
+
}
|
|
821
|
+
parent.removeChild(element);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
// Certain values are encoded in html and need to be decoded
|
|
826
|
+
#replaceHtmlCodes(str) {
|
|
827
|
+
return str
|
|
828
|
+
.replace(/ /, String.fromCharCode(160))
|
|
829
|
+
.replace(/</g, '<')
|
|
830
|
+
.replace(/>/g, '>')
|
|
831
|
+
.replace(/&/g, '&');
|
|
832
|
+
}
|
|
833
|
+
#setEditorDisabled(focusableChildren, textEditorNativeElement, disabled) {
|
|
834
|
+
textEditorNativeElement.style.pointerEvents = disabled ? 'none' : 'auto';
|
|
835
|
+
textEditorNativeElement.setAttribute('aria-disabled', disabled ? 'true' : 'false');
|
|
836
|
+
/* istanbul ignore else */
|
|
837
|
+
if (focusableChildren.length > 0) {
|
|
838
|
+
focusableChildren.forEach((aFocusableChild) => {
|
|
839
|
+
aFocusableChild.tabIndex = disabled ? -1 : 0;
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
this.#getIframeDocumentEl().body.setAttribute('contenteditable', disabled ? 'false' : 'true');
|
|
843
|
+
}
|
|
844
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorAdapterService, deps: [{ token: SkyTextEditorSelectionService }, { token: SkyTextEditorService }, { token: i1$1.SkyAppWindowRef }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
845
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorAdapterService }); }
|
|
846
|
+
}
|
|
847
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorAdapterService, decorators: [{
|
|
848
|
+
type: Injectable
|
|
849
|
+
}], ctorParameters: function () { return [{ type: SkyTextEditorSelectionService }, { type: SkyTextEditorService }, { type: i1$1.SkyAppWindowRef }]; } });
|
|
850
|
+
|
|
851
|
+
const FORMAT_MENU_ACTION = 'skyux_text_editor_format_menu_action_';
|
|
852
|
+
const EDIT_MENU_ACTION = 'skyux_text_editor_edit_menu_action_';
|
|
853
|
+
/**
|
|
854
|
+
* @internal
|
|
855
|
+
*/
|
|
856
|
+
class SkyTextEditorMenubarComponent {
|
|
857
|
+
set disabled(value) {
|
|
858
|
+
const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);
|
|
859
|
+
if (coercedValue !== this.disabled) {
|
|
860
|
+
this.#_disabled = coercedValue;
|
|
861
|
+
this.#changeDetector.markForCheck();
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
get disabled() {
|
|
865
|
+
return this.#_disabled;
|
|
866
|
+
}
|
|
867
|
+
#_disabled;
|
|
868
|
+
#ngUnsubscribe;
|
|
869
|
+
#adapterService;
|
|
870
|
+
#changeDetector;
|
|
871
|
+
#resources;
|
|
872
|
+
constructor(adapterService, changeDetector, resources) {
|
|
873
|
+
this.editorFocusStream = new Subject();
|
|
874
|
+
this.menus = [];
|
|
875
|
+
this.mergeFields = [];
|
|
876
|
+
this.#_disabled = false;
|
|
877
|
+
this.editDropdownStream = new Subject();
|
|
878
|
+
this.formatDropdownStream = new Subject();
|
|
879
|
+
this.mergeFieldDropdownStream = new Subject();
|
|
880
|
+
this.#ngUnsubscribe = new Subject();
|
|
881
|
+
this.#adapterService = adapterService;
|
|
882
|
+
this.#changeDetector = changeDetector;
|
|
883
|
+
this.#resources = resources;
|
|
884
|
+
}
|
|
885
|
+
ngOnInit() {
|
|
886
|
+
this.editorFocusStream
|
|
887
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
888
|
+
.subscribe(() => {
|
|
889
|
+
this.#closeDropdowns();
|
|
890
|
+
});
|
|
891
|
+
this.#resources
|
|
892
|
+
.getStrings({
|
|
893
|
+
bold: FORMAT_MENU_ACTION + 'bold_label',
|
|
894
|
+
boldShort: FORMAT_MENU_ACTION + 'bold_key_shortcut',
|
|
895
|
+
italic: FORMAT_MENU_ACTION + 'italic_label',
|
|
896
|
+
italicShort: FORMAT_MENU_ACTION + 'italic_key_shortcut',
|
|
897
|
+
underline: FORMAT_MENU_ACTION + 'underline_label',
|
|
898
|
+
underlineShort: FORMAT_MENU_ACTION + 'underline_key_shortcut',
|
|
899
|
+
strikethrough: FORMAT_MENU_ACTION + 'strikethrough_label',
|
|
900
|
+
clearFormatting: FORMAT_MENU_ACTION + 'clear_formatting_label',
|
|
901
|
+
undo: EDIT_MENU_ACTION + 'undo_label',
|
|
902
|
+
undoShort: EDIT_MENU_ACTION + 'undo_key_shortcut',
|
|
903
|
+
redo: EDIT_MENU_ACTION + 'redo_label',
|
|
904
|
+
redoShort: EDIT_MENU_ACTION + 'redo_key_shortcut',
|
|
905
|
+
cut: EDIT_MENU_ACTION + 'cut_label',
|
|
906
|
+
cutShort: EDIT_MENU_ACTION + 'cut_key_shortcut',
|
|
907
|
+
copy: EDIT_MENU_ACTION + 'copy_label',
|
|
908
|
+
copyShort: EDIT_MENU_ACTION + 'copy_key_shortcut',
|
|
909
|
+
paste: EDIT_MENU_ACTION + 'paste_label',
|
|
910
|
+
pasteShort: EDIT_MENU_ACTION + 'paste_key_shortcut',
|
|
911
|
+
selectAll: EDIT_MENU_ACTION + 'select_all_label',
|
|
912
|
+
selectAllShort: EDIT_MENU_ACTION + 'select_all_key_shortcut',
|
|
913
|
+
})
|
|
914
|
+
.pipe(take(1), takeUntil(this.#ngUnsubscribe))
|
|
915
|
+
.subscribe((resources) => {
|
|
916
|
+
this.formatItems = [
|
|
917
|
+
{
|
|
918
|
+
function: () => this.execCommand('bold'),
|
|
919
|
+
label: resources.bold,
|
|
920
|
+
keyShortcut: resources.boldShort,
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
function: () => this.execCommand('italic'),
|
|
924
|
+
label: resources.italic,
|
|
925
|
+
keyShortcut: resources.italicShort,
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
function: () => this.execCommand('underline'),
|
|
929
|
+
label: resources.underline,
|
|
930
|
+
keyShortcut: resources.underlineShort,
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
function: () => this.execCommand('strikethrough'),
|
|
934
|
+
label: resources.strikethrough,
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
isDivider: true,
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
function: () => this.#clearFormat(),
|
|
941
|
+
label: resources.clearFormatting,
|
|
942
|
+
},
|
|
943
|
+
];
|
|
944
|
+
this.editItems = [
|
|
945
|
+
{
|
|
946
|
+
function: () => this.execCommand('undo'),
|
|
947
|
+
label: resources.undo,
|
|
948
|
+
keyShortcut: resources.undoShort,
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
function: () => this.execCommand('redo'),
|
|
952
|
+
label: resources.redo,
|
|
953
|
+
keyShortcut: resources.redoShort,
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
isDivider: true,
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
function: () => this.execCommand('cut'),
|
|
960
|
+
label: resources.cut,
|
|
961
|
+
keyShortcut: resources.cutShort,
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
function: () => this.execCommand('copy'),
|
|
965
|
+
label: resources.copy,
|
|
966
|
+
keyShortcut: resources.copyShort,
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
function: () => this.execCommand('paste'),
|
|
970
|
+
label: resources.paste,
|
|
971
|
+
keyShortcut: resources.pasteShort,
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
isDivider: true,
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
function: () => this.execCommand('selectAll'),
|
|
978
|
+
label: resources.selectAll,
|
|
979
|
+
keyShortcut: resources.selectAllShort,
|
|
980
|
+
},
|
|
981
|
+
];
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
ngOnDestroy() {
|
|
985
|
+
this.#ngUnsubscribe.next();
|
|
986
|
+
this.#ngUnsubscribe.complete();
|
|
987
|
+
}
|
|
988
|
+
execCommand(command, value = '') {
|
|
989
|
+
this.#adapterService.execCommand({
|
|
990
|
+
command: command,
|
|
991
|
+
value: value,
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
insertMergeField(field) {
|
|
995
|
+
this.execCommand('insertHTML', '<img style="display: inline; cursor: grab;" data-fieldid="' +
|
|
996
|
+
he.escape(field.id) +
|
|
997
|
+
'" data-fielddisplay="' +
|
|
998
|
+
he.escape(field.name) +
|
|
999
|
+
'" src="' +
|
|
1000
|
+
(field.previewImageUrl ||
|
|
1001
|
+
this.#adapterService.getMergeFieldDataURI(field.name)) +
|
|
1002
|
+
'">');
|
|
1003
|
+
}
|
|
1004
|
+
#closeDropdowns() {
|
|
1005
|
+
this.editDropdownStream.next({ type: SkyDropdownMessageType.Close });
|
|
1006
|
+
this.formatDropdownStream.next({ type: SkyDropdownMessageType.Close });
|
|
1007
|
+
this.mergeFieldDropdownStream.next({ type: SkyDropdownMessageType.Close });
|
|
1008
|
+
}
|
|
1009
|
+
#clearFormat() {
|
|
1010
|
+
const currentSelection = this.#adapterService.getCurrentSelection();
|
|
1011
|
+
/* istanbul ignore else */
|
|
1012
|
+
if (currentSelection &&
|
|
1013
|
+
currentSelection.rangeCount > 0 &&
|
|
1014
|
+
currentSelection.getRangeAt(0).toString().length <= 0) {
|
|
1015
|
+
this.execCommand('selectAll');
|
|
1016
|
+
}
|
|
1017
|
+
this.execCommand('removeFormat');
|
|
1018
|
+
}
|
|
1019
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorMenubarComponent, deps: [{ token: SkyTextEditorAdapterService }, { token: i0.ChangeDetectorRef }, { token: i2.SkyLibResourcesService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1020
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyTextEditorMenubarComponent, selector: "sky-text-editor-menubar", inputs: { editorFocusStream: "editorFocusStream", menus: "menus", mergeFields: "mergeFields", disabled: "disabled" }, ngImport: i0, template: "<sky-toolbar-item\n *ngFor=\"let menu of menus\"\n class=\"sky-text-editor-menu\"\n [ngClass]=\"'sky-text-editor-menu-' + menu\"\n>\n <ng-container [ngSwitch]=\"menu\">\n <ng-container *ngSwitchCase=\"'edit'\">\n <sky-dropdown\n label=\"Edit menu\"\n [disabled]=\"disabled\"\n [messageStream]=\"editDropdownStream\"\n >\n <sky-dropdown-button>\n {{\n 'skyux_text_editor_menubar_dropdown_button_edit_label'\n | skyLibResources\n }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item *ngFor=\"let editItem of editItems\">\n <button\n *ngIf=\"!editItem.isDivider\"\n type=\"button\"\n (click)=\"editItem?.function()\"\n >\n {{ editItem.label }}\n <div\n *ngIf=\"editItem.keyShortcut\"\n class=\"sky-text-editor-menu-key-shortcut\"\n [skyThemeClass]=\"{\n 'sky-font-deemphasized': 'modern',\n 'sky-deemphasized': 'default'\n }\"\n >\n {{ editItem.keyShortcut }}\n </div>\n </button>\n <div\n *ngIf=\"editItem.isDivider\"\n class=\"sky-text-editor-dropdown-item-divider\"\n role=\"divider\"\n ></div>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n </ng-container>\n <ng-container *ngSwitchCase=\"'format'\">\n <sky-dropdown\n label=\"Format menu\"\n [disabled]=\"disabled\"\n [messageStream]=\"formatDropdownStream\"\n >\n <sky-dropdown-button>\n {{\n 'skyux_text_editor_menubar_dropdown_button_format_label'\n | skyLibResources\n }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item *ngFor=\"let formatItem of formatItems\">\n <button\n *ngIf=\"!formatItem.isDivider\"\n type=\"button\"\n (click)=\"formatItem?.function()\"\n >\n {{ formatItem.label }}\n <div\n *ngIf=\"formatItem.keyShortcut\"\n class=\"sky-text-editor-menu-key-shortcut\"\n [skyThemeClass]=\"{\n 'sky-font-deemphasized': 'modern',\n 'sky-deemphasized': 'default'\n }\"\n >\n {{ formatItem.keyShortcut }}\n </div>\n </button>\n <div\n *ngIf=\"formatItem.isDivider\"\n class=\"sky-text-editor-dropdown-item-divider\"\n role=\"divider\"\n ></div>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n </ng-container>\n <ng-container *ngSwitchCase=\"'merge-field'\">\n <sky-dropdown\n *ngIf=\"mergeFields && mergeFields.length > 0\"\n label=\"Insert merge field\"\n [disabled]=\"disabled\"\n [messageStream]=\"mergeFieldDropdownStream\"\n >\n <sky-dropdown-button>\n {{\n 'skyux_text_editor_menubar_dropdown_button_insert_label'\n | skyLibResources\n }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item *ngFor=\"let mergeField of mergeFields\">\n <button type=\"button\" (click)=\"insertMergeField(mergeField)\">\n {{ mergeField.name }}\n </button>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n </ng-container>\n </ng-container>\n</sky-toolbar-item>\n", styles: [".sky-text-editor-dropdown-item-divider{border:0;padding:0;height:1px;margin:9px 1px;overflow:hidden;background:transparent;border-bottom:1px solid rgba(0,0,0,.1);cursor:default;filter:none}.sky-text-editor-menu-key-shortcut{float:right;margin-left:15px}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i4.λ2, selector: "sky-dropdown-button" }, { kind: "component", type: i4.λ3, selector: "sky-dropdown", inputs: ["buttonStyle", "buttonType", "disabled", "dismissOnBlur", "label", "horizontalAlignment", "messageStream", "title", "trigger"] }, { kind: "component", type: i4.λ1, selector: "sky-dropdown-item", inputs: ["ariaRole"] }, { kind: "component", type: i4.λ4, selector: "sky-dropdown-menu", inputs: ["ariaLabelledBy", "ariaRole", "useNativeFocus"], outputs: ["menuChanges"] }, { kind: "directive", type: i5.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }, { kind: "component", type: i7.λ39, selector: "sky-toolbar-item" }, { kind: "pipe", type: i2.SkyLibResourcesPipe, name: "skyLibResources" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1021
|
+
}
|
|
1022
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorMenubarComponent, decorators: [{
|
|
1023
|
+
type: Component,
|
|
1024
|
+
args: [{ selector: 'sky-text-editor-menubar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<sky-toolbar-item\n *ngFor=\"let menu of menus\"\n class=\"sky-text-editor-menu\"\n [ngClass]=\"'sky-text-editor-menu-' + menu\"\n>\n <ng-container [ngSwitch]=\"menu\">\n <ng-container *ngSwitchCase=\"'edit'\">\n <sky-dropdown\n label=\"Edit menu\"\n [disabled]=\"disabled\"\n [messageStream]=\"editDropdownStream\"\n >\n <sky-dropdown-button>\n {{\n 'skyux_text_editor_menubar_dropdown_button_edit_label'\n | skyLibResources\n }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item *ngFor=\"let editItem of editItems\">\n <button\n *ngIf=\"!editItem.isDivider\"\n type=\"button\"\n (click)=\"editItem?.function()\"\n >\n {{ editItem.label }}\n <div\n *ngIf=\"editItem.keyShortcut\"\n class=\"sky-text-editor-menu-key-shortcut\"\n [skyThemeClass]=\"{\n 'sky-font-deemphasized': 'modern',\n 'sky-deemphasized': 'default'\n }\"\n >\n {{ editItem.keyShortcut }}\n </div>\n </button>\n <div\n *ngIf=\"editItem.isDivider\"\n class=\"sky-text-editor-dropdown-item-divider\"\n role=\"divider\"\n ></div>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n </ng-container>\n <ng-container *ngSwitchCase=\"'format'\">\n <sky-dropdown\n label=\"Format menu\"\n [disabled]=\"disabled\"\n [messageStream]=\"formatDropdownStream\"\n >\n <sky-dropdown-button>\n {{\n 'skyux_text_editor_menubar_dropdown_button_format_label'\n | skyLibResources\n }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item *ngFor=\"let formatItem of formatItems\">\n <button\n *ngIf=\"!formatItem.isDivider\"\n type=\"button\"\n (click)=\"formatItem?.function()\"\n >\n {{ formatItem.label }}\n <div\n *ngIf=\"formatItem.keyShortcut\"\n class=\"sky-text-editor-menu-key-shortcut\"\n [skyThemeClass]=\"{\n 'sky-font-deemphasized': 'modern',\n 'sky-deemphasized': 'default'\n }\"\n >\n {{ formatItem.keyShortcut }}\n </div>\n </button>\n <div\n *ngIf=\"formatItem.isDivider\"\n class=\"sky-text-editor-dropdown-item-divider\"\n role=\"divider\"\n ></div>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n </ng-container>\n <ng-container *ngSwitchCase=\"'merge-field'\">\n <sky-dropdown\n *ngIf=\"mergeFields && mergeFields.length > 0\"\n label=\"Insert merge field\"\n [disabled]=\"disabled\"\n [messageStream]=\"mergeFieldDropdownStream\"\n >\n <sky-dropdown-button>\n {{\n 'skyux_text_editor_menubar_dropdown_button_insert_label'\n | skyLibResources\n }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item *ngFor=\"let mergeField of mergeFields\">\n <button type=\"button\" (click)=\"insertMergeField(mergeField)\">\n {{ mergeField.name }}\n </button>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n </ng-container>\n </ng-container>\n</sky-toolbar-item>\n", styles: [".sky-text-editor-dropdown-item-divider{border:0;padding:0;height:1px;margin:9px 1px;overflow:hidden;background:transparent;border-bottom:1px solid rgba(0,0,0,.1);cursor:default;filter:none}.sky-text-editor-menu-key-shortcut{float:right;margin-left:15px}\n"] }]
|
|
1025
|
+
}], ctorParameters: function () { return [{ type: SkyTextEditorAdapterService }, { type: i0.ChangeDetectorRef }, { type: i2.SkyLibResourcesService }]; }, propDecorators: { editorFocusStream: [{
|
|
1026
|
+
type: Input
|
|
1027
|
+
}], menus: [{
|
|
1028
|
+
type: Input
|
|
1029
|
+
}], mergeFields: [{
|
|
1030
|
+
type: Input
|
|
1031
|
+
}], disabled: [{
|
|
1032
|
+
type: Input
|
|
1033
|
+
}] } });
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* @internal
|
|
1037
|
+
*/
|
|
1038
|
+
const FONT_SIZE_LIST_DEFAULTS = [
|
|
1039
|
+
6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 36, 48,
|
|
1040
|
+
];
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* @internal
|
|
1044
|
+
*/
|
|
1045
|
+
const MENU_DEFAULTS = ['edit', 'format'];
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* @internal
|
|
1049
|
+
*/
|
|
1050
|
+
const TOOLBAR_ACTION_DEFAULTS = [
|
|
1051
|
+
'font-family',
|
|
1052
|
+
'font-size',
|
|
1053
|
+
'font-style',
|
|
1054
|
+
'color',
|
|
1055
|
+
'list',
|
|
1056
|
+
'link',
|
|
1057
|
+
];
|
|
1058
|
+
|
|
1059
|
+
/**
|
|
1060
|
+
* @internal
|
|
1061
|
+
*/
|
|
1062
|
+
class SkyUrlModalContext {
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
const emailKey = 'mailto:';
|
|
1066
|
+
const queryStringParamKey = '?Subject=';
|
|
1067
|
+
/**
|
|
1068
|
+
* @internal
|
|
1069
|
+
*/
|
|
1070
|
+
class SkyTextEditorUrlModalComponent {
|
|
1071
|
+
set activeTab(value) {
|
|
1072
|
+
this.#_activeTab = value;
|
|
1073
|
+
this.valid = this.#isValid();
|
|
1074
|
+
}
|
|
1075
|
+
get activeTab() {
|
|
1076
|
+
return this.#_activeTab;
|
|
1077
|
+
}
|
|
1078
|
+
set emailAddress(value) {
|
|
1079
|
+
this.#_emailAddress = value;
|
|
1080
|
+
this.valid = this.#isValid();
|
|
1081
|
+
}
|
|
1082
|
+
get emailAddress() {
|
|
1083
|
+
return this.#_emailAddress;
|
|
1084
|
+
}
|
|
1085
|
+
set url(value) {
|
|
1086
|
+
this.#_url = value;
|
|
1087
|
+
this.valid = this.#isValid();
|
|
1088
|
+
}
|
|
1089
|
+
get url() {
|
|
1090
|
+
return this.#_url;
|
|
1091
|
+
}
|
|
1092
|
+
#modalInstance;
|
|
1093
|
+
#_activeTab;
|
|
1094
|
+
#_emailAddress;
|
|
1095
|
+
#_url;
|
|
1096
|
+
constructor(modalInstance, modalContext) {
|
|
1097
|
+
this.emailAddressValid = false;
|
|
1098
|
+
this.subject = '';
|
|
1099
|
+
this.target = 0;
|
|
1100
|
+
this.valid = false;
|
|
1101
|
+
this.#_activeTab = 0;
|
|
1102
|
+
this.#_emailAddress = '';
|
|
1103
|
+
this.#_url = 'https://';
|
|
1104
|
+
this.#modalInstance = modalInstance;
|
|
1105
|
+
if (modalContext.urlResult) {
|
|
1106
|
+
if (modalContext.urlResult.url.startsWith(emailKey)) {
|
|
1107
|
+
this.emailAddress = modalContext.urlResult.url.replace(emailKey, '');
|
|
1108
|
+
let queryStringIndex = this.emailAddress.indexOf(queryStringParamKey);
|
|
1109
|
+
queryStringIndex =
|
|
1110
|
+
queryStringIndex > -1
|
|
1111
|
+
? queryStringIndex
|
|
1112
|
+
: this.emailAddress.indexOf(queryStringParamKey.toLowerCase());
|
|
1113
|
+
/* istanbul ignore else */
|
|
1114
|
+
if (queryStringIndex > -1) {
|
|
1115
|
+
this.subject = decodeURI(this.emailAddress).slice(queryStringIndex + queryStringParamKey.length);
|
|
1116
|
+
this.emailAddress = this.emailAddress.slice(0, queryStringIndex);
|
|
1117
|
+
}
|
|
1118
|
+
// Set active tab to email
|
|
1119
|
+
this.activeTab = 1;
|
|
1120
|
+
}
|
|
1121
|
+
else {
|
|
1122
|
+
(this.url = modalContext.urlResult.url),
|
|
1123
|
+
(this.target = modalContext.urlResult.target);
|
|
1124
|
+
// set active tab to web page
|
|
1125
|
+
this.activeTab = 0;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
activeTabChanged(value) {
|
|
1130
|
+
this.activeTab = Number(value);
|
|
1131
|
+
}
|
|
1132
|
+
save() {
|
|
1133
|
+
/* istanbul ignore else */
|
|
1134
|
+
if (this.#isValid()) {
|
|
1135
|
+
if (this.activeTab === 0) {
|
|
1136
|
+
this.#modalInstance.save({
|
|
1137
|
+
url: this.url,
|
|
1138
|
+
target: this.target
|
|
1139
|
+
? parseInt(this.target, undefined)
|
|
1140
|
+
: UrlTarget.None,
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
else {
|
|
1144
|
+
this.#modalInstance.save({
|
|
1145
|
+
url: this.#getEmailUrl(),
|
|
1146
|
+
target: UrlTarget.None,
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
cancel() {
|
|
1152
|
+
this.#modalInstance.cancel();
|
|
1153
|
+
}
|
|
1154
|
+
#getEmailUrl() {
|
|
1155
|
+
return (emailKey +
|
|
1156
|
+
this.emailAddress +
|
|
1157
|
+
(this.subject ? '?Subject=' + encodeURI(this.subject) : ''));
|
|
1158
|
+
}
|
|
1159
|
+
#isValid() {
|
|
1160
|
+
if (this.activeTab === 0) {
|
|
1161
|
+
return !!this.url && SkyValidation.isUrl(this.url);
|
|
1162
|
+
}
|
|
1163
|
+
return !!this.emailAddress && SkyValidation.isEmail(this.emailAddress);
|
|
1164
|
+
}
|
|
1165
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorUrlModalComponent, deps: [{ token: i1$2.SkyModalInstance }, { token: SkyUrlModalContext }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1166
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyTextEditorUrlModalComponent, selector: "sky-text-editor-url-modal", ngImport: i0, template: "<sky-modal>\n <sky-modal-header>\n {{ 'skyux_text_editor_url_modal_header_label' | skyLibResources }}\n </sky-modal-header>\n <sky-modal-content>\n <sky-tabset\n data-sky-id=\"test-tabset\"\n [active]=\"activeTab\"\n (activeChange)=\"activeTabChanged($event)\"\n >\n <sky-tab tabHeading=\"Web page\">\n <div class=\"sky-form-group sky-text-editor-url-modal-first-field\">\n <sky-input-box>\n <label\n class=\"sky-control-label sky-control-label-required\"\n [for]=\"urlInput.id\"\n >\n {{ 'skyux_text_editor_url_modal_url_label' | skyLibResources }}\n </label>\n <input\n class=\"sky-form-control\"\n type=\"text\"\n [(ngModel)]=\"url\"\n skyId\n #urlInput=\"skyId\"\n />\n </sky-input-box>\n </div>\n <sky-input-box class=\"sky-form-group\">\n <label class=\"sky-control-label\" [for]=\"targetInput.id\">\n {{ 'skyux_text_editor_url_modal_open_label' | skyLibResources }}\n </label>\n <select\n class=\"sky-form-control\"\n [(ngModel)]=\"target\"\n skyId\n #targetInput=\"skyId\"\n >\n <option value=\"0\">\n {{\n 'skyux_text_editor_url_modal_current_option_label'\n | skyLibResources\n }}\n </option>\n <option value=\"1\">\n {{\n 'skyux_text_editor_url_modal_new_option_label' | skyLibResources\n }}\n </option>\n </select>\n </sky-input-box>\n </sky-tab>\n <sky-tab tabHeading=\"Email address\">\n <div class=\"sky-form-group first-field\">\n <sky-input-box>\n <label\n class=\"sky-control-label sky-control-label-required\"\n [for]=\"emailAddressInput.id\"\n >\n {{ 'skyux_text_editor_url_modal_email_label' | skyLibResources }}\n </label>\n <input\n class=\"sky-form-control\"\n type=\"text\"\n [(ngModel)]=\"emailAddress\"\n skyId\n #emailAddressInput=\"skyId\"\n />\n </sky-input-box>\n </div>\n <sky-input-box class=\"sky-form-group\">\n <label class=\"sky-control-label\" [for]=\"subjectInput.id\">\n {{ 'skyux_text_editor_url_modal_subject_label' | skyLibResources }}\n </label>\n <input\n class=\"sky-form-control\"\n type=\"text\"\n [(ngModel)]=\"subject\"\n skyId\n #subjectInput=\"skyId\"\n />\n </sky-input-box>\n </sky-tab>\n </sky-tabset>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n type=\"submit\"\n class=\"sky-btn sky-btn-primary\"\n [disabled]=\"!valid\"\n (click)=\"save()\"\n >\n {{ 'skyux_text_editor_url_modal_save_button_label' | skyLibResources }}\n </button>\n <button type=\"button\" class=\"sky-btn sky-btn-link\" (click)=\"cancel()\">\n {{ 'skyux_text_editor_url_modal_cancel_button_label' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n", styles: [".sky-text-editor-url-modal-first-field{margin-top:15px}\n"], dependencies: [{ kind: "directive", type: i3$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1$1.λ2, selector: "[skyId]", exportAs: ["skyId"] }, { kind: "component", type: i6.λ10, selector: "sky-input-box", inputs: ["hasErrors", "disabled", "labelText", "characterLimit", "stacked", "helpPopoverTitle", "helpPopoverContent"] }, { kind: "component", type: i1$2.λ5, selector: "sky-modal", inputs: ["formErrors", "ariaRole", "tiledBody", "ariaDescribedBy", "ariaLabelledBy"] }, { kind: "component", type: i1$2.λ2, selector: "sky-modal-content" }, { kind: "component", type: i1$2.λ3, selector: "sky-modal-footer" }, { kind: "component", type: i1$2.λ4, selector: "sky-modal-header" }, { kind: "component", type: i6$1.λ1, selector: "sky-tab", inputs: ["active", "disabled", "permalinkValue", "tabHeaderCount", "tabHeading", "tabIndex", "layout"], outputs: ["close"] }, { kind: "component", type: i6$1.λ2, selector: "sky-tabset", inputs: ["active", "ariaLabel", "ariaLabelledBy", "permalinkId", "tabStyle"], outputs: ["activeChange", "newTab", "openTab", "tabIndexesChange"] }, { kind: "pipe", type: i2.SkyLibResourcesPipe, name: "skyLibResources" }] }); }
|
|
1167
|
+
}
|
|
1168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorUrlModalComponent, decorators: [{
|
|
1169
|
+
type: Component,
|
|
1170
|
+
args: [{ selector: 'sky-text-editor-url-modal', template: "<sky-modal>\n <sky-modal-header>\n {{ 'skyux_text_editor_url_modal_header_label' | skyLibResources }}\n </sky-modal-header>\n <sky-modal-content>\n <sky-tabset\n data-sky-id=\"test-tabset\"\n [active]=\"activeTab\"\n (activeChange)=\"activeTabChanged($event)\"\n >\n <sky-tab tabHeading=\"Web page\">\n <div class=\"sky-form-group sky-text-editor-url-modal-first-field\">\n <sky-input-box>\n <label\n class=\"sky-control-label sky-control-label-required\"\n [for]=\"urlInput.id\"\n >\n {{ 'skyux_text_editor_url_modal_url_label' | skyLibResources }}\n </label>\n <input\n class=\"sky-form-control\"\n type=\"text\"\n [(ngModel)]=\"url\"\n skyId\n #urlInput=\"skyId\"\n />\n </sky-input-box>\n </div>\n <sky-input-box class=\"sky-form-group\">\n <label class=\"sky-control-label\" [for]=\"targetInput.id\">\n {{ 'skyux_text_editor_url_modal_open_label' | skyLibResources }}\n </label>\n <select\n class=\"sky-form-control\"\n [(ngModel)]=\"target\"\n skyId\n #targetInput=\"skyId\"\n >\n <option value=\"0\">\n {{\n 'skyux_text_editor_url_modal_current_option_label'\n | skyLibResources\n }}\n </option>\n <option value=\"1\">\n {{\n 'skyux_text_editor_url_modal_new_option_label' | skyLibResources\n }}\n </option>\n </select>\n </sky-input-box>\n </sky-tab>\n <sky-tab tabHeading=\"Email address\">\n <div class=\"sky-form-group first-field\">\n <sky-input-box>\n <label\n class=\"sky-control-label sky-control-label-required\"\n [for]=\"emailAddressInput.id\"\n >\n {{ 'skyux_text_editor_url_modal_email_label' | skyLibResources }}\n </label>\n <input\n class=\"sky-form-control\"\n type=\"text\"\n [(ngModel)]=\"emailAddress\"\n skyId\n #emailAddressInput=\"skyId\"\n />\n </sky-input-box>\n </div>\n <sky-input-box class=\"sky-form-group\">\n <label class=\"sky-control-label\" [for]=\"subjectInput.id\">\n {{ 'skyux_text_editor_url_modal_subject_label' | skyLibResources }}\n </label>\n <input\n class=\"sky-form-control\"\n type=\"text\"\n [(ngModel)]=\"subject\"\n skyId\n #subjectInput=\"skyId\"\n />\n </sky-input-box>\n </sky-tab>\n </sky-tabset>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n type=\"submit\"\n class=\"sky-btn sky-btn-primary\"\n [disabled]=\"!valid\"\n (click)=\"save()\"\n >\n {{ 'skyux_text_editor_url_modal_save_button_label' | skyLibResources }}\n </button>\n <button type=\"button\" class=\"sky-btn sky-btn-link\" (click)=\"cancel()\">\n {{ 'skyux_text_editor_url_modal_cancel_button_label' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n", styles: [".sky-text-editor-url-modal-first-field{margin-top:15px}\n"] }]
|
|
1171
|
+
}], ctorParameters: function () { return [{ type: i1$2.SkyModalInstance }, { type: SkyUrlModalContext }]; } });
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* @internal
|
|
1175
|
+
*/
|
|
1176
|
+
class SkyTextEditorToolbarComponent {
|
|
1177
|
+
set editorFocusStream(value) {
|
|
1178
|
+
this.#_editorFocusStream = value;
|
|
1179
|
+
this.#subscribeEditorFocus();
|
|
1180
|
+
}
|
|
1181
|
+
get editorFocusStream() {
|
|
1182
|
+
return this.#_editorFocusStream;
|
|
1183
|
+
}
|
|
1184
|
+
set styleState(value) {
|
|
1185
|
+
this.#_styleState = value;
|
|
1186
|
+
if (value.font !== this.styleStateFontName) {
|
|
1187
|
+
if (value.font === '"Blackbaud Sans", Arial, sans-serif') {
|
|
1188
|
+
this.styleStateFontName = this.#getFontName('Blackbaud Sans');
|
|
1189
|
+
}
|
|
1190
|
+
else {
|
|
1191
|
+
this.styleStateFontName = this.#getFontName(value.font);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
get styleState() {
|
|
1196
|
+
return this.#_styleState;
|
|
1197
|
+
}
|
|
1198
|
+
set disabled(value) {
|
|
1199
|
+
const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);
|
|
1200
|
+
if (coercedValue !== this.disabled) {
|
|
1201
|
+
this.#_disabled = coercedValue;
|
|
1202
|
+
this.#changeDetector.markForCheck();
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
get disabled() {
|
|
1206
|
+
return this.#_disabled;
|
|
1207
|
+
}
|
|
1208
|
+
#editorFocusStreamSub;
|
|
1209
|
+
#adapterService;
|
|
1210
|
+
#changeDetector;
|
|
1211
|
+
#modalService;
|
|
1212
|
+
#ngUnsubscribe;
|
|
1213
|
+
#_editorFocusStream;
|
|
1214
|
+
#_disabled;
|
|
1215
|
+
#_styleState;
|
|
1216
|
+
constructor(adapterService, changeDetector, modalService) {
|
|
1217
|
+
this.fontList = [];
|
|
1218
|
+
this.fontSizeList = [];
|
|
1219
|
+
this.toolbarActions = [];
|
|
1220
|
+
this.backColorpickerStream = new Subject();
|
|
1221
|
+
this.colorpickerStream = new Subject();
|
|
1222
|
+
this.fontPickerStream = new Subject();
|
|
1223
|
+
this.fontSizeStream = new Subject();
|
|
1224
|
+
this.#ngUnsubscribe = new Subject();
|
|
1225
|
+
this.#_editorFocusStream = new Subject();
|
|
1226
|
+
this.#_disabled = false;
|
|
1227
|
+
this.#_styleState = STYLE_STATE_DEFAULTS;
|
|
1228
|
+
this.#adapterService = adapterService;
|
|
1229
|
+
this.#changeDetector = changeDetector;
|
|
1230
|
+
this.#modalService = modalService;
|
|
1231
|
+
}
|
|
1232
|
+
ngOnInit() {
|
|
1233
|
+
this.#subscribeEditorFocus();
|
|
1234
|
+
}
|
|
1235
|
+
execCommand(command, value = '') {
|
|
1236
|
+
this.#adapterService.execCommand({
|
|
1237
|
+
command: command,
|
|
1238
|
+
value: value,
|
|
1239
|
+
});
|
|
1240
|
+
this.styleState = {
|
|
1241
|
+
...this.styleState,
|
|
1242
|
+
...this.#adapterService.getStyleState(),
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
1245
|
+
toggleFontStyle(currentState, newState, command) {
|
|
1246
|
+
if (currentState !== newState) {
|
|
1247
|
+
this.execCommand(command);
|
|
1248
|
+
}
|
|
1249
|
+
// Force sky-checkbox to show changes on user's initial click.
|
|
1250
|
+
this.#changeDetector.detectChanges();
|
|
1251
|
+
}
|
|
1252
|
+
link() {
|
|
1253
|
+
const priorSelection = this.#adapterService.saveSelection();
|
|
1254
|
+
const currentLink = this.#adapterService.getLink();
|
|
1255
|
+
const inputModal = this.#modalService.open(SkyTextEditorUrlModalComponent, [
|
|
1256
|
+
{
|
|
1257
|
+
provide: SkyUrlModalContext,
|
|
1258
|
+
useValue: { urlResult: currentLink },
|
|
1259
|
+
},
|
|
1260
|
+
]);
|
|
1261
|
+
inputModal.closed.subscribe((result) => {
|
|
1262
|
+
if (result.reason === 'save' && priorSelection) {
|
|
1263
|
+
if (currentLink) {
|
|
1264
|
+
const anchor = this.#adapterService.getSelectedAnchorTag();
|
|
1265
|
+
if (anchor) {
|
|
1266
|
+
this.#adapterService.selectElement(anchor);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
this.execCommand('unlink');
|
|
1270
|
+
if (result.data.target === UrlTarget.None) {
|
|
1271
|
+
// Current window
|
|
1272
|
+
this.execCommand('createLink', result.data.url);
|
|
1273
|
+
}
|
|
1274
|
+
else {
|
|
1275
|
+
// New Window
|
|
1276
|
+
const sText = this.#adapterService.getCurrentSelection();
|
|
1277
|
+
this.execCommand('insertHTML', '<a href="' +
|
|
1278
|
+
result.data.url +
|
|
1279
|
+
'" rel="noopener noreferrer" target="_blank">' +
|
|
1280
|
+
sText +
|
|
1281
|
+
'</a>');
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1286
|
+
unlink() {
|
|
1287
|
+
const currentSelectionRange = this.#adapterService
|
|
1288
|
+
.getCurrentSelection()
|
|
1289
|
+
?.getRangeAt(0);
|
|
1290
|
+
if (currentSelectionRange && currentSelectionRange.toString().length <= 0) {
|
|
1291
|
+
const anchorTag = this.#adapterService.getSelectedAnchorTag();
|
|
1292
|
+
if (anchorTag) {
|
|
1293
|
+
this.#adapterService.selectElement(anchorTag);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
this.execCommand('unlink');
|
|
1297
|
+
}
|
|
1298
|
+
changeFontSize(size) {
|
|
1299
|
+
this.#adapterService.setFontSize(size);
|
|
1300
|
+
this.styleState = {
|
|
1301
|
+
...this.styleState,
|
|
1302
|
+
...this.#adapterService.getStyleState(),
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
onColorpickerColorChanged(color, isBackground = false) {
|
|
1306
|
+
this.execCommand(isBackground ? 'backColor' : 'foreColor', color.hex);
|
|
1307
|
+
}
|
|
1308
|
+
#subscribeEditorFocus() {
|
|
1309
|
+
this.#editorFocusStreamSub?.unsubscribe();
|
|
1310
|
+
this.#editorFocusStreamSub = this.editorFocusStream
|
|
1311
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
1312
|
+
.subscribe(() => {
|
|
1313
|
+
this.styleState = {
|
|
1314
|
+
...this.styleState,
|
|
1315
|
+
...this.#adapterService.getStyleState(),
|
|
1316
|
+
};
|
|
1317
|
+
this.#closeDropdowns();
|
|
1318
|
+
this.#changeDetector.detectChanges();
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
#closeDropdowns() {
|
|
1322
|
+
const message = {
|
|
1323
|
+
type: SkyColorpickerMessageType.Close,
|
|
1324
|
+
};
|
|
1325
|
+
this.colorpickerStream.next(message);
|
|
1326
|
+
this.backColorpickerStream.next(message);
|
|
1327
|
+
this.fontPickerStream.next({ type: SkyDropdownMessageType.Close });
|
|
1328
|
+
this.fontSizeStream.next({ type: SkyDropdownMessageType.Close });
|
|
1329
|
+
}
|
|
1330
|
+
#getFontName(fontName) {
|
|
1331
|
+
for (let i = 0; i < this.fontList.length; i++) {
|
|
1332
|
+
if (fontName.replace(/['"]+/g, '') === this.fontList[i].name) {
|
|
1333
|
+
return this.fontList[i].name;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
/* istanbul ignore next */
|
|
1337
|
+
return undefined;
|
|
1338
|
+
}
|
|
1339
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorToolbarComponent, deps: [{ token: SkyTextEditorAdapterService }, { token: i0.ChangeDetectorRef }, { token: i1$2.SkyModalService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1340
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyTextEditorToolbarComponent, selector: "sky-text-editor-toolbar", inputs: { editorFocusStream: "editorFocusStream", fontList: "fontList", fontSizeList: "fontSizeList", toolbarActions: "toolbarActions", styleState: "styleState", disabled: "disabled" }, ngImport: i0, template: "<sky-toolbar-item\n *ngFor=\"let action of toolbarActions\"\n class=\"sky-text-editor-toolbar-action\"\n [ngClass]=\"'sky-text-editor-toolbar-action-' + action\"\n>\n <ng-container [ngSwitch]=\"action\">\n <ng-container *ngSwitchCase=\"'font-family'\">\n <sky-dropdown\n class=\"sky-text-editor-font-picker\"\n [disabled]=\"disabled\"\n [label]=\"'Font: ' + styleStateFontName\"\n [messageStream]=\"fontPickerStream\"\n >\n <sky-dropdown-button\n [ngStyle]=\"{\n 'font-family': styleState.font\n }\"\n >\n {{ styleStateFontName }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item *ngFor=\"let fontModel of fontList\">\n <button\n type=\"button\"\n [ngStyle]=\"{\n 'font-family': fontModel.value\n }\"\n (click)=\"execCommand('fontname', fontModel.name)\"\n >\n {{ fontModel.name }}\n </button>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n </ng-container>\n <ng-container *ngSwitchCase=\"'font-size'\">\n <sky-dropdown\n class=\"sky-text-editor-font-size-picker\"\n [disabled]=\"disabled\"\n [label]=\"'Font size: ' + styleState.fontSize + 'px'\"\n [messageStream]=\"fontSizeStream\"\n >\n <sky-dropdown-button\n [ngStyle]=\"{\n 'font-family': styleState.fontSize\n }\"\n >\n {{ styleState.fontSize + 'px' }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item *ngFor=\"let size of fontSizeList\">\n <button type=\"button\" (click)=\"changeFontSize(size)\">\n {{ size + 'px' }}\n </button>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n </ng-container>\n <ng-container *ngSwitchCase=\"'font-style'\">\n <div class=\"sky-switch-icon-group sky-text-editor-font-style-picker\">\n <sky-checkbox\n icon=\"bold\"\n label=\"Bold\"\n title=\"Bold\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.boldState\"\n (ngModelChange)=\"\n toggleFontStyle(styleState.boldState, $event, 'bold')\n \"\n >\n </sky-checkbox>\n <sky-checkbox\n icon=\"italic\"\n label=\"Italicized\"\n title=\"Italicized\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.italicState\"\n (ngModelChange)=\"\n toggleFontStyle(styleState.italicState, $event, 'italic')\n \"\n >\n </sky-checkbox>\n <sky-checkbox\n icon=\"underline\"\n label=\"Underline\"\n title=\"Underline\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.underlineState\"\n (ngModelChange)=\"\n toggleFontStyle(styleState.underlineState, $event, 'underline')\n \"\n >\n </sky-checkbox>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'color'\">\n <div class=\"sky-text-editor-colorpicker-group\">\n <div class=\"sky-text-editor-colorpicker-container\">\n <sky-colorpicker\n class=\"sky-text-editor-font-color-picker\"\n label=\"Font color\"\n [messageStream]=\"colorpickerStream\"\n [showResetButton]=\"false\"\n (selectedColorChanged)=\"onColorpickerColorChanged($event)\"\n pickerButtonIcon=\"highlighter\"\n pickerButtonIconType=\"skyux\"\n #colorPicker\n >\n <input\n outputFormat=\"hex\"\n type=\"text\"\n [allowTransparency]=\"false\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.fontColor\"\n [skyColorpickerInput]=\"colorPicker\"\n />\n </sky-colorpicker>\n </div>\n <div class=\"sky-text-editor-colorpicker-container\">\n <sky-colorpicker\n class=\"sky-text-editor-background-color-picker\"\n label=\"Background color\"\n [messageStream]=\"backColorpickerStream\"\n [showResetButton]=\"false\"\n (selectedColorChanged)=\"onColorpickerColorChanged($event, true)\"\n #backColorPicker\n pickerButtonIcon=\"text-color\"\n pickerButtonIconType=\"skyux\"\n >\n <input\n outputFormat=\"rgba\"\n type=\"text\"\n [allowTransparency]=\"true\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.backColor\"\n [skyColorpickerInput]=\"backColorPicker\"\n />\n </sky-colorpicker>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'list'\">\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Bulleted list\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Bulleted list\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('insertUnorderedList')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"list-ul\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"bullet-list-line\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n <button\n aria-label=\"Numbered list\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Numbered list\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('insertOrderedList')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"list-ol\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"number-list-line\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'alignment'\">\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Align left\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Align left\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('justifyLeft')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"align-left\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"align-left-text-line\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n <button\n aria-label=\"Align center\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Align center\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('justifyCenter')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"align-center\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"center-text-line\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n <button\n aria-label=\"Align right\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Align right\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('justifyRight')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"align-right\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"align-right-text-line\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'indentation'\">\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Outdent\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Outdent\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('outdent')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"outdent\"> </sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"outdent-line\" iconType=\"skyux\">\n </sky-icon>\n </button>\n <button\n aria-label=\"Indent\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Indent\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('indent')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"indent\"> </sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"indent-line\" iconType=\"skyux\">\n </sky-icon>\n </button>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'undo-redo'\">\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Undo\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Undo\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('undo')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"undo\"> </sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"undo-line\" iconType=\"skyux\">\n </sky-icon>\n </button>\n <button\n aria-label=\"Redo\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Redo\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('redo')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"repeat\"> </sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"redo-line\" iconType=\"skyux\">\n </sky-icon>\n </button>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'link'\">\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Link\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Link\"\n [disabled]=\"disabled\"\n [ngClass]=\"{\n 'icon-btn-active': styleState.linkState\n }\"\n (click)=\"link()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"link\"> </sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"link-line\" iconType=\"skyux\">\n </sky-icon>\n </button>\n <button\n aria-label=\"Unlink\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Unlink\"\n [disabled]=\"!styleState.linkState || disabled\"\n (click)=\"unlink()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"unlink\"> </sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"unlink-line\" iconType=\"skyux\">\n </sky-icon>\n </button>\n </div>\n </ng-container>\n </ng-container>\n</sky-toolbar-item>\n", styles: [".sky-text-editor-toolbar-action .sky-toolbar-item{margin-right:15px}.sky-text-editor-toolbar-action .sky-text-editor-font-picker ::ng-deep .sky-dropdown-button-content-container{width:140px;height:20px;text-align:left}.sky-text-editor-toolbar-action .sky-text-editor-colorpicker-group{display:flex}.sky-text-editor-toolbar-action .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container{position:relative;top:3px;margin:0 10px 0 0}.sky-text-editor-toolbar-action .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container:last-child{margin-right:0}.sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn{margin-left:0;margin-right:0;border-radius:0;border-right:none}.sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn:first-of-type{border-top-left-radius:3px;border-bottom-left-radius:3px}.sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn:last-of-type{border-top-right-radius:3px;border-bottom-right-radius:3px;border-right:1px solid #cdcfd2}:host-context(.sky-theme-modern) .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container{top:-2px;margin:0}:host-context(.sky-theme-modern) .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container:last-child ::ng-deep sky-colorpicker .sky-colorpicker-button{margin-right:0}:host-context(.sky-theme-modern) .sky-switch-icon-group .sky-btn{margin:inherit;border-radius:6px}:host-context(.sky-theme-modern) .sky-switch-icon-group .sky-btn:first-of-type,:host-context(.sky-theme-modern) .sky-switch-icon-group .sky-btn:last-of-type{border-radius:6px}:host-context(.sky-theme-modern) .sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn:last-of-type{border:none}.sky-theme-modern .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container{top:-2px;margin:0}.sky-theme-modern .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container:last-child ::ng-deep sky-colorpicker .sky-colorpicker-button{margin-right:0}.sky-theme-modern .sky-switch-icon-group .sky-btn{margin:inherit;border-radius:6px}.sky-theme-modern .sky-switch-icon-group .sky-btn:first-of-type,.sky-theme-modern .sky-switch-icon-group .sky-btn:last-of-type{border-radius:6px}.sky-theme-modern .sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn:last-of-type{border:none}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "directive", type: i6.λ20, selector: "input:not([skyId]):not(.sky-form-control),select:not([skyId]):not(.sky-form-control),textarea:not([skyId]):not(.sky-form-control)" }, { kind: "component", type: i7$1.λ1, selector: "sky-colorpicker", inputs: ["pickerButtonIcon", "pickerButtonIconType", "label", "labelledBy", "messageStream", "showResetButton"], outputs: ["selectedColorChanged", "selectedColorApplied"] }, { kind: "directive", type: i7$1.λ2, selector: "[skyColorpickerInput]", inputs: ["skyColorpickerInput", "initialColor", "returnFormat", "outputFormat", "presetColors", "alphaChannel", "allowTransparency"] }, { kind: "component", type: i6.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "indeterminate", "required"], outputs: ["change", "checkedChange", "disabledChange", "indeterminateChange"] }, { kind: "component", type: i4.λ2, selector: "sky-dropdown-button" }, { kind: "component", type: i4.λ3, selector: "sky-dropdown", inputs: ["buttonStyle", "buttonType", "disabled", "dismissOnBlur", "label", "horizontalAlignment", "messageStream", "title", "trigger"] }, { kind: "component", type: i4.λ1, selector: "sky-dropdown-item", inputs: ["ariaRole"] }, { kind: "component", type: i4.λ4, selector: "sky-dropdown-menu", inputs: ["ariaLabelledBy", "ariaRole", "useNativeFocus"], outputs: ["menuChanges"] }, { kind: "directive", type: i5.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { kind: "component", type: i7.λ39, selector: "sky-toolbar-item" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1341
|
+
}
|
|
1342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorToolbarComponent, decorators: [{
|
|
1343
|
+
type: Component,
|
|
1344
|
+
args: [{ selector: 'sky-text-editor-toolbar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<sky-toolbar-item\n *ngFor=\"let action of toolbarActions\"\n class=\"sky-text-editor-toolbar-action\"\n [ngClass]=\"'sky-text-editor-toolbar-action-' + action\"\n>\n <ng-container [ngSwitch]=\"action\">\n <ng-container *ngSwitchCase=\"'font-family'\">\n <sky-dropdown\n class=\"sky-text-editor-font-picker\"\n [disabled]=\"disabled\"\n [label]=\"'Font: ' + styleStateFontName\"\n [messageStream]=\"fontPickerStream\"\n >\n <sky-dropdown-button\n [ngStyle]=\"{\n 'font-family': styleState.font\n }\"\n >\n {{ styleStateFontName }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item *ngFor=\"let fontModel of fontList\">\n <button\n type=\"button\"\n [ngStyle]=\"{\n 'font-family': fontModel.value\n }\"\n (click)=\"execCommand('fontname', fontModel.name)\"\n >\n {{ fontModel.name }}\n </button>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n </ng-container>\n <ng-container *ngSwitchCase=\"'font-size'\">\n <sky-dropdown\n class=\"sky-text-editor-font-size-picker\"\n [disabled]=\"disabled\"\n [label]=\"'Font size: ' + styleState.fontSize + 'px'\"\n [messageStream]=\"fontSizeStream\"\n >\n <sky-dropdown-button\n [ngStyle]=\"{\n 'font-family': styleState.fontSize\n }\"\n >\n {{ styleState.fontSize + 'px' }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item *ngFor=\"let size of fontSizeList\">\n <button type=\"button\" (click)=\"changeFontSize(size)\">\n {{ size + 'px' }}\n </button>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n </ng-container>\n <ng-container *ngSwitchCase=\"'font-style'\">\n <div class=\"sky-switch-icon-group sky-text-editor-font-style-picker\">\n <sky-checkbox\n icon=\"bold\"\n label=\"Bold\"\n title=\"Bold\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.boldState\"\n (ngModelChange)=\"\n toggleFontStyle(styleState.boldState, $event, 'bold')\n \"\n >\n </sky-checkbox>\n <sky-checkbox\n icon=\"italic\"\n label=\"Italicized\"\n title=\"Italicized\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.italicState\"\n (ngModelChange)=\"\n toggleFontStyle(styleState.italicState, $event, 'italic')\n \"\n >\n </sky-checkbox>\n <sky-checkbox\n icon=\"underline\"\n label=\"Underline\"\n title=\"Underline\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.underlineState\"\n (ngModelChange)=\"\n toggleFontStyle(styleState.underlineState, $event, 'underline')\n \"\n >\n </sky-checkbox>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'color'\">\n <div class=\"sky-text-editor-colorpicker-group\">\n <div class=\"sky-text-editor-colorpicker-container\">\n <sky-colorpicker\n class=\"sky-text-editor-font-color-picker\"\n label=\"Font color\"\n [messageStream]=\"colorpickerStream\"\n [showResetButton]=\"false\"\n (selectedColorChanged)=\"onColorpickerColorChanged($event)\"\n pickerButtonIcon=\"highlighter\"\n pickerButtonIconType=\"skyux\"\n #colorPicker\n >\n <input\n outputFormat=\"hex\"\n type=\"text\"\n [allowTransparency]=\"false\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.fontColor\"\n [skyColorpickerInput]=\"colorPicker\"\n />\n </sky-colorpicker>\n </div>\n <div class=\"sky-text-editor-colorpicker-container\">\n <sky-colorpicker\n class=\"sky-text-editor-background-color-picker\"\n label=\"Background color\"\n [messageStream]=\"backColorpickerStream\"\n [showResetButton]=\"false\"\n (selectedColorChanged)=\"onColorpickerColorChanged($event, true)\"\n #backColorPicker\n pickerButtonIcon=\"text-color\"\n pickerButtonIconType=\"skyux\"\n >\n <input\n outputFormat=\"rgba\"\n type=\"text\"\n [allowTransparency]=\"true\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.backColor\"\n [skyColorpickerInput]=\"backColorPicker\"\n />\n </sky-colorpicker>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'list'\">\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Bulleted list\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Bulleted list\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('insertUnorderedList')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"list-ul\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"bullet-list-line\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n <button\n aria-label=\"Numbered list\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Numbered list\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('insertOrderedList')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"list-ol\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"number-list-line\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'alignment'\">\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Align left\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Align left\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('justifyLeft')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"align-left\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"align-left-text-line\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n <button\n aria-label=\"Align center\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Align center\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('justifyCenter')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"align-center\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"center-text-line\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n <button\n aria-label=\"Align right\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Align right\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('justifyRight')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"align-right\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"align-right-text-line\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'indentation'\">\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Outdent\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Outdent\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('outdent')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"outdent\"> </sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"outdent-line\" iconType=\"skyux\">\n </sky-icon>\n </button>\n <button\n aria-label=\"Indent\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Indent\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('indent')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"indent\"> </sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"indent-line\" iconType=\"skyux\">\n </sky-icon>\n </button>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'undo-redo'\">\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Undo\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Undo\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('undo')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"undo\"> </sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"undo-line\" iconType=\"skyux\">\n </sky-icon>\n </button>\n <button\n aria-label=\"Redo\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Redo\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('redo')\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"repeat\"> </sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"redo-line\" iconType=\"skyux\">\n </sky-icon>\n </button>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'link'\">\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Link\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Link\"\n [disabled]=\"disabled\"\n [ngClass]=\"{\n 'icon-btn-active': styleState.linkState\n }\"\n (click)=\"link()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"link\"> </sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"link-line\" iconType=\"skyux\">\n </sky-icon>\n </button>\n <button\n aria-label=\"Unlink\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Unlink\"\n [disabled]=\"!styleState.linkState || disabled\"\n (click)=\"unlink()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"unlink\"> </sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"unlink-line\" iconType=\"skyux\">\n </sky-icon>\n </button>\n </div>\n </ng-container>\n </ng-container>\n</sky-toolbar-item>\n", styles: [".sky-text-editor-toolbar-action .sky-toolbar-item{margin-right:15px}.sky-text-editor-toolbar-action .sky-text-editor-font-picker ::ng-deep .sky-dropdown-button-content-container{width:140px;height:20px;text-align:left}.sky-text-editor-toolbar-action .sky-text-editor-colorpicker-group{display:flex}.sky-text-editor-toolbar-action .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container{position:relative;top:3px;margin:0 10px 0 0}.sky-text-editor-toolbar-action .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container:last-child{margin-right:0}.sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn{margin-left:0;margin-right:0;border-radius:0;border-right:none}.sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn:first-of-type{border-top-left-radius:3px;border-bottom-left-radius:3px}.sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn:last-of-type{border-top-right-radius:3px;border-bottom-right-radius:3px;border-right:1px solid #cdcfd2}:host-context(.sky-theme-modern) .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container{top:-2px;margin:0}:host-context(.sky-theme-modern) .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container:last-child ::ng-deep sky-colorpicker .sky-colorpicker-button{margin-right:0}:host-context(.sky-theme-modern) .sky-switch-icon-group .sky-btn{margin:inherit;border-radius:6px}:host-context(.sky-theme-modern) .sky-switch-icon-group .sky-btn:first-of-type,:host-context(.sky-theme-modern) .sky-switch-icon-group .sky-btn:last-of-type{border-radius:6px}:host-context(.sky-theme-modern) .sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn:last-of-type{border:none}.sky-theme-modern .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container{top:-2px;margin:0}.sky-theme-modern .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container:last-child ::ng-deep sky-colorpicker .sky-colorpicker-button{margin-right:0}.sky-theme-modern .sky-switch-icon-group .sky-btn{margin:inherit;border-radius:6px}.sky-theme-modern .sky-switch-icon-group .sky-btn:first-of-type,.sky-theme-modern .sky-switch-icon-group .sky-btn:last-of-type{border-radius:6px}.sky-theme-modern .sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn:last-of-type{border:none}\n"] }]
|
|
1345
|
+
}], ctorParameters: function () { return [{ type: SkyTextEditorAdapterService }, { type: i0.ChangeDetectorRef }, { type: i1$2.SkyModalService }]; }, propDecorators: { editorFocusStream: [{
|
|
1346
|
+
type: Input
|
|
1347
|
+
}], fontList: [{
|
|
1348
|
+
type: Input
|
|
1349
|
+
}], fontSizeList: [{
|
|
1350
|
+
type: Input
|
|
1351
|
+
}], toolbarActions: [{
|
|
1352
|
+
type: Input
|
|
1353
|
+
}], styleState: [{
|
|
1354
|
+
type: Input
|
|
1355
|
+
}], disabled: [{
|
|
1356
|
+
type: Input
|
|
1357
|
+
}] } });
|
|
1358
|
+
|
|
1359
|
+
/**
|
|
1360
|
+
* The text editor component lets users format and manipulate text.
|
|
1361
|
+
*/
|
|
1362
|
+
class SkyTextEditorComponent {
|
|
1363
|
+
/**
|
|
1364
|
+
* Whether to disable the text editor on template-driven forms. Don't use this input on reactive forms because they may overwrite the input or leave the control out of sync.
|
|
1365
|
+
* To set the disabled state on reactive forms, use the `FormControl` instead.
|
|
1366
|
+
* @default false
|
|
1367
|
+
*/
|
|
1368
|
+
set disabled(value) {
|
|
1369
|
+
const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);
|
|
1370
|
+
if (coercedValue !== this.disabled) {
|
|
1371
|
+
this.#_disabled = coercedValue;
|
|
1372
|
+
// Update focusableChildren inside the iframe.
|
|
1373
|
+
let focusableChildren;
|
|
1374
|
+
/* istanbul ignore else */
|
|
1375
|
+
if (this.iframeRef) {
|
|
1376
|
+
focusableChildren = this.#coreAdapterService.getFocusableChildren(this.iframeRef.nativeElement.contentDocument.body, {
|
|
1377
|
+
ignoreVisibility: true,
|
|
1378
|
+
ignoreTabIndex: true,
|
|
1379
|
+
});
|
|
1380
|
+
if (this.#_disabled) {
|
|
1381
|
+
this.#adapterService.disableEditor(focusableChildren, this.iframeRef.nativeElement);
|
|
1382
|
+
}
|
|
1383
|
+
else {
|
|
1384
|
+
this.#adapterService.enableEditor(focusableChildren, this.iframeRef.nativeElement);
|
|
1385
|
+
}
|
|
1386
|
+
this.#changeDetector.markForCheck();
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
get disabled() {
|
|
1391
|
+
return this.#_disabled;
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* The fonts to include in the font picker.
|
|
1395
|
+
* @default [{name: 'Blackbaud Sans', value: '"Blackbaud Sans", Arial, sans-serif'}, {name: 'Arial', value: 'Arial'}, {name: 'Arial Black', value: '"Arial Black"'}, {name: 'Courier New', value: '"Courier New"'}, {name: 'Georgia', value: 'Georgia, serif'}, {name: 'Tahoma', value: 'Tahoma, Geneva, sans-serif'}, {name: 'Times New Roman', value: '"Times New Roman"'}, {name: 'Trebuchet MS', value: '"Trebuchet MS", sans-serif'}, {name: 'Verdana', value: 'Verdana, Geneva, sans-serif'}]
|
|
1396
|
+
*/
|
|
1397
|
+
set fontList(value) {
|
|
1398
|
+
this.#_fontList = value || FONT_LIST_DEFAULTS;
|
|
1399
|
+
}
|
|
1400
|
+
get fontList() {
|
|
1401
|
+
return this.#_fontList;
|
|
1402
|
+
}
|
|
1403
|
+
/**
|
|
1404
|
+
* The font sizes to include in the font size picker.
|
|
1405
|
+
* @default [6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 36, 48]
|
|
1406
|
+
*/
|
|
1407
|
+
set fontSizeList(value) {
|
|
1408
|
+
this.#_fontSizeList = value || FONT_SIZE_LIST_DEFAULTS;
|
|
1409
|
+
}
|
|
1410
|
+
get fontSizeList() {
|
|
1411
|
+
return this.#_fontSizeList;
|
|
1412
|
+
}
|
|
1413
|
+
/**
|
|
1414
|
+
* The unique ID attribute for the text editor.
|
|
1415
|
+
* By default, the component generates a random ID.
|
|
1416
|
+
*/
|
|
1417
|
+
set id(value) {
|
|
1418
|
+
this.#id = value || this.#defaultId;
|
|
1419
|
+
}
|
|
1420
|
+
get id() {
|
|
1421
|
+
return this.#id;
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* The initial styles for all content, including background color, font size, and link state.
|
|
1425
|
+
*/
|
|
1426
|
+
set initialStyleState(state) {
|
|
1427
|
+
// Do not update the state after initialization has taken place
|
|
1428
|
+
/* istanbul ignore else */
|
|
1429
|
+
if (!this.#initialized) {
|
|
1430
|
+
this.#_initialStyleState = {
|
|
1431
|
+
...STYLE_STATE_DEFAULTS,
|
|
1432
|
+
...state,
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
get initialStyleState() {
|
|
1437
|
+
return this.#_initialStyleState;
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* The menus to include in the menu bar.
|
|
1441
|
+
* @default [ 'edit', 'format' ]
|
|
1442
|
+
*/
|
|
1443
|
+
set menus(value) {
|
|
1444
|
+
this.#_menus = value || MENU_DEFAULTS;
|
|
1445
|
+
}
|
|
1446
|
+
get menus() {
|
|
1447
|
+
return this.#_menus;
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* The merge fields to include in the merge field menu.
|
|
1451
|
+
*/
|
|
1452
|
+
set mergeFields(value) {
|
|
1453
|
+
this.#_mergeFields = value || [];
|
|
1454
|
+
}
|
|
1455
|
+
get mergeFields() {
|
|
1456
|
+
return this.#_mergeFields;
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Placeholder text to display when the text entry area is empty.
|
|
1460
|
+
*/
|
|
1461
|
+
set placeholder(value) {
|
|
1462
|
+
/* istanbul ignore else */
|
|
1463
|
+
if (value !== this.#_placeholder) {
|
|
1464
|
+
this.#_placeholder = value || '';
|
|
1465
|
+
if (this.#initialized) {
|
|
1466
|
+
this.#adapterService.setPlaceholder(value);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
get placeholder() {
|
|
1471
|
+
return this.#_placeholder;
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* The actions to include in the toolbar and determines their order.
|
|
1475
|
+
* @default [ 'font-family', 'font-size', 'font-style', 'color', 'list', 'link ]
|
|
1476
|
+
*/
|
|
1477
|
+
set toolbarActions(value) {
|
|
1478
|
+
this.#_toolbarActions = value || TOOLBAR_ACTION_DEFAULTS;
|
|
1479
|
+
}
|
|
1480
|
+
get toolbarActions() {
|
|
1481
|
+
return this.#_toolbarActions;
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* The internal value of the control.
|
|
1485
|
+
*/
|
|
1486
|
+
set value(value) {
|
|
1487
|
+
// Normalize value and set any empty state to an empty string.
|
|
1488
|
+
let normalizedValue;
|
|
1489
|
+
const valueTrimmed = value?.trim();
|
|
1490
|
+
if (!value ||
|
|
1491
|
+
valueTrimmed === '<p></p>' ||
|
|
1492
|
+
valueTrimmed === '<br>' ||
|
|
1493
|
+
valueTrimmed === '<p><br></p>') {
|
|
1494
|
+
normalizedValue = '';
|
|
1495
|
+
}
|
|
1496
|
+
else {
|
|
1497
|
+
normalizedValue = value;
|
|
1498
|
+
}
|
|
1499
|
+
normalizedValue = this.#sanitizationService
|
|
1500
|
+
.sanitize(normalizedValue)
|
|
1501
|
+
.trim();
|
|
1502
|
+
if (this.#_value !== normalizedValue) {
|
|
1503
|
+
this.#_value = normalizedValue;
|
|
1504
|
+
// Update angular form control if model has been normalized.
|
|
1505
|
+
/* istanbul ignore else */
|
|
1506
|
+
if (this.#ngControl?.control &&
|
|
1507
|
+
normalizedValue !== this.#ngControl.control.value) {
|
|
1508
|
+
this.#ngControl.control.setValue(normalizedValue, {
|
|
1509
|
+
emitModelToViewChange: false,
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
// Autofocus isn't testable in Firefox and IE.
|
|
1513
|
+
// Don't set focus on the editor now if the iframe isn't initialized.
|
|
1514
|
+
// #initIframe() will do another check later to see if the editor should
|
|
1515
|
+
// receive focus.
|
|
1516
|
+
/* istanbul ignore next */
|
|
1517
|
+
if (this.autofocus && this.#initialized && !this.#focusInitialized) {
|
|
1518
|
+
this.#adapterService.focusEditor();
|
|
1519
|
+
this.#focusInitialized = true;
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
get value() {
|
|
1524
|
+
return this.#_value;
|
|
1525
|
+
}
|
|
1526
|
+
#defaultId;
|
|
1527
|
+
#id;
|
|
1528
|
+
#focusInitialized;
|
|
1529
|
+
#initialized;
|
|
1530
|
+
#ngUnsubscribe;
|
|
1531
|
+
#changeDetector;
|
|
1532
|
+
#coreAdapterService;
|
|
1533
|
+
#adapterService;
|
|
1534
|
+
#editorService;
|
|
1535
|
+
#sanitizationService;
|
|
1536
|
+
#ngControl;
|
|
1537
|
+
#zone;
|
|
1538
|
+
#_fontList;
|
|
1539
|
+
#_fontSizeList;
|
|
1540
|
+
#_mergeFields;
|
|
1541
|
+
#_menus;
|
|
1542
|
+
#_toolbarActions;
|
|
1543
|
+
#_disabled;
|
|
1544
|
+
#_initialStyleState;
|
|
1545
|
+
#_placeholder;
|
|
1546
|
+
#_value;
|
|
1547
|
+
constructor(changeDetector, coreAdapterService, adapterService, editorService, sanitizationService, ngControl, zone, idSvc) {
|
|
1548
|
+
/**
|
|
1549
|
+
* Whether to put focus on the editor after it renders.
|
|
1550
|
+
*/
|
|
1551
|
+
this.autofocus = false;
|
|
1552
|
+
this.editorFocusStream = new Subject();
|
|
1553
|
+
this.formControlClass = !!inject(SkyInputBoxHostService, {
|
|
1554
|
+
optional: true,
|
|
1555
|
+
});
|
|
1556
|
+
this.#focusInitialized = false;
|
|
1557
|
+
this.#initialized = false;
|
|
1558
|
+
this.#ngUnsubscribe = new Subject();
|
|
1559
|
+
this.#_fontList = FONT_LIST_DEFAULTS;
|
|
1560
|
+
this.#_fontSizeList = FONT_SIZE_LIST_DEFAULTS;
|
|
1561
|
+
this.#_mergeFields = [];
|
|
1562
|
+
this.#_menus = MENU_DEFAULTS;
|
|
1563
|
+
this.#_toolbarActions = TOOLBAR_ACTION_DEFAULTS;
|
|
1564
|
+
this.#_disabled = false;
|
|
1565
|
+
this.#_initialStyleState = Object.assign({}, STYLE_STATE_DEFAULTS);
|
|
1566
|
+
this.#_placeholder = '';
|
|
1567
|
+
this.#_value = '<p></p>';
|
|
1568
|
+
/* istanbul ignore next */
|
|
1569
|
+
this.#_onTouched = () => {
|
|
1570
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1571
|
+
};
|
|
1572
|
+
/* istanbul ignore next */
|
|
1573
|
+
this.#_onChange = () => {
|
|
1574
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1575
|
+
};
|
|
1576
|
+
this.#changeDetector = changeDetector;
|
|
1577
|
+
this.#coreAdapterService = coreAdapterService;
|
|
1578
|
+
this.#adapterService = adapterService;
|
|
1579
|
+
this.#editorService = editorService;
|
|
1580
|
+
this.#sanitizationService = sanitizationService;
|
|
1581
|
+
this.#ngControl = ngControl;
|
|
1582
|
+
this.#zone = zone;
|
|
1583
|
+
this.#id = this.#defaultId = idSvc.generateId();
|
|
1584
|
+
ngControl.valueAccessor = this;
|
|
1585
|
+
}
|
|
1586
|
+
ngAfterViewInit() {
|
|
1587
|
+
this.#initIframe();
|
|
1588
|
+
}
|
|
1589
|
+
ngOnDestroy() {
|
|
1590
|
+
this.#adapterService.removeObservers(this.#editorService.editor);
|
|
1591
|
+
this.#ngUnsubscribe.next();
|
|
1592
|
+
this.#ngUnsubscribe.complete();
|
|
1593
|
+
}
|
|
1594
|
+
onIframeLoad() {
|
|
1595
|
+
// Reinitialize the editor if it already exists to cover situations where the text editor might have been moved in the DOM.
|
|
1596
|
+
if (this.#editorService.isInitialized) {
|
|
1597
|
+
this.#initIframe();
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Implemented as part of ControlValueAccessor.
|
|
1602
|
+
*/
|
|
1603
|
+
writeValue(value) {
|
|
1604
|
+
this.value = value;
|
|
1605
|
+
// Update HTML if necessary.
|
|
1606
|
+
if (this.#initialized) {
|
|
1607
|
+
const editorValue = this.#adapterService.getEditorInnerHtml();
|
|
1608
|
+
if (editorValue !== this.#_value) {
|
|
1609
|
+
this.#adapterService.setEditorInnerHtml(this.#_value);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
/**
|
|
1614
|
+
* Implemented as part of ControlValueAccessor.
|
|
1615
|
+
*/
|
|
1616
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1617
|
+
registerOnChange(fn) {
|
|
1618
|
+
this.#_onChange = fn;
|
|
1619
|
+
}
|
|
1620
|
+
/**
|
|
1621
|
+
* Implemented as part of ControlValueAccessor.
|
|
1622
|
+
*/
|
|
1623
|
+
registerOnTouched(fn) {
|
|
1624
|
+
this.#_onTouched = fn;
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Implemented as part of ControlValueAccessor.
|
|
1628
|
+
*/
|
|
1629
|
+
setDisabledState(isDisabled) {
|
|
1630
|
+
this.disabled = isDisabled;
|
|
1631
|
+
}
|
|
1632
|
+
#updateStyle() {
|
|
1633
|
+
this.#_initialStyleState = {
|
|
1634
|
+
...this.#_initialStyleState,
|
|
1635
|
+
...this.#adapterService.getStyleState(),
|
|
1636
|
+
};
|
|
1637
|
+
}
|
|
1638
|
+
#initIframe() {
|
|
1639
|
+
this.#adapterService.initEditor(this.id, this.iframeRef.nativeElement, this.initialStyleState, this.placeholder);
|
|
1640
|
+
this.#editorService
|
|
1641
|
+
.inputListener()
|
|
1642
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
1643
|
+
.subscribe(() => {
|
|
1644
|
+
// Angular doesn't run change detection for changes originating inside an iframe,
|
|
1645
|
+
// so we have to call the onChange() event inside NgZone to force change propagation to consuming components.
|
|
1646
|
+
this.#zone.run(() => {
|
|
1647
|
+
this.#viewToModelUpdate();
|
|
1648
|
+
});
|
|
1649
|
+
});
|
|
1650
|
+
this.#editorService
|
|
1651
|
+
.selectionChangeListener()
|
|
1652
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
1653
|
+
.subscribe(() => {
|
|
1654
|
+
this.#updateStyle();
|
|
1655
|
+
this.editorFocusStream.next();
|
|
1656
|
+
});
|
|
1657
|
+
this.#editorService
|
|
1658
|
+
.clickListener()
|
|
1659
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
1660
|
+
.subscribe(() => {
|
|
1661
|
+
this.editorFocusStream.next();
|
|
1662
|
+
});
|
|
1663
|
+
this.#editorService
|
|
1664
|
+
.blurListener()
|
|
1665
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
1666
|
+
.subscribe(() => {
|
|
1667
|
+
// Angular doesn't run change detection for changes originating inside an iframe,
|
|
1668
|
+
// so we have to run markForCheck() inside the NgZone to force change propagation to consuming components.
|
|
1669
|
+
this.#zone.run(() => {
|
|
1670
|
+
this.#_onTouched();
|
|
1671
|
+
});
|
|
1672
|
+
});
|
|
1673
|
+
this.#editorService
|
|
1674
|
+
.commandChangeListener()
|
|
1675
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
1676
|
+
.subscribe(() => {
|
|
1677
|
+
this.#updateStyle();
|
|
1678
|
+
this.#viewToModelUpdate();
|
|
1679
|
+
});
|
|
1680
|
+
this.#adapterService.setEditorInnerHtml(this.#_value);
|
|
1681
|
+
/* istanbul ignore next */
|
|
1682
|
+
if (this.autofocus) {
|
|
1683
|
+
this.#adapterService.focusEditor();
|
|
1684
|
+
}
|
|
1685
|
+
this.#initialized = true;
|
|
1686
|
+
}
|
|
1687
|
+
#viewToModelUpdate(emitChange = true) {
|
|
1688
|
+
this.value = this.#adapterService.getEditorInnerHtml();
|
|
1689
|
+
/* istanbul ignore else */
|
|
1690
|
+
if (emitChange) {
|
|
1691
|
+
this.#_onChange(this.#_value);
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
/* istanbul ignore next */
|
|
1695
|
+
#_onTouched;
|
|
1696
|
+
/* istanbul ignore next */
|
|
1697
|
+
#_onChange;
|
|
1698
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$1.SkyCoreAdapterService }, { token: SkyTextEditorAdapterService }, { token: SkyTextEditorService }, { token: SkyTextSanitizationService }, { token: i3$1.NgControl }, { token: i0.NgZone }, { token: i1$1.SkyIdService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1699
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyTextEditorComponent, selector: "sky-text-editor", inputs: { autofocus: "autofocus", disabled: "disabled", fontList: "fontList", fontSizeList: "fontSizeList", id: "id", initialStyleState: "initialStyleState", menus: "menus", mergeFields: "mergeFields", placeholder: "placeholder", toolbarActions: "toolbarActions" }, host: { properties: { "class.sky-form-control": "this.formControlClass" } }, providers: [
|
|
1700
|
+
SkyTextEditorService,
|
|
1701
|
+
SkyTextEditorSelectionService,
|
|
1702
|
+
SkyTextEditorAdapterService,
|
|
1703
|
+
], viewQueries: [{ propertyName: "iframeRef", first: true, predicate: ["iframe"], descendants: true }, { propertyName: "inputTemplateRef", first: true, predicate: ["inputTemplateRef"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "<div class=\"sky-text-editor\">\n <sky-toolbar\n *ngIf=\"\n (menus && menus.length) > 0 ||\n (toolbarActions && toolbarActions.length > 0)\n \"\n class=\"sky-text-editor-toolbar\"\n >\n <sky-toolbar-section\n *ngIf=\"menus && menus.length > 0\"\n aria-label=\"Text formatting\"\n class=\"menubar\"\n role=\"toolbar\"\n >\n <sky-text-editor-menubar\n [disabled]=\"disabled\"\n [editorFocusStream]=\"editorFocusStream\"\n [menus]=\"menus\"\n [mergeFields]=\"mergeFields\"\n >\n </sky-text-editor-menubar>\n </sky-toolbar-section>\n <sky-toolbar-section\n *ngIf=\"toolbarActions && toolbarActions.length > 0\"\n aria-label=\"Text formatting\"\n class=\"toolbar\"\n role=\"toolbar\"\n >\n <sky-text-editor-toolbar\n [disabled]=\"disabled\"\n [editorFocusStream]=\"editorFocusStream\"\n [fontList]=\"fontList\"\n [fontSizeList]=\"fontSizeList\"\n [toolbarActions]=\"toolbarActions\"\n [styleState]=\"initialStyleState\"\n >\n </sky-text-editor-toolbar>\n </sky-toolbar-section>\n </sky-toolbar>\n <iframe\n class=\"sky-text-editor-wrapper\"\n src=\"about:blank\"\n title=\"Text Editor\"\n [ngClass]=\"{\n 'sky-text-editor-wrapper-disabled': disabled\n }\"\n (load)=\"onIframeLoad()\"\n #iframe\n >\n </iframe>\n</div>\n", styles: [".sky-text-editor .sky-text-editor-wrapper{display:flex;flex-wrap:wrap;background-color:#fff;width:100%;height:300px;padding:1rem;font-size:1.2rem;border:1px solid #c0c0c0;overflow-y:auto;outline:none}.sky-text-editor .sky-text-editor-wrapper.sky-text-editor-wrapper-disabled{background-color:#ededee}.sky-text-editor .sky-text-editor-toolbar .sky-toolbar-section{padding:10px 10px 0}.sky-text-editor .sky-text-editor-toolbar .sky-toolbar-sectioned{border-left:1px solid #cdcfd2!important;border-right:1px solid #cdcfd2!important}.sky-text-editor .sky-text-editor-toolbar .sky-toolbar-item{margin:0 20px 10px 0}.sky-text-editor .sky-text-editor-toolbar .sky-dropdown-button{border:none}.sky-text-editor .sky-text-editor-toolbar sky-text-editor-menubar,.sky-text-editor .sky-text-editor-toolbar sky-text-editor-toolbar{display:flex;flex-wrap:wrap}.sky-theme-modern .sky-text-editor .sky-text-editor-wrapper{border:1px solid #d2d2d2}.sky-theme-modern .sky-text-editor .sky-text-editor-wrapper.sky-text-editor-wrapper-disabled{background-color:#ececed}.sky-theme-modern .sky-text-editor .sky-text-editor-toolbar .sky-toolbar{padding:10px 10px 0}.sky-theme-modern .sky-text-editor .sky-text-editor-toolbar .sky-toolbar-section{padding:10px!important}.sky-theme-modern .sky-text-editor .sky-text-editor-toolbar .sky-toolbar-sectioned{border-top:1px solid #d2d2d2!important;border-left:1px solid #d2d2d2!important;border-right:1px solid #d2d2d2!important}.sky-theme-modern .sky-text-editor .sky-text-editor-toolbar .sky-toolbar-item{margin:0 20px 0 0!important}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i7.λ37, selector: "sky-toolbar" }, { kind: "component", type: i7.λ38, selector: "sky-toolbar-section" }, { kind: "component", type: SkyTextEditorToolbarComponent, selector: "sky-text-editor-toolbar", inputs: ["editorFocusStream", "fontList", "fontSizeList", "toolbarActions", "styleState", "disabled"] }, { kind: "component", type: SkyTextEditorMenubarComponent, selector: "sky-text-editor-menubar", inputs: ["editorFocusStream", "menus", "mergeFields", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1704
|
+
}
|
|
1705
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorComponent, decorators: [{
|
|
1706
|
+
type: Component,
|
|
1707
|
+
args: [{ selector: 'sky-text-editor', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
1708
|
+
SkyTextEditorService,
|
|
1709
|
+
SkyTextEditorSelectionService,
|
|
1710
|
+
SkyTextEditorAdapterService,
|
|
1711
|
+
], template: "<div class=\"sky-text-editor\">\n <sky-toolbar\n *ngIf=\"\n (menus && menus.length) > 0 ||\n (toolbarActions && toolbarActions.length > 0)\n \"\n class=\"sky-text-editor-toolbar\"\n >\n <sky-toolbar-section\n *ngIf=\"menus && menus.length > 0\"\n aria-label=\"Text formatting\"\n class=\"menubar\"\n role=\"toolbar\"\n >\n <sky-text-editor-menubar\n [disabled]=\"disabled\"\n [editorFocusStream]=\"editorFocusStream\"\n [menus]=\"menus\"\n [mergeFields]=\"mergeFields\"\n >\n </sky-text-editor-menubar>\n </sky-toolbar-section>\n <sky-toolbar-section\n *ngIf=\"toolbarActions && toolbarActions.length > 0\"\n aria-label=\"Text formatting\"\n class=\"toolbar\"\n role=\"toolbar\"\n >\n <sky-text-editor-toolbar\n [disabled]=\"disabled\"\n [editorFocusStream]=\"editorFocusStream\"\n [fontList]=\"fontList\"\n [fontSizeList]=\"fontSizeList\"\n [toolbarActions]=\"toolbarActions\"\n [styleState]=\"initialStyleState\"\n >\n </sky-text-editor-toolbar>\n </sky-toolbar-section>\n </sky-toolbar>\n <iframe\n class=\"sky-text-editor-wrapper\"\n src=\"about:blank\"\n title=\"Text Editor\"\n [ngClass]=\"{\n 'sky-text-editor-wrapper-disabled': disabled\n }\"\n (load)=\"onIframeLoad()\"\n #iframe\n >\n </iframe>\n</div>\n", styles: [".sky-text-editor .sky-text-editor-wrapper{display:flex;flex-wrap:wrap;background-color:#fff;width:100%;height:300px;padding:1rem;font-size:1.2rem;border:1px solid #c0c0c0;overflow-y:auto;outline:none}.sky-text-editor .sky-text-editor-wrapper.sky-text-editor-wrapper-disabled{background-color:#ededee}.sky-text-editor .sky-text-editor-toolbar .sky-toolbar-section{padding:10px 10px 0}.sky-text-editor .sky-text-editor-toolbar .sky-toolbar-sectioned{border-left:1px solid #cdcfd2!important;border-right:1px solid #cdcfd2!important}.sky-text-editor .sky-text-editor-toolbar .sky-toolbar-item{margin:0 20px 10px 0}.sky-text-editor .sky-text-editor-toolbar .sky-dropdown-button{border:none}.sky-text-editor .sky-text-editor-toolbar sky-text-editor-menubar,.sky-text-editor .sky-text-editor-toolbar sky-text-editor-toolbar{display:flex;flex-wrap:wrap}.sky-theme-modern .sky-text-editor .sky-text-editor-wrapper{border:1px solid #d2d2d2}.sky-theme-modern .sky-text-editor .sky-text-editor-wrapper.sky-text-editor-wrapper-disabled{background-color:#ececed}.sky-theme-modern .sky-text-editor .sky-text-editor-toolbar .sky-toolbar{padding:10px 10px 0}.sky-theme-modern .sky-text-editor .sky-text-editor-toolbar .sky-toolbar-section{padding:10px!important}.sky-theme-modern .sky-text-editor .sky-text-editor-toolbar .sky-toolbar-sectioned{border-top:1px solid #d2d2d2!important;border-left:1px solid #d2d2d2!important;border-right:1px solid #d2d2d2!important}.sky-theme-modern .sky-text-editor .sky-text-editor-toolbar .sky-toolbar-item{margin:0 20px 0 0!important}\n"] }]
|
|
1712
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1$1.SkyCoreAdapterService }, { type: SkyTextEditorAdapterService }, { type: SkyTextEditorService }, { type: SkyTextSanitizationService }, { type: i3$1.NgControl }, { type: i0.NgZone }, { type: i1$1.SkyIdService }]; }, propDecorators: { autofocus: [{
|
|
1713
|
+
type: Input
|
|
1714
|
+
}], disabled: [{
|
|
1715
|
+
type: Input
|
|
1716
|
+
}], fontList: [{
|
|
1717
|
+
type: Input
|
|
1718
|
+
}], fontSizeList: [{
|
|
1719
|
+
type: Input
|
|
1720
|
+
}], id: [{
|
|
1721
|
+
type: Input
|
|
1722
|
+
}], initialStyleState: [{
|
|
1723
|
+
type: Input
|
|
1724
|
+
}], menus: [{
|
|
1725
|
+
type: Input
|
|
1726
|
+
}], mergeFields: [{
|
|
1727
|
+
type: Input
|
|
1728
|
+
}], placeholder: [{
|
|
1729
|
+
type: Input
|
|
1730
|
+
}], toolbarActions: [{
|
|
1731
|
+
type: Input
|
|
1732
|
+
}], iframeRef: [{
|
|
1733
|
+
type: ViewChild,
|
|
1734
|
+
args: ['iframe']
|
|
1735
|
+
}], inputTemplateRef: [{
|
|
1736
|
+
type: ViewChild,
|
|
1737
|
+
args: ['inputTemplateRef', {
|
|
1738
|
+
read: TemplateRef,
|
|
1739
|
+
static: true,
|
|
1740
|
+
}]
|
|
1741
|
+
}], formControlClass: [{
|
|
1742
|
+
type: HostBinding,
|
|
1743
|
+
args: ['class.sky-form-control']
|
|
1744
|
+
}] } });
|
|
1745
|
+
|
|
1746
|
+
class SkyTextEditorModule {
|
|
1747
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1748
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorModule, declarations: [SkyTextEditorComponent,
|
|
1749
|
+
SkyTextEditorUrlModalComponent,
|
|
1750
|
+
SkyTextEditorToolbarComponent,
|
|
1751
|
+
SkyTextEditorMenubarComponent], imports: [CommonModule,
|
|
1752
|
+
FormsModule,
|
|
1753
|
+
ReactiveFormsModule,
|
|
1754
|
+
SkyCoreAdapterModule,
|
|
1755
|
+
SkyTextEditorResourcesModule,
|
|
1756
|
+
SkyI18nModule,
|
|
1757
|
+
SkyIconModule,
|
|
1758
|
+
SkyIdModule,
|
|
1759
|
+
SkyInputBoxModule,
|
|
1760
|
+
SkyColorpickerModule,
|
|
1761
|
+
SkyCheckboxModule,
|
|
1762
|
+
SkyDropdownModule,
|
|
1763
|
+
SkyModalModule,
|
|
1764
|
+
SkyTabsModule,
|
|
1765
|
+
SkyThemeModule,
|
|
1766
|
+
SkyToolbarModule], exports: [SkyTextEditorComponent,
|
|
1767
|
+
SkyTextEditorUrlModalComponent,
|
|
1768
|
+
SkyTextEditorToolbarComponent,
|
|
1769
|
+
SkyTextEditorMenubarComponent] }); }
|
|
1770
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorModule, imports: [CommonModule,
|
|
1771
|
+
FormsModule,
|
|
1772
|
+
ReactiveFormsModule,
|
|
1773
|
+
SkyCoreAdapterModule,
|
|
1774
|
+
SkyTextEditorResourcesModule,
|
|
1775
|
+
SkyI18nModule,
|
|
1776
|
+
SkyIconModule,
|
|
1777
|
+
SkyIdModule,
|
|
1778
|
+
SkyInputBoxModule,
|
|
1779
|
+
SkyColorpickerModule,
|
|
1780
|
+
SkyCheckboxModule,
|
|
1781
|
+
SkyDropdownModule,
|
|
1782
|
+
SkyModalModule,
|
|
1783
|
+
SkyTabsModule,
|
|
1784
|
+
SkyThemeModule,
|
|
1785
|
+
SkyToolbarModule] }); }
|
|
1786
|
+
}
|
|
1787
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTextEditorModule, decorators: [{
|
|
1788
|
+
type: NgModule,
|
|
1789
|
+
args: [{
|
|
1790
|
+
imports: [
|
|
1791
|
+
CommonModule,
|
|
1792
|
+
FormsModule,
|
|
1793
|
+
ReactiveFormsModule,
|
|
1794
|
+
SkyCoreAdapterModule,
|
|
1795
|
+
SkyTextEditorResourcesModule,
|
|
1796
|
+
SkyI18nModule,
|
|
1797
|
+
SkyIconModule,
|
|
1798
|
+
SkyIdModule,
|
|
1799
|
+
SkyInputBoxModule,
|
|
1800
|
+
SkyColorpickerModule,
|
|
1801
|
+
SkyCheckboxModule,
|
|
1802
|
+
SkyDropdownModule,
|
|
1803
|
+
SkyModalModule,
|
|
1804
|
+
SkyTabsModule,
|
|
1805
|
+
SkyThemeModule,
|
|
1806
|
+
SkyToolbarModule,
|
|
1807
|
+
],
|
|
1808
|
+
exports: [
|
|
1809
|
+
SkyTextEditorComponent,
|
|
1810
|
+
SkyTextEditorUrlModalComponent,
|
|
1811
|
+
SkyTextEditorToolbarComponent,
|
|
1812
|
+
SkyTextEditorMenubarComponent,
|
|
1813
|
+
],
|
|
1814
|
+
declarations: [
|
|
1815
|
+
SkyTextEditorComponent,
|
|
1816
|
+
SkyTextEditorUrlModalComponent,
|
|
1817
|
+
SkyTextEditorToolbarComponent,
|
|
1818
|
+
SkyTextEditorMenubarComponent,
|
|
1819
|
+
],
|
|
1820
|
+
}]
|
|
1821
|
+
}] });
|
|
1822
|
+
|
|
1823
|
+
/**
|
|
1824
|
+
* Generated bundle index. Do not edit.
|
|
1825
|
+
*/
|
|
1826
|
+
|
|
1827
|
+
export { SkyRichTextDisplayModule, SkyTextEditorModule, SkyRichTextDisplayComponent as λ1, SkyTextEditorMenubarComponent as λ2, SkyTextEditorUrlModalComponent as λ3, SkyTextEditorToolbarComponent as λ4, SkyTextEditorComponent as λ5 };
|
|
1828
|
+
//# sourceMappingURL=skyux-text-editor.mjs.map
|