@skyux/text-editor 7.0.0-beta.8 → 7.0.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/documentation.json +601 -282
- package/esm2020/lib/modules/rich-text-display/rich-text-display.component.mjs +25 -17
- package/esm2020/lib/modules/rich-text-display/rich-text-display.module.mjs +5 -5
- package/esm2020/lib/modules/shared/sky-text-editor-resources.module.mjs +5 -5
- package/esm2020/lib/modules/text-editor/menubar/text-editor-menubar.component.mjs +93 -87
- package/esm2020/lib/modules/text-editor/services/text-editor-adapter.service.mjs +263 -316
- package/esm2020/lib/modules/text-editor/services/text-editor-selection.service.mjs +16 -22
- package/esm2020/lib/modules/text-editor/services/text-editor.service.mjs +31 -31
- package/esm2020/lib/modules/text-editor/services/text-sanitization.service.mjs +11 -6
- package/esm2020/lib/modules/text-editor/text-editor.component.mjs +226 -173
- package/esm2020/lib/modules/text-editor/text-editor.module.mjs +5 -5
- package/esm2020/lib/modules/text-editor/toolbar/text-editor-toolbar.component.mjs +87 -62
- package/esm2020/lib/modules/text-editor/types/editor-command.mjs +1 -1
- package/esm2020/lib/modules/text-editor/types/editor-setting.mjs +1 -1
- package/esm2020/lib/modules/text-editor/url-modal/text-editor-url-modal-context.mjs +1 -1
- package/esm2020/lib/modules/text-editor/url-modal/text-editor-url-modal.component.mjs +36 -35
- package/fesm2015/skyux-text-editor.mjs +786 -735
- package/fesm2015/skyux-text-editor.mjs.map +1 -1
- package/fesm2020/skyux-text-editor.mjs +788 -744
- package/fesm2020/skyux-text-editor.mjs.map +1 -1
- package/lib/modules/rich-text-display/rich-text-display.component.d.ts +2 -4
- package/lib/modules/text-editor/menubar/text-editor-menubar.component.d.ts +6 -13
- package/lib/modules/text-editor/services/text-editor-adapter.service.d.ts +17 -34
- package/lib/modules/text-editor/services/text-editor-selection.service.d.ts +3 -3
- package/lib/modules/text-editor/services/text-editor.service.d.ts +8 -12
- package/lib/modules/text-editor/services/text-sanitization.service.d.ts +1 -1
- package/lib/modules/text-editor/text-editor.component.d.ts +23 -33
- package/lib/modules/text-editor/toolbar/text-editor-toolbar.component.d.ts +7 -13
- package/lib/modules/text-editor/types/editor-command.d.ts +1 -1
- package/lib/modules/text-editor/types/editor-setting.d.ts +4 -4
- package/lib/modules/text-editor/url-modal/text-editor-url-modal-context.d.ts +1 -1
- package/lib/modules/text-editor/url-modal/text-editor-url-modal.component.d.ts +2 -7
- package/package.json +18 -17
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import * as i3
|
|
1
|
+
import * as i3 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { Injectable, Component, Input, NgModule, ChangeDetectionStrategy, ViewEncapsulation, ViewChild } from '@angular/core';
|
|
5
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
|
|
5
6
|
import * as i1 from '@angular/platform-browser';
|
|
6
7
|
import createDOMPurify from 'dompurify';
|
|
7
|
-
import * as i3$
|
|
8
|
+
import * as i3$1 from '@angular/forms';
|
|
8
9
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
9
10
|
import * as i6$1 from '@skyux/colorpicker';
|
|
10
11
|
import { SkyColorpickerMessageType, SkyColorpickerModule } from '@skyux/colorpicker';
|
|
11
|
-
import * as
|
|
12
|
+
import * as i1$1 from '@skyux/core';
|
|
12
13
|
import { SkyCoreAdapterModule, SkyIdModule } from '@skyux/core';
|
|
13
14
|
import * as i5$1 from '@skyux/forms';
|
|
14
15
|
import { SkyInputBoxModule, SkyCheckboxModule } from '@skyux/forms';
|
|
@@ -18,7 +19,7 @@ import * as i5$2 from '@skyux/indicators';
|
|
|
18
19
|
import { SkyIconModule } from '@skyux/indicators';
|
|
19
20
|
import * as i7 from '@skyux/layout';
|
|
20
21
|
import { SkyToolbarModule } from '@skyux/layout';
|
|
21
|
-
import * as i1$
|
|
22
|
+
import * as i1$2 from '@skyux/modals';
|
|
22
23
|
import { SkyModalModule } from '@skyux/modals';
|
|
23
24
|
import * as i4 from '@skyux/popovers';
|
|
24
25
|
import { SkyDropdownMessageType, SkyDropdownModule } from '@skyux/popovers';
|
|
@@ -26,10 +27,12 @@ import * as i6 from '@skyux/tabs';
|
|
|
26
27
|
import { SkyTabsModule } from '@skyux/tabs';
|
|
27
28
|
import * as i5 from '@skyux/theme';
|
|
28
29
|
import { SkyThemeModule } from '@skyux/theme';
|
|
29
|
-
import
|
|
30
|
+
import he from 'he';
|
|
31
|
+
import { Subject } from 'rxjs';
|
|
30
32
|
import { takeUntil, take } from 'rxjs/operators';
|
|
31
33
|
import { SkyValidation } from '@skyux/validation';
|
|
32
34
|
|
|
35
|
+
var _SkyTextSanitizationService_allowedAttributes;
|
|
33
36
|
const domPurify = createDOMPurify(window);
|
|
34
37
|
domPurify.addHook('afterSanitizeAttributes', (node) => {
|
|
35
38
|
// Set all elements owning target to target=_blank
|
|
@@ -47,60 +50,72 @@ domPurify.addHook('afterSanitizeAttributes', (node) => {
|
|
|
47
50
|
*/
|
|
48
51
|
class SkyTextSanitizationService {
|
|
49
52
|
constructor() {
|
|
50
|
-
this
|
|
53
|
+
_SkyTextSanitizationService_allowedAttributes.set(this, ['target']);
|
|
51
54
|
}
|
|
52
55
|
/**
|
|
53
56
|
* Returns a sanitized string, allowing target attribute for new tab links.
|
|
54
57
|
*/
|
|
55
58
|
sanitize(htmlString) {
|
|
56
|
-
return domPurify.sanitize(htmlString, {
|
|
59
|
+
return domPurify.sanitize(htmlString, {
|
|
60
|
+
ADD_ATTR: __classPrivateFieldGet(this, _SkyTextSanitizationService_allowedAttributes, "f"),
|
|
61
|
+
});
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
|
-
|
|
60
|
-
SkyTextSanitizationService.ɵ
|
|
61
|
-
i0.ɵɵ
|
|
64
|
+
_SkyTextSanitizationService_allowedAttributes = new WeakMap();
|
|
65
|
+
SkyTextSanitizationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextSanitizationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
66
|
+
SkyTextSanitizationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextSanitizationService, providedIn: 'root' });
|
|
67
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextSanitizationService, decorators: [{
|
|
62
68
|
type: Injectable,
|
|
63
69
|
args: [{
|
|
64
70
|
providedIn: 'root',
|
|
65
71
|
}]
|
|
66
72
|
}] });
|
|
67
73
|
|
|
74
|
+
var _SkyRichTextDisplayComponent__richText, _SkyRichTextDisplayComponent_sanitizer, _SkyRichTextDisplayComponent_sanitizationService;
|
|
68
75
|
class SkyRichTextDisplayComponent {
|
|
69
76
|
constructor(sanitizer, sanitizationService) {
|
|
70
|
-
this.sanitizer = sanitizer;
|
|
71
|
-
this.sanitizationService = sanitizationService;
|
|
72
77
|
this.sanitizedText = '';
|
|
73
|
-
this
|
|
78
|
+
_SkyRichTextDisplayComponent__richText.set(this, '');
|
|
79
|
+
_SkyRichTextDisplayComponent_sanitizer.set(this, void 0);
|
|
80
|
+
_SkyRichTextDisplayComponent_sanitizationService.set(this, void 0);
|
|
81
|
+
__classPrivateFieldSet(this, _SkyRichTextDisplayComponent_sanitizer, sanitizer, "f");
|
|
82
|
+
__classPrivateFieldSet(this, _SkyRichTextDisplayComponent_sanitizationService, sanitizationService, "f");
|
|
74
83
|
}
|
|
75
84
|
/**
|
|
76
85
|
* Specifies the rich text to display.
|
|
77
86
|
*/
|
|
78
87
|
set richText(value) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
this
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
if (value) {
|
|
89
|
+
const cleaned = __classPrivateFieldGet(this, _SkyRichTextDisplayComponent_sanitizationService, "f").sanitize(value);
|
|
90
|
+
/* istanbul ignore else */
|
|
91
|
+
if (cleaned !== __classPrivateFieldGet(this, _SkyRichTextDisplayComponent__richText, "f")) {
|
|
92
|
+
__classPrivateFieldSet(this, _SkyRichTextDisplayComponent__richText, cleaned, "f");
|
|
93
|
+
// Text has already been sanitized with DOMPurifier.
|
|
94
|
+
// Tell Angular to bypass its own internal sanitization.
|
|
95
|
+
this.sanitizedText = __classPrivateFieldGet(this, _SkyRichTextDisplayComponent_sanitizer, "f").bypassSecurityTrustHtml(cleaned);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.sanitizedText = '';
|
|
86
100
|
}
|
|
87
101
|
}
|
|
88
102
|
}
|
|
89
|
-
|
|
90
|
-
SkyRichTextDisplayComponent.ɵ
|
|
91
|
-
i0.ɵɵ
|
|
103
|
+
_SkyRichTextDisplayComponent__richText = new WeakMap(), _SkyRichTextDisplayComponent_sanitizer = new WeakMap(), _SkyRichTextDisplayComponent_sanitizationService = new WeakMap();
|
|
104
|
+
SkyRichTextDisplayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyRichTextDisplayComponent, deps: [{ token: i1.DomSanitizer }, { token: SkyTextSanitizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
105
|
+
SkyRichTextDisplayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.11", type: SkyRichTextDisplayComponent, selector: "sky-rich-text-display", inputs: { richText: "richText" }, ngImport: i0, template: "<span class=\"sky-rich-text-display-text\" [innerHTML]=\"sanitizedText\"></span>\n" });
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyRichTextDisplayComponent, decorators: [{
|
|
92
107
|
type: Component,
|
|
93
|
-
args: [{ selector: 'sky-rich-text-display', template: "<span class=\"sky-rich-text-display-text\" [innerHTML]=\"sanitizedText\"
|
|
108
|
+
args: [{ selector: 'sky-rich-text-display', template: "<span class=\"sky-rich-text-display-text\" [innerHTML]=\"sanitizedText\"></span>\n" }]
|
|
94
109
|
}], ctorParameters: function () { return [{ type: i1.DomSanitizer }, { type: SkyTextSanitizationService }]; }, propDecorators: { richText: [{
|
|
95
110
|
type: Input
|
|
96
111
|
}] } });
|
|
97
112
|
|
|
98
113
|
class SkyRichTextDisplayModule {
|
|
99
114
|
}
|
|
100
|
-
SkyRichTextDisplayModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
101
|
-
SkyRichTextDisplayModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.
|
|
102
|
-
SkyRichTextDisplayModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.
|
|
103
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
115
|
+
SkyRichTextDisplayModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyRichTextDisplayModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
116
|
+
SkyRichTextDisplayModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.11", ngImport: i0, type: SkyRichTextDisplayModule, declarations: [SkyRichTextDisplayComponent], imports: [CommonModule], exports: [SkyRichTextDisplayComponent] });
|
|
117
|
+
SkyRichTextDisplayModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyRichTextDisplayModule, imports: [CommonModule] });
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyRichTextDisplayModule, decorators: [{
|
|
104
119
|
type: NgModule,
|
|
105
120
|
args: [{
|
|
106
121
|
imports: [CommonModule],
|
|
@@ -189,16 +204,16 @@ class SkyTextEditorResourcesProvider {
|
|
|
189
204
|
*/
|
|
190
205
|
class SkyTextEditorResourcesModule {
|
|
191
206
|
}
|
|
192
|
-
SkyTextEditorResourcesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
193
|
-
SkyTextEditorResourcesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.
|
|
194
|
-
SkyTextEditorResourcesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.
|
|
207
|
+
SkyTextEditorResourcesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
208
|
+
SkyTextEditorResourcesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorResourcesModule, exports: [SkyI18nModule] });
|
|
209
|
+
SkyTextEditorResourcesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorResourcesModule, providers: [
|
|
195
210
|
{
|
|
196
211
|
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
197
212
|
useClass: SkyTextEditorResourcesProvider,
|
|
198
213
|
multi: true,
|
|
199
214
|
},
|
|
200
215
|
], imports: [SkyI18nModule] });
|
|
201
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
216
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorResourcesModule, decorators: [{
|
|
202
217
|
type: NgModule,
|
|
203
218
|
args: [{
|
|
204
219
|
exports: [SkyI18nModule],
|
|
@@ -292,10 +307,9 @@ var UrlTarget;
|
|
|
292
307
|
*/
|
|
293
308
|
class SkyTextEditorSelectionService {
|
|
294
309
|
isElementSelected(documentEl, element) {
|
|
295
|
-
const selectedNode = this.getCurrentSelection(documentEl)
|
|
296
|
-
.anchorNode;
|
|
310
|
+
const selectedNode = this.getCurrentSelection(documentEl)?.anchorNode;
|
|
297
311
|
/* istanbul ignore next */
|
|
298
|
-
return (selectedNode &&
|
|
312
|
+
return !!(selectedNode &&
|
|
299
313
|
(element.contains(selectedNode) ||
|
|
300
314
|
(selectedNode.parentNode && element.contains(selectedNode.parentNode))));
|
|
301
315
|
}
|
|
@@ -313,9 +327,6 @@ class SkyTextEditorSelectionService {
|
|
|
313
327
|
selectedEl =
|
|
314
328
|
selectedEl.nodeType !== 1 ? selectedEl.parentElement : selectedEl;
|
|
315
329
|
}
|
|
316
|
-
else if (selection && selection.type !== 'Control') {
|
|
317
|
-
selectedEl = selection.createRange().parentElement();
|
|
318
|
-
}
|
|
319
330
|
else {
|
|
320
331
|
return undefined;
|
|
321
332
|
}
|
|
@@ -326,14 +337,15 @@ class SkyTextEditorSelectionService {
|
|
|
326
337
|
if (windowEl.getSelection) {
|
|
327
338
|
const sel = windowEl.getSelection();
|
|
328
339
|
/* istanbul ignore else */
|
|
329
|
-
if (sel.getRangeAt && sel.rangeCount) {
|
|
340
|
+
if (sel && sel.getRangeAt && sel.rangeCount) {
|
|
330
341
|
return sel.getRangeAt(0);
|
|
331
342
|
}
|
|
332
343
|
}
|
|
333
|
-
else if (documentEl.getSelection()
|
|
334
|
-
documentEl.getSelection()
|
|
335
|
-
return documentEl.getSelection().getRangeAt(0);
|
|
344
|
+
else if (documentEl.getSelection()?.getRangeAt) {
|
|
345
|
+
return documentEl.getSelection()?.getRangeAt(0);
|
|
336
346
|
}
|
|
347
|
+
/* istanbul ignore next */
|
|
348
|
+
return undefined;
|
|
337
349
|
}
|
|
338
350
|
selectElement(documentEl, windowEl, element) {
|
|
339
351
|
/* istanbul ignore else */
|
|
@@ -341,172 +353,161 @@ class SkyTextEditorSelectionService {
|
|
|
341
353
|
/* istanbul ignore else */
|
|
342
354
|
if (windowEl.getSelection) {
|
|
343
355
|
const sel = windowEl.getSelection();
|
|
344
|
-
sel
|
|
356
|
+
sel?.removeAllRanges();
|
|
345
357
|
const range = documentEl.createRange();
|
|
346
358
|
range.selectNodeContents(element);
|
|
347
|
-
sel
|
|
359
|
+
sel?.addRange(range);
|
|
348
360
|
}
|
|
349
361
|
else if (documentEl.getSelection) {
|
|
350
362
|
const sel = documentEl.getSelection();
|
|
351
|
-
sel
|
|
363
|
+
sel?.removeAllRanges();
|
|
352
364
|
const range = documentEl.createRange();
|
|
353
365
|
range.selectNodeContents(element);
|
|
354
|
-
sel
|
|
366
|
+
sel?.addRange(range);
|
|
355
367
|
}
|
|
356
368
|
}
|
|
357
369
|
}
|
|
358
370
|
}
|
|
359
|
-
SkyTextEditorSelectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
360
|
-
SkyTextEditorSelectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
361
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
362
|
-
type: Injectable
|
|
363
|
-
args: [{
|
|
364
|
-
providedIn: 'root',
|
|
365
|
-
}]
|
|
371
|
+
SkyTextEditorSelectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorSelectionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
372
|
+
SkyTextEditorSelectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorSelectionService });
|
|
373
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorSelectionService, decorators: [{
|
|
374
|
+
type: Injectable
|
|
366
375
|
}] });
|
|
367
376
|
|
|
377
|
+
var _SkyTextEditorService__editor;
|
|
368
378
|
/**
|
|
369
379
|
* @internal
|
|
370
380
|
*/
|
|
371
381
|
class SkyTextEditorService {
|
|
372
382
|
constructor() {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
383
|
+
_SkyTextEditorService__editor.set(this, void 0);
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* A dictionary representing all active text editors and their settings.
|
|
387
|
+
*/
|
|
388
|
+
set editor(value) {
|
|
389
|
+
__classPrivateFieldSet(this, _SkyTextEditorService__editor, value, "f");
|
|
390
|
+
}
|
|
391
|
+
get editor() {
|
|
392
|
+
if (!__classPrivateFieldGet(this, _SkyTextEditorService__editor, "f")) {
|
|
393
|
+
throw new Error('Editor has not been initialized.');
|
|
394
|
+
}
|
|
395
|
+
return __classPrivateFieldGet(this, _SkyTextEditorService__editor, "f");
|
|
377
396
|
}
|
|
378
397
|
/**
|
|
379
398
|
* Returns the blur observable from the editor with the corresponding id.
|
|
380
399
|
*/
|
|
381
|
-
blurListener(
|
|
382
|
-
return this.
|
|
400
|
+
blurListener() {
|
|
401
|
+
return this.editor.blurObservable;
|
|
383
402
|
}
|
|
384
403
|
/**
|
|
385
404
|
* Returns the click observable from the editor with the corresponding id.
|
|
386
405
|
*/
|
|
387
|
-
clickListener(
|
|
388
|
-
return this.
|
|
406
|
+
clickListener() {
|
|
407
|
+
return this.editor.clickObservable;
|
|
389
408
|
}
|
|
390
409
|
/**
|
|
391
410
|
* Returns the command change observable from the editor with the corresponding id.
|
|
392
411
|
*/
|
|
393
|
-
commandChangeListener(
|
|
394
|
-
return this.
|
|
412
|
+
commandChangeListener() {
|
|
413
|
+
return this.editor.commandChangeObservable;
|
|
395
414
|
}
|
|
396
415
|
/**
|
|
397
416
|
* Returns the input change observable from the editor with the corresponding id.
|
|
398
417
|
*/
|
|
399
|
-
inputListener(
|
|
400
|
-
return this.
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Removes editor from the `editors` index by id.
|
|
404
|
-
*/
|
|
405
|
-
removeEditor(id) {
|
|
406
|
-
/* istanbul ignore else */
|
|
407
|
-
if (id in this.editors) {
|
|
408
|
-
delete this.editors[id];
|
|
409
|
-
}
|
|
418
|
+
inputListener() {
|
|
419
|
+
return this.editor.inputObservable;
|
|
410
420
|
}
|
|
411
421
|
/**
|
|
412
422
|
* Returns the selection change observable from the editor with the corresponding id.
|
|
413
423
|
*/
|
|
414
|
-
selectionChangeListener(
|
|
415
|
-
return this.
|
|
424
|
+
selectionChangeListener() {
|
|
425
|
+
return this.editor.selectionChangeObservable;
|
|
416
426
|
}
|
|
417
427
|
}
|
|
418
|
-
|
|
419
|
-
SkyTextEditorService.ɵ
|
|
420
|
-
i0.ɵɵ
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
providedIn: 'root',
|
|
424
|
-
}]
|
|
428
|
+
_SkyTextEditorService__editor = new WeakMap();
|
|
429
|
+
SkyTextEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
430
|
+
SkyTextEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorService });
|
|
431
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorService, decorators: [{
|
|
432
|
+
type: Injectable
|
|
425
433
|
}] });
|
|
426
434
|
|
|
435
|
+
var _SkyTextEditorAdapterService_instances, _SkyTextEditorAdapterService_selectionService, _SkyTextEditorAdapterService_textEditorService, _SkyTextEditorAdapterService_windowRef, _SkyTextEditorAdapterService_getContentWindowEl, _SkyTextEditorAdapterService_getChildSelectedAnchorTags, _SkyTextEditorAdapterService_getIframeDocumentEl, _SkyTextEditorAdapterService_getFontSize, _SkyTextEditorAdapterService_createObservers, _SkyTextEditorAdapterService_getPasteOverride, _SkyTextEditorAdapterService_getCurrentSelectionParentElement, _SkyTextEditorAdapterService_getColor, _SkyTextEditorAdapterService_hasLink, _SkyTextEditorAdapterService_getParent, _SkyTextEditorAdapterService_cleanUpBlankStyleTags, _SkyTextEditorAdapterService_replaceHtmlCodes, _SkyTextEditorAdapterService_setEditorDisabled;
|
|
427
436
|
/**
|
|
428
437
|
* @internal
|
|
429
438
|
*/
|
|
430
439
|
class SkyTextEditorAdapterService {
|
|
431
440
|
constructor(selectionService, textEditorService, windowService) {
|
|
432
|
-
this
|
|
433
|
-
this
|
|
434
|
-
this
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
441
|
+
_SkyTextEditorAdapterService_instances.add(this);
|
|
442
|
+
_SkyTextEditorAdapterService_selectionService.set(this, void 0);
|
|
443
|
+
_SkyTextEditorAdapterService_textEditorService.set(this, void 0);
|
|
444
|
+
_SkyTextEditorAdapterService_windowRef.set(this, void 0);
|
|
445
|
+
__classPrivateFieldSet(this, _SkyTextEditorAdapterService_selectionService, selectionService, "f");
|
|
446
|
+
__classPrivateFieldSet(this, _SkyTextEditorAdapterService_textEditorService, textEditorService, "f");
|
|
447
|
+
__classPrivateFieldSet(this, _SkyTextEditorAdapterService_windowRef, windowService, "f");
|
|
438
448
|
}
|
|
439
449
|
/**
|
|
440
450
|
* Creates a text editor inside the supplied iframe element.
|
|
441
451
|
*/
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
documentEl.body.setAttribute('style', bodyStyle);
|
|
471
|
-
documentEl.body.setAttribute('data-placeholder', placeholder || '');
|
|
472
|
-
}
|
|
452
|
+
initEditor(id, iframeElement, styleState, placeholder) {
|
|
453
|
+
__classPrivateFieldGet(this, _SkyTextEditorAdapterService_textEditorService, "f").editor = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_createObservers).call(this, iframeElement);
|
|
454
|
+
const documentEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this);
|
|
455
|
+
const styleEl = documentEl.createElement('style');
|
|
456
|
+
styleEl.innerHTML = `.editor:empty:before {
|
|
457
|
+
content: attr(data-placeholder);
|
|
458
|
+
font-family: "Blackbaud Sans", Arial, sans-serif;
|
|
459
|
+
color: #686c73;
|
|
460
|
+
font-weight: 400;
|
|
461
|
+
font-size: 15px;
|
|
462
|
+
font-style: italic;
|
|
463
|
+
}`;
|
|
464
|
+
documentEl.head.appendChild(styleEl);
|
|
465
|
+
const style = {
|
|
466
|
+
...STYLE_STATE_DEFAULTS,
|
|
467
|
+
...styleState,
|
|
468
|
+
};
|
|
469
|
+
const bodyStyle = `background-color: ${style.backColor};
|
|
470
|
+
color: ${style.fontColor};
|
|
471
|
+
font-family: ${style.font};
|
|
472
|
+
font-size: ${style.fontSize}px`;
|
|
473
|
+
documentEl.querySelector('html')?.setAttribute('lang', 'en');
|
|
474
|
+
documentEl.body.setAttribute('contenteditable', 'true');
|
|
475
|
+
documentEl.body.setAttribute('id', id);
|
|
476
|
+
documentEl.body.setAttribute('role', 'main');
|
|
477
|
+
documentEl.body.setAttribute('class', 'editor');
|
|
478
|
+
documentEl.body.setAttribute('style', bodyStyle);
|
|
479
|
+
documentEl.body.setAttribute('data-placeholder', placeholder || '');
|
|
473
480
|
}
|
|
474
|
-
disableEditor(
|
|
475
|
-
this.
|
|
481
|
+
disableEditor(focusableChildren, textEditorNativeElement) {
|
|
482
|
+
__classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_setEditorDisabled).call(this, focusableChildren, textEditorNativeElement, true);
|
|
476
483
|
}
|
|
477
|
-
enableEditor(
|
|
478
|
-
this.
|
|
484
|
+
enableEditor(focusableChildren, textEditorNativeElement) {
|
|
485
|
+
__classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_setEditorDisabled).call(this, focusableChildren, textEditorNativeElement, false);
|
|
479
486
|
}
|
|
480
487
|
/**
|
|
481
488
|
* Executes a command on the text editor with the corresponding id.
|
|
482
489
|
*/
|
|
483
|
-
execCommand(
|
|
490
|
+
execCommand(editorCommand) {
|
|
484
491
|
/* istanbul ignore else */
|
|
485
|
-
if (
|
|
486
|
-
const documentEl = this.
|
|
492
|
+
if (__classPrivateFieldGet(this, _SkyTextEditorAdapterService_textEditorService, "f").editor) {
|
|
493
|
+
const documentEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this);
|
|
487
494
|
/* istanbul ignore else */
|
|
488
|
-
if (this.editorSelected(
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
if (editorCommand.command.toLowerCase() === 'inserthtml' &&
|
|
493
|
-
!commandIsSupportedAndEnabled) {
|
|
494
|
-
this.insertHtmlInIE11(id, editorCommand.value);
|
|
495
|
-
}
|
|
496
|
-
this.focusEditor(id);
|
|
497
|
-
this.editors[id].commandChangeObservable.next();
|
|
495
|
+
if (this.editorSelected()) {
|
|
496
|
+
documentEl.execCommand(editorCommand.command, false, editorCommand.value);
|
|
497
|
+
this.focusEditor();
|
|
498
|
+
__classPrivateFieldGet(this, _SkyTextEditorAdapterService_textEditorService, "f").editor.commandChangeObservable.next();
|
|
498
499
|
}
|
|
499
500
|
}
|
|
500
501
|
}
|
|
501
|
-
getCurrentSelection(
|
|
502
|
-
return this.
|
|
502
|
+
getCurrentSelection() {
|
|
503
|
+
return __classPrivateFieldGet(this, _SkyTextEditorAdapterService_selectionService, "f").getCurrentSelection(__classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this));
|
|
503
504
|
}
|
|
504
505
|
/**
|
|
505
506
|
* Returns a data URI using the provided text string.
|
|
506
507
|
* Used to display a merge field inside a string of text.
|
|
507
508
|
*/
|
|
508
509
|
getMergeFieldDataURI(text) {
|
|
509
|
-
const documentEl = this.
|
|
510
|
+
const documentEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_windowRef, "f").nativeWindow.document;
|
|
510
511
|
let textToUse = text;
|
|
511
512
|
if (text.length > 18) {
|
|
512
513
|
textToUse = text.substr(0, 15) + '...';
|
|
@@ -531,81 +532,73 @@ class SkyTextEditorAdapterService {
|
|
|
531
532
|
const result = canvasElement.toDataURL('image/png', 1.0);
|
|
532
533
|
return result;
|
|
533
534
|
}
|
|
534
|
-
getStyleState(
|
|
535
|
-
const documentEl = this.
|
|
535
|
+
getStyleState() {
|
|
536
|
+
const documentEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this);
|
|
536
537
|
/* istanbul ignore else */
|
|
537
|
-
if (this.editorSelected(
|
|
538
|
+
if (this.editorSelected()) {
|
|
538
539
|
return {
|
|
539
|
-
backColor: this.
|
|
540
|
-
fontColor: this.
|
|
541
|
-
fontSize: parseInt(this.
|
|
540
|
+
backColor: __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getColor).call(this, documentEl, 'BackColor'),
|
|
541
|
+
fontColor: __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getColor).call(this, documentEl, 'ForeColor'),
|
|
542
|
+
fontSize: parseInt(__classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getFontSize).call(this), undefined),
|
|
542
543
|
font: documentEl.queryCommandValue('fontname'),
|
|
543
544
|
boldState: documentEl.queryCommandState('Bold'),
|
|
544
545
|
italicState: documentEl.queryCommandState('Italic'),
|
|
545
546
|
underlineState: documentEl.queryCommandState('Underline'),
|
|
546
|
-
linkState: this.
|
|
547
|
+
linkState: __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_hasLink).call(this),
|
|
547
548
|
};
|
|
548
549
|
}
|
|
549
550
|
/* istanbul ignore next */
|
|
550
551
|
return {};
|
|
551
552
|
}
|
|
552
|
-
getEditorInnerHtml(
|
|
553
|
-
const documentEl = this.
|
|
553
|
+
getEditorInnerHtml() {
|
|
554
|
+
const documentEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this);
|
|
554
555
|
if (documentEl) {
|
|
555
|
-
return this.
|
|
556
|
+
return __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_replaceHtmlCodes).call(this, documentEl.body.innerHTML);
|
|
556
557
|
}
|
|
557
558
|
return '';
|
|
558
559
|
}
|
|
559
|
-
setEditorInnerHtml(
|
|
560
|
-
const documentEl = this.
|
|
560
|
+
setEditorInnerHtml(value) {
|
|
561
|
+
const documentEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this);
|
|
561
562
|
const editorContent = documentEl.body;
|
|
562
563
|
/* istanbul ignore else */
|
|
563
564
|
if (editorContent.innerHTML !== value) {
|
|
564
565
|
editorContent.innerHTML = value;
|
|
565
566
|
}
|
|
566
567
|
}
|
|
567
|
-
focusEditor(
|
|
568
|
+
focusEditor() {
|
|
568
569
|
/* istanbul ignore else */
|
|
569
|
-
if (
|
|
570
|
-
const windowEl = this.
|
|
571
|
-
const iframeDocumentEl = this.
|
|
572
|
-
const currentSelection = this.
|
|
570
|
+
if (__classPrivateFieldGet(this, _SkyTextEditorAdapterService_textEditorService, "f").editor) {
|
|
571
|
+
const windowEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getContentWindowEl).call(this);
|
|
572
|
+
const iframeDocumentEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this);
|
|
573
|
+
const currentSelection = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_selectionService, "f").getCurrentSelectionRange(iframeDocumentEl, windowEl);
|
|
573
574
|
const cursorIsNotActiveAndHasReset = currentSelection &&
|
|
574
575
|
currentSelection.startOffset === 0 &&
|
|
575
576
|
currentSelection.endOffset === 0;
|
|
576
|
-
if (!this.editorSelected(
|
|
577
|
+
if (!this.editorSelected() || cursorIsNotActiveAndHasReset) {
|
|
577
578
|
// focus the end of the editor
|
|
578
|
-
const documentEl = this.
|
|
579
|
+
const documentEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_windowRef, "f").nativeWindow.document;
|
|
579
580
|
const editor = iframeDocumentEl.body;
|
|
580
581
|
const range = documentEl.createRange();
|
|
581
|
-
this.
|
|
582
|
+
__classPrivateFieldGet(this, _SkyTextEditorAdapterService_textEditorService, "f").editor.iframeElementRef.focus();
|
|
582
583
|
editor.focus();
|
|
583
|
-
/* istanbul ignore else */
|
|
584
584
|
if (windowEl.getSelection && documentEl.createRange) {
|
|
585
585
|
range.selectNodeContents(editor);
|
|
586
586
|
range.collapse(false);
|
|
587
587
|
const sel = windowEl.getSelection();
|
|
588
|
-
sel
|
|
589
|
-
sel
|
|
590
|
-
}
|
|
591
|
-
else {
|
|
592
|
-
// IE only
|
|
593
|
-
const textRange = editor.createTextRange();
|
|
594
|
-
textRange.moveToElementText(editor);
|
|
595
|
-
textRange.collapse(false);
|
|
596
|
-
textRange.select();
|
|
588
|
+
sel?.removeAllRanges();
|
|
589
|
+
sel?.addRange(range);
|
|
597
590
|
}
|
|
598
591
|
}
|
|
599
592
|
else {
|
|
600
593
|
// Cursor may not be active, restore it
|
|
601
|
-
this.
|
|
594
|
+
__classPrivateFieldGet(this, _SkyTextEditorAdapterService_textEditorService, "f").editor.iframeElementRef.focus();
|
|
602
595
|
iframeDocumentEl.body.focus();
|
|
603
596
|
}
|
|
604
597
|
}
|
|
605
598
|
}
|
|
606
|
-
getLink(
|
|
607
|
-
let link
|
|
608
|
-
const anchorEl = this.getSelectedAnchorTag(
|
|
599
|
+
getLink() {
|
|
600
|
+
let link;
|
|
601
|
+
const anchorEl = this.getSelectedAnchorTag();
|
|
609
602
|
if (anchorEl && anchorEl.href) {
|
|
610
603
|
link = {
|
|
611
604
|
target: anchorEl.getAttribute('target') === '_blank'
|
|
@@ -616,31 +609,35 @@ class SkyTextEditorAdapterService {
|
|
|
616
609
|
}
|
|
617
610
|
return link;
|
|
618
611
|
}
|
|
619
|
-
getSelectedAnchorTag(
|
|
620
|
-
const selectedEl = this.
|
|
621
|
-
|
|
612
|
+
getSelectedAnchorTag() {
|
|
613
|
+
const selectedEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getCurrentSelectionParentElement).call(this);
|
|
614
|
+
if (selectedEl) {
|
|
615
|
+
return __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getParent).call(this, selectedEl, 'a');
|
|
616
|
+
}
|
|
617
|
+
/* istanbul ignore next */
|
|
618
|
+
return undefined;
|
|
622
619
|
}
|
|
623
|
-
saveSelection(
|
|
624
|
-
return this.
|
|
620
|
+
saveSelection() {
|
|
621
|
+
return __classPrivateFieldGet(this, _SkyTextEditorAdapterService_selectionService, "f").getCurrentSelectionRange(__classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this), __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getContentWindowEl).call(this));
|
|
625
622
|
}
|
|
626
|
-
selectElement(
|
|
627
|
-
this.
|
|
623
|
+
selectElement(element) {
|
|
624
|
+
__classPrivateFieldGet(this, _SkyTextEditorAdapterService_selectionService, "f").selectElement(__classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this), __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getContentWindowEl).call(this), element);
|
|
628
625
|
}
|
|
629
|
-
setPlaceholder(
|
|
630
|
-
const documentEl = this.
|
|
626
|
+
setPlaceholder(placeholder) {
|
|
627
|
+
const documentEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this);
|
|
631
628
|
documentEl.body.setAttribute('data-placeholder', placeholder || '');
|
|
632
629
|
}
|
|
633
|
-
setFontSize(
|
|
634
|
-
const doc = this.
|
|
635
|
-
this.execCommand(
|
|
630
|
+
setFontSize(fontSize) {
|
|
631
|
+
const doc = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this);
|
|
632
|
+
this.execCommand({ command: 'fontSize', value: '1' });
|
|
636
633
|
const fontElements = Array.from(doc.querySelectorAll('font[size="1"]'));
|
|
637
634
|
for (const element of fontElements) {
|
|
638
635
|
element.removeAttribute('size');
|
|
639
636
|
element.style.fontSize = fontSize + 'px';
|
|
640
637
|
}
|
|
641
|
-
this.
|
|
642
|
-
this.focusEditor(
|
|
643
|
-
this.
|
|
638
|
+
__classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_cleanUpBlankStyleTags).call(this, doc);
|
|
639
|
+
this.focusEditor();
|
|
640
|
+
__classPrivateFieldGet(this, _SkyTextEditorAdapterService_textEditorService, "f").editor.commandChangeObservable.next();
|
|
644
641
|
}
|
|
645
642
|
removeObservers(setting) {
|
|
646
643
|
/* istanbul ignore next */
|
|
@@ -650,28 +647,36 @@ class SkyTextEditorAdapterService {
|
|
|
650
647
|
setting.selectionChangeObservable.complete();
|
|
651
648
|
setting.clickObservable.complete();
|
|
652
649
|
setting.commandChangeObservable.complete();
|
|
653
|
-
documentEl
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
getContentWindowEl(id) {
|
|
659
|
-
return this.editors[id].iframeElementRef.contentWindow;
|
|
660
|
-
}
|
|
661
|
-
getChildSelectedAnchorTags(editorId) {
|
|
662
|
-
const selectedRange = this.getCurrentSelection(editorId).getRangeAt(0);
|
|
663
|
-
if (selectedRange.toString().length <= 0) {
|
|
664
|
-
return [];
|
|
665
|
-
}
|
|
666
|
-
const parentElement = this.getCurrentSelectionParentElement(editorId);
|
|
667
|
-
let childElements = [];
|
|
668
|
-
/* istanbul ignore else */
|
|
669
|
-
if (parentElement) {
|
|
670
|
-
childElements = Array.from(parentElement.querySelectorAll('a'));
|
|
650
|
+
if (documentEl) {
|
|
651
|
+
documentEl.removeEventListener('selectionchange', setting.selectionListener);
|
|
652
|
+
documentEl.removeEventListener('input', setting.selectionListener);
|
|
653
|
+
documentEl.removeEventListener('mousedown', setting.clickListener);
|
|
654
|
+
documentEl.body.removeEventListener('paste', setting.pasteListener);
|
|
671
655
|
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
656
|
+
}
|
|
657
|
+
editorSelected() {
|
|
658
|
+
const documentEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this);
|
|
659
|
+
return __classPrivateFieldGet(this, _SkyTextEditorAdapterService_selectionService, "f").isElementSelected(documentEl, documentEl.body);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
_SkyTextEditorAdapterService_selectionService = new WeakMap(), _SkyTextEditorAdapterService_textEditorService = new WeakMap(), _SkyTextEditorAdapterService_windowRef = new WeakMap(), _SkyTextEditorAdapterService_instances = new WeakSet(), _SkyTextEditorAdapterService_getContentWindowEl = function _SkyTextEditorAdapterService_getContentWindowEl() {
|
|
663
|
+
return __classPrivateFieldGet(this, _SkyTextEditorAdapterService_textEditorService, "f").editor.iframeElementRef
|
|
664
|
+
.contentWindow;
|
|
665
|
+
}, _SkyTextEditorAdapterService_getChildSelectedAnchorTags = function _SkyTextEditorAdapterService_getChildSelectedAnchorTags() {
|
|
666
|
+
const selectedRange = this.getCurrentSelection()?.getRangeAt(0);
|
|
667
|
+
if (selectedRange && selectedRange.toString().length <= 0) {
|
|
668
|
+
return [];
|
|
669
|
+
}
|
|
670
|
+
const parentElement = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getCurrentSelectionParentElement).call(this);
|
|
671
|
+
let childElements = [];
|
|
672
|
+
/* istanbul ignore else */
|
|
673
|
+
if (parentElement) {
|
|
674
|
+
childElements = Array.from(parentElement.querySelectorAll('a'));
|
|
675
|
+
}
|
|
676
|
+
/* istanbul ignore next */
|
|
677
|
+
return childElements.filter((element) => {
|
|
678
|
+
// IE specific
|
|
679
|
+
if (selectedRange) {
|
|
675
680
|
if (!selectedRange.intersectsNode) {
|
|
676
681
|
if (!element || !element.href) {
|
|
677
682
|
return false;
|
|
@@ -681,381 +686,339 @@ class SkyTextEditorAdapterService {
|
|
|
681
686
|
return ((selectedRange.compareBoundaryPoints(Range.START_TO_START, tempRange) !== -1 &&
|
|
682
687
|
selectedRange.compareBoundaryPoints(Range.START_TO_END, tempRange) !== 1) ||
|
|
683
688
|
(selectedRange.compareBoundaryPoints(Range.END_TO_START, tempRange) !== -1 &&
|
|
684
|
-
selectedRange.compareBoundaryPoints(Range.END_TO_END, tempRange) !==
|
|
685
|
-
1));
|
|
689
|
+
selectedRange.compareBoundaryPoints(Range.END_TO_END, tempRange) !== 1));
|
|
686
690
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
691
|
+
}
|
|
692
|
+
// Normal non-IE
|
|
693
|
+
return (!!element && !!element.href && selectedRange?.intersectsNode(element));
|
|
694
|
+
});
|
|
695
|
+
}, _SkyTextEditorAdapterService_getIframeDocumentEl = function _SkyTextEditorAdapterService_getIframeDocumentEl() {
|
|
696
|
+
const contentWindowEl = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getContentWindowEl).call(this);
|
|
697
|
+
/* istanbul ignore else */
|
|
698
|
+
if (contentWindowEl) {
|
|
699
|
+
return contentWindowEl.document;
|
|
690
700
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
701
|
+
/* istanbul ignore next */
|
|
702
|
+
return __classPrivateFieldGet(this, _SkyTextEditorAdapterService_textEditorService, "f").editor.iframeElementRef
|
|
703
|
+
.contentDocument;
|
|
704
|
+
}, _SkyTextEditorAdapterService_getFontSize = function _SkyTextEditorAdapterService_getFontSize() {
|
|
705
|
+
let fontSize = STYLE_STATE_DEFAULTS.fontSize.toString();
|
|
706
|
+
const selection = this.getCurrentSelection();
|
|
707
|
+
/* istanbul ignore else */
|
|
708
|
+
if (selection &&
|
|
709
|
+
selection.anchorNode &&
|
|
710
|
+
selection.anchorNode.parentElement) {
|
|
711
|
+
let element = selection.anchorNode;
|
|
712
|
+
if (element?.nodeType !== 1) {
|
|
713
|
+
element = element?.parentElement;
|
|
695
714
|
}
|
|
696
|
-
const
|
|
715
|
+
const computedStyle = window.getComputedStyle(element);
|
|
697
716
|
/* istanbul ignore else */
|
|
698
|
-
if (
|
|
699
|
-
|
|
717
|
+
if (computedStyle) {
|
|
718
|
+
fontSize = computedStyle.getPropertyValue('font-size');
|
|
700
719
|
}
|
|
701
|
-
/* istanbul ignore next */
|
|
702
|
-
return this.editors[id].iframeElementRef.contentDocument;
|
|
703
720
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
721
|
+
return fontSize;
|
|
722
|
+
}, _SkyTextEditorAdapterService_createObservers = function _SkyTextEditorAdapterService_createObservers(element) {
|
|
723
|
+
/* istanbul ignore next */
|
|
724
|
+
const documentEl = element.contentWindow
|
|
725
|
+
? element.contentWindow.document
|
|
726
|
+
: element.contentDocument;
|
|
727
|
+
// Firefox bug where we need to open/close to cancel load so it doesn't overwrite attrs
|
|
728
|
+
documentEl.open();
|
|
729
|
+
documentEl.close();
|
|
730
|
+
const selectionObservable = new Subject();
|
|
731
|
+
const selectionListener = () => selectionObservable.next();
|
|
732
|
+
const clickObservable = new Subject();
|
|
733
|
+
const clickListener = () => clickObservable.next();
|
|
734
|
+
const pasteListener = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getPasteOverride).call(this);
|
|
735
|
+
const blurObservable = new Subject();
|
|
736
|
+
const blurListener = () => blurObservable.next();
|
|
737
|
+
const inputObservable = new Subject();
|
|
738
|
+
const inputListener = () => inputObservable.next();
|
|
739
|
+
documentEl.addEventListener('selectionchange', selectionListener);
|
|
740
|
+
documentEl.addEventListener('input', inputListener);
|
|
741
|
+
documentEl.addEventListener('mousedown', clickListener);
|
|
742
|
+
documentEl.body.addEventListener('paste', pasteListener);
|
|
743
|
+
documentEl.body.addEventListener('blur', blurListener);
|
|
744
|
+
return {
|
|
745
|
+
blurObservable,
|
|
746
|
+
clickObservable,
|
|
747
|
+
commandChangeObservable: new Subject(),
|
|
748
|
+
iframeElementRef: element,
|
|
749
|
+
inputObservable,
|
|
750
|
+
selectionChangeObservable: selectionObservable,
|
|
751
|
+
blurListener,
|
|
752
|
+
clickListener,
|
|
753
|
+
inputListener,
|
|
754
|
+
pasteListener,
|
|
755
|
+
selectionListener,
|
|
756
|
+
};
|
|
757
|
+
}, _SkyTextEditorAdapterService_getPasteOverride = function _SkyTextEditorAdapterService_getPasteOverride() {
|
|
758
|
+
/* istanbul ignore next */
|
|
759
|
+
return (e) => {
|
|
760
|
+
e.preventDefault();
|
|
761
|
+
const text = e.clipboardData?.getData('text/plain');
|
|
762
|
+
if (text !== undefined) {
|
|
763
|
+
this.execCommand({ command: 'insertHTML', value: text.toString() });
|
|
720
764
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
765
|
+
};
|
|
766
|
+
}, _SkyTextEditorAdapterService_getCurrentSelectionParentElement = function _SkyTextEditorAdapterService_getCurrentSelectionParentElement() {
|
|
767
|
+
return __classPrivateFieldGet(this, _SkyTextEditorAdapterService_selectionService, "f").getCurrentSelectionParentElement(__classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this));
|
|
768
|
+
}, _SkyTextEditorAdapterService_getColor = function _SkyTextEditorAdapterService_getColor(documentEl, selector) {
|
|
769
|
+
const commandValue = documentEl.queryCommandValue(selector);
|
|
770
|
+
// Edge is weird and returns numbers
|
|
771
|
+
/* istanbul ignore if */
|
|
772
|
+
if (typeof commandValue === 'number') {
|
|
724
773
|
/* istanbul ignore next */
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
const clickListener = () => clickObservable.next();
|
|
735
|
-
const pasteListener = this.getPasteOverride(id);
|
|
736
|
-
const blurObservable = new Subject();
|
|
737
|
-
const blurListener = () => blurObservable.next();
|
|
738
|
-
const inputObservable = new Subject();
|
|
739
|
-
const inputListener = () => inputObservable.next();
|
|
740
|
-
documentEl.addEventListener('selectionchange', selectionListener);
|
|
741
|
-
documentEl.addEventListener('input', inputListener);
|
|
742
|
-
documentEl.addEventListener('mousedown', clickListener);
|
|
743
|
-
documentEl.body.addEventListener('paste', pasteListener);
|
|
744
|
-
documentEl.body.addEventListener('blur', blurListener);
|
|
745
|
-
return {
|
|
746
|
-
blurObservable: blurObservable,
|
|
747
|
-
clickObservable: clickObservable,
|
|
748
|
-
commandChangeObservable: new Subject(),
|
|
749
|
-
iframeElementRef: element,
|
|
750
|
-
inputObservable: inputObservable,
|
|
751
|
-
selectionChangeObservable: selectionObservable,
|
|
752
|
-
blurListener: blurListener,
|
|
753
|
-
clickListener: clickListener,
|
|
754
|
-
inputListener: inputListener,
|
|
755
|
-
pasteListener: pasteListener,
|
|
756
|
-
selectionListener: selectionListener,
|
|
757
|
-
};
|
|
758
|
-
}
|
|
774
|
+
return ('rgb(' +
|
|
775
|
+
(commandValue & 0xff) +
|
|
776
|
+
', ' +
|
|
777
|
+
((commandValue & 0xff00) >> 8) +
|
|
778
|
+
', ' +
|
|
779
|
+
((commandValue & 0xff0000) >> 16) +
|
|
780
|
+
')');
|
|
781
|
+
}
|
|
782
|
+
// Firefox uses 'Transparent' instead of a color value
|
|
759
783
|
/* istanbul ignore next */
|
|
760
|
-
|
|
761
|
-
return
|
|
762
|
-
e.preventDefault();
|
|
763
|
-
const text = e.clipboardData.getData('text/plain');
|
|
764
|
-
this.execCommand(id, { command: 'insertHTML', value: text });
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
|
-
getCurrentSelectionParentElement(id) {
|
|
768
|
-
return this.selectionService.getCurrentSelectionParentElement(this.getIframeDocumentEl(id));
|
|
784
|
+
if (commandValue.toString().toLowerCase() === 'transparent') {
|
|
785
|
+
return STYLE_STATE_DEFAULTS.backColor;
|
|
769
786
|
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
((commandValue & 0xff0000) >> 16) +
|
|
782
|
-
')');
|
|
783
|
-
}
|
|
784
|
-
// Firefox uses 'Transparent' instead of a color value
|
|
785
|
-
/* istanbul ignore next */
|
|
786
|
-
if (commandValue.toString().toLowerCase() === 'transparent') {
|
|
787
|
-
return STYLE_STATE_DEFAULTS.backColor;
|
|
787
|
+
return commandValue;
|
|
788
|
+
}, _SkyTextEditorAdapterService_hasLink = function _SkyTextEditorAdapterService_hasLink() {
|
|
789
|
+
const anchorEl = this.getSelectedAnchorTag();
|
|
790
|
+
const childAnchorEls = __classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getChildSelectedAnchorTags).call(this);
|
|
791
|
+
/* istanbul ignore next */
|
|
792
|
+
return childAnchorEls.length > 0 || (!!anchorEl && !!anchorEl.href);
|
|
793
|
+
}, _SkyTextEditorAdapterService_getParent = function _SkyTextEditorAdapterService_getParent(element, tag) {
|
|
794
|
+
let currentNode = element;
|
|
795
|
+
while (currentNode && currentNode.tagName.toUpperCase() !== 'BODY') {
|
|
796
|
+
if (currentNode.tagName.toUpperCase() === tag.toUpperCase()) {
|
|
797
|
+
return currentNode;
|
|
788
798
|
}
|
|
789
|
-
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
getParent(element, tag) {
|
|
798
|
-
let currentNode = element;
|
|
799
|
-
while (currentNode && currentNode.tagName.toUpperCase() !== 'BODY') {
|
|
800
|
-
if (currentNode.tagName.toUpperCase() === tag.toUpperCase()) {
|
|
801
|
-
return currentNode;
|
|
802
|
-
}
|
|
803
|
-
currentNode = currentNode.parentElement;
|
|
799
|
+
currentNode = currentNode.parentElement;
|
|
800
|
+
}
|
|
801
|
+
return undefined;
|
|
802
|
+
}, _SkyTextEditorAdapterService_cleanUpBlankStyleTags = function _SkyTextEditorAdapterService_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');
|
|
804
807
|
}
|
|
805
|
-
return undefined;
|
|
806
|
-
}
|
|
807
|
-
editorSelected(id) {
|
|
808
|
-
const documentEl = this.getIframeDocumentEl(id);
|
|
809
|
-
return this.selectionService.isElementSelected(documentEl, documentEl.body);
|
|
810
808
|
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
let node, lastNode;
|
|
823
|
-
while (el.firstChild) {
|
|
824
|
-
node = el.firstChild;
|
|
825
|
-
lastNode = frag.appendChild(node);
|
|
826
|
-
}
|
|
827
|
-
range.insertNode(frag);
|
|
828
|
-
// Preserve the selection
|
|
829
|
-
if (lastNode) {
|
|
830
|
-
range = range.cloneRange();
|
|
831
|
-
range.setStartAfter(lastNode);
|
|
832
|
-
range.collapse(true);
|
|
833
|
-
sel.removeAllRanges();
|
|
834
|
-
sel.addRange(range);
|
|
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);
|
|
835
820
|
}
|
|
821
|
+
parent.removeChild(element);
|
|
836
822
|
}
|
|
837
823
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
824
|
+
}, _SkyTextEditorAdapterService_replaceHtmlCodes = function _SkyTextEditorAdapterService_replaceHtmlCodes(str) {
|
|
825
|
+
return str
|
|
826
|
+
.replace(/ /, String.fromCharCode(160))
|
|
827
|
+
.replace(/</g, '<')
|
|
828
|
+
.replace(/>/g, '>')
|
|
829
|
+
.replace(/&/g, '&');
|
|
830
|
+
}, _SkyTextEditorAdapterService_setEditorDisabled = function _SkyTextEditorAdapterService_setEditorDisabled(focusableChildren, textEditorNativeElement, disabled) {
|
|
831
|
+
textEditorNativeElement.style.pointerEvents = disabled ? 'none' : 'auto';
|
|
832
|
+
textEditorNativeElement.setAttribute('aria-disabled', disabled ? 'true' : 'false');
|
|
833
|
+
/* istanbul ignore else */
|
|
834
|
+
if (focusableChildren.length > 0) {
|
|
835
|
+
focusableChildren.forEach((aFocusableChild) => {
|
|
836
|
+
aFocusableChild.tabIndex = disabled ? -1 : 0;
|
|
849
837
|
});
|
|
850
|
-
for (const element of removableElements) {
|
|
851
|
-
const parent = element.parentNode;
|
|
852
|
-
/* istanbul ignore else */
|
|
853
|
-
if (parent) {
|
|
854
|
-
while (element.firstChild) {
|
|
855
|
-
parent.insertBefore(element.firstChild, element);
|
|
856
|
-
}
|
|
857
|
-
parent.removeChild(element);
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
838
|
}
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
}
|
|
869
|
-
setEditorDisabled(id, focusableChildren, textEditorNativeElement, disabled) {
|
|
870
|
-
textEditorNativeElement.style.pointerEvents = disabled ? 'none' : 'auto';
|
|
871
|
-
textEditorNativeElement.setAttribute('aria-disabled', disabled ? 'true' : 'false');
|
|
872
|
-
/* istanbul ignore else */
|
|
873
|
-
if (focusableChildren.length > 0) {
|
|
874
|
-
focusableChildren.forEach((aFocusableChild) => {
|
|
875
|
-
aFocusableChild.tabIndex = disabled ? -1 : 0;
|
|
876
|
-
});
|
|
877
|
-
}
|
|
878
|
-
this.getIframeDocumentEl(id).body.setAttribute('contenteditable', disabled ? 'false' : 'true');
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
SkyTextEditorAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyTextEditorAdapterService, deps: [{ token: SkyTextEditorSelectionService }, { token: SkyTextEditorService }, { token: i3.SkyAppWindowRef }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
882
|
-
SkyTextEditorAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyTextEditorAdapterService, providedIn: 'root' });
|
|
883
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyTextEditorAdapterService, decorators: [{
|
|
884
|
-
type: Injectable,
|
|
885
|
-
args: [{
|
|
886
|
-
providedIn: 'root',
|
|
887
|
-
}]
|
|
888
|
-
}], ctorParameters: function () { return [{ type: SkyTextEditorSelectionService }, { type: SkyTextEditorService }, { type: i3.SkyAppWindowRef }]; } });
|
|
839
|
+
__classPrivateFieldGet(this, _SkyTextEditorAdapterService_instances, "m", _SkyTextEditorAdapterService_getIframeDocumentEl).call(this).body.setAttribute('contenteditable', disabled ? 'false' : 'true');
|
|
840
|
+
};
|
|
841
|
+
SkyTextEditorAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorAdapterService, deps: [{ token: SkyTextEditorSelectionService }, { token: SkyTextEditorService }, { token: i1$1.SkyAppWindowRef }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
842
|
+
SkyTextEditorAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorAdapterService });
|
|
843
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorAdapterService, decorators: [{
|
|
844
|
+
type: Injectable
|
|
845
|
+
}], ctorParameters: function () { return [{ type: SkyTextEditorSelectionService }, { type: SkyTextEditorService }, { type: i1$1.SkyAppWindowRef }]; } });
|
|
889
846
|
|
|
847
|
+
var _SkyTextEditorMenubarComponent_instances, _SkyTextEditorMenubarComponent__disabled, _SkyTextEditorMenubarComponent_ngUnsubscribe, _SkyTextEditorMenubarComponent_adapterService, _SkyTextEditorMenubarComponent_changeDetector, _SkyTextEditorMenubarComponent_resources, _SkyTextEditorMenubarComponent_closeDropdowns, _SkyTextEditorMenubarComponent_clearFormat;
|
|
848
|
+
const FORMAT_MENU_ACTION = 'skyux_text_editor_format_menu_action_';
|
|
849
|
+
const EDIT_MENU_ACTION = 'skyux_text_editor_edit_menu_action_';
|
|
890
850
|
/**
|
|
891
851
|
* @internal
|
|
892
852
|
*/
|
|
893
853
|
class SkyTextEditorMenubarComponent {
|
|
894
854
|
constructor(adapterService, changeDetector, resources) {
|
|
895
|
-
this
|
|
896
|
-
this.changeDetector = changeDetector;
|
|
897
|
-
this.resources = resources;
|
|
855
|
+
_SkyTextEditorMenubarComponent_instances.add(this);
|
|
898
856
|
this.editorFocusStream = new Subject();
|
|
899
857
|
this.menus = [];
|
|
900
858
|
this.mergeFields = [];
|
|
901
|
-
this
|
|
859
|
+
_SkyTextEditorMenubarComponent__disabled.set(this, false);
|
|
902
860
|
this.editDropdownStream = new Subject();
|
|
903
861
|
this.formatDropdownStream = new Subject();
|
|
904
862
|
this.mergeFieldDropdownStream = new Subject();
|
|
905
|
-
this
|
|
863
|
+
_SkyTextEditorMenubarComponent_ngUnsubscribe.set(this, new Subject());
|
|
864
|
+
_SkyTextEditorMenubarComponent_adapterService.set(this, void 0);
|
|
865
|
+
_SkyTextEditorMenubarComponent_changeDetector.set(this, void 0);
|
|
866
|
+
_SkyTextEditorMenubarComponent_resources.set(this, void 0);
|
|
867
|
+
__classPrivateFieldSet(this, _SkyTextEditorMenubarComponent_adapterService, adapterService, "f");
|
|
868
|
+
__classPrivateFieldSet(this, _SkyTextEditorMenubarComponent_changeDetector, changeDetector, "f");
|
|
869
|
+
__classPrivateFieldSet(this, _SkyTextEditorMenubarComponent_resources, resources, "f");
|
|
906
870
|
}
|
|
907
871
|
set disabled(value) {
|
|
908
872
|
const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);
|
|
909
873
|
if (coercedValue !== this.disabled) {
|
|
910
|
-
this
|
|
911
|
-
this.
|
|
874
|
+
__classPrivateFieldSet(this, _SkyTextEditorMenubarComponent__disabled, coercedValue, "f");
|
|
875
|
+
__classPrivateFieldGet(this, _SkyTextEditorMenubarComponent_changeDetector, "f").markForCheck();
|
|
912
876
|
}
|
|
913
877
|
}
|
|
914
878
|
get disabled() {
|
|
915
|
-
return this
|
|
879
|
+
return __classPrivateFieldGet(this, _SkyTextEditorMenubarComponent__disabled, "f");
|
|
916
880
|
}
|
|
917
881
|
ngOnInit() {
|
|
918
|
-
this.editorFocusStream
|
|
919
|
-
|
|
882
|
+
this.editorFocusStream
|
|
883
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyTextEditorMenubarComponent_ngUnsubscribe, "f")))
|
|
884
|
+
.subscribe(() => {
|
|
885
|
+
__classPrivateFieldGet(this, _SkyTextEditorMenubarComponent_instances, "m", _SkyTextEditorMenubarComponent_closeDropdowns).call(this);
|
|
920
886
|
});
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
.pipe(take(1))
|
|
887
|
+
__classPrivateFieldGet(this, _SkyTextEditorMenubarComponent_resources, "f")
|
|
888
|
+
.getStrings({
|
|
889
|
+
bold: FORMAT_MENU_ACTION + 'bold_label',
|
|
890
|
+
boldShort: FORMAT_MENU_ACTION + 'bold_key_shortcut',
|
|
891
|
+
italic: FORMAT_MENU_ACTION + 'italic_label',
|
|
892
|
+
italicShort: FORMAT_MENU_ACTION + 'italic_key_shortcut',
|
|
893
|
+
underline: FORMAT_MENU_ACTION + 'underline_label',
|
|
894
|
+
underlineShort: FORMAT_MENU_ACTION + 'underline_key_shortcut',
|
|
895
|
+
strikethrough: FORMAT_MENU_ACTION + 'strikethrough_label',
|
|
896
|
+
clearFormatting: FORMAT_MENU_ACTION + 'clear_formatting_label',
|
|
897
|
+
undo: EDIT_MENU_ACTION + 'undo_label',
|
|
898
|
+
undoShort: EDIT_MENU_ACTION + 'undo_key_shortcut',
|
|
899
|
+
redo: EDIT_MENU_ACTION + 'redo_label',
|
|
900
|
+
redoShort: EDIT_MENU_ACTION + 'redo_key_shortcut',
|
|
901
|
+
cut: EDIT_MENU_ACTION + 'cut_label',
|
|
902
|
+
cutShort: EDIT_MENU_ACTION + 'cut_key_shortcut',
|
|
903
|
+
copy: EDIT_MENU_ACTION + 'copy_label',
|
|
904
|
+
copyShort: EDIT_MENU_ACTION + 'copy_key_shortcut',
|
|
905
|
+
paste: EDIT_MENU_ACTION + 'paste_label',
|
|
906
|
+
pasteShort: EDIT_MENU_ACTION + 'paste_key_shortcut',
|
|
907
|
+
selectAll: EDIT_MENU_ACTION + 'select_all_label',
|
|
908
|
+
selectAllShort: EDIT_MENU_ACTION + 'select_all_key_shortcut',
|
|
909
|
+
})
|
|
910
|
+
.pipe(take(1), takeUntil(__classPrivateFieldGet(this, _SkyTextEditorMenubarComponent_ngUnsubscribe, "f")))
|
|
946
911
|
.subscribe((resources) => {
|
|
947
912
|
this.formatItems = [
|
|
948
913
|
{
|
|
949
914
|
function: () => this.execCommand('bold'),
|
|
950
|
-
label: resources
|
|
951
|
-
keyShortcut: resources
|
|
915
|
+
label: resources.bold,
|
|
916
|
+
keyShortcut: resources.boldShort,
|
|
952
917
|
},
|
|
953
918
|
{
|
|
954
919
|
function: () => this.execCommand('italic'),
|
|
955
|
-
label: resources
|
|
956
|
-
keyShortcut: resources
|
|
920
|
+
label: resources.italic,
|
|
921
|
+
keyShortcut: resources.italicShort,
|
|
957
922
|
},
|
|
958
923
|
{
|
|
959
924
|
function: () => this.execCommand('underline'),
|
|
960
|
-
label: resources
|
|
961
|
-
keyShortcut: resources
|
|
925
|
+
label: resources.underline,
|
|
926
|
+
keyShortcut: resources.underlineShort,
|
|
962
927
|
},
|
|
963
928
|
{
|
|
964
929
|
function: () => this.execCommand('strikethrough'),
|
|
965
|
-
label: resources
|
|
930
|
+
label: resources.strikethrough,
|
|
966
931
|
},
|
|
967
932
|
{
|
|
968
933
|
isDivider: true,
|
|
969
934
|
},
|
|
970
935
|
{
|
|
971
|
-
function: () => this.
|
|
972
|
-
label: resources
|
|
936
|
+
function: () => __classPrivateFieldGet(this, _SkyTextEditorMenubarComponent_instances, "m", _SkyTextEditorMenubarComponent_clearFormat).call(this),
|
|
937
|
+
label: resources.clearFormatting,
|
|
973
938
|
},
|
|
974
939
|
];
|
|
975
940
|
this.editItems = [
|
|
976
941
|
{
|
|
977
942
|
function: () => this.execCommand('undo'),
|
|
978
|
-
label: resources
|
|
979
|
-
keyShortcut: resources
|
|
943
|
+
label: resources.undo,
|
|
944
|
+
keyShortcut: resources.undoShort,
|
|
980
945
|
},
|
|
981
946
|
{
|
|
982
947
|
function: () => this.execCommand('redo'),
|
|
983
|
-
label: resources
|
|
984
|
-
keyShortcut: resources
|
|
948
|
+
label: resources.redo,
|
|
949
|
+
keyShortcut: resources.redoShort,
|
|
985
950
|
},
|
|
986
951
|
{
|
|
987
952
|
isDivider: true,
|
|
988
953
|
},
|
|
989
954
|
{
|
|
990
955
|
function: () => this.execCommand('cut'),
|
|
991
|
-
label: resources
|
|
992
|
-
keyShortcut: resources
|
|
956
|
+
label: resources.cut,
|
|
957
|
+
keyShortcut: resources.cutShort,
|
|
993
958
|
},
|
|
994
959
|
{
|
|
995
960
|
function: () => this.execCommand('copy'),
|
|
996
|
-
label: resources
|
|
997
|
-
keyShortcut: resources
|
|
961
|
+
label: resources.copy,
|
|
962
|
+
keyShortcut: resources.copyShort,
|
|
998
963
|
},
|
|
999
964
|
{
|
|
1000
965
|
function: () => this.execCommand('paste'),
|
|
1001
|
-
label: resources
|
|
1002
|
-
keyShortcut: resources
|
|
966
|
+
label: resources.paste,
|
|
967
|
+
keyShortcut: resources.pasteShort,
|
|
1003
968
|
},
|
|
1004
969
|
{
|
|
1005
970
|
isDivider: true,
|
|
1006
971
|
},
|
|
1007
972
|
{
|
|
1008
973
|
function: () => this.execCommand('selectAll'),
|
|
1009
|
-
label: resources
|
|
1010
|
-
keyShortcut: resources
|
|
974
|
+
label: resources.selectAll,
|
|
975
|
+
keyShortcut: resources.selectAllShort,
|
|
1011
976
|
},
|
|
1012
977
|
];
|
|
1013
978
|
});
|
|
1014
979
|
}
|
|
1015
980
|
ngOnDestroy() {
|
|
1016
|
-
this.
|
|
1017
|
-
this.
|
|
981
|
+
__classPrivateFieldGet(this, _SkyTextEditorMenubarComponent_ngUnsubscribe, "f").next();
|
|
982
|
+
__classPrivateFieldGet(this, _SkyTextEditorMenubarComponent_ngUnsubscribe, "f").complete();
|
|
1018
983
|
}
|
|
1019
984
|
execCommand(command, value = '') {
|
|
1020
|
-
this.
|
|
985
|
+
__classPrivateFieldGet(this, _SkyTextEditorMenubarComponent_adapterService, "f").execCommand({
|
|
1021
986
|
command: command,
|
|
1022
987
|
value: value,
|
|
1023
988
|
});
|
|
1024
989
|
}
|
|
1025
990
|
insertMergeField(field) {
|
|
1026
991
|
this.execCommand('insertHTML', '<img style="display: inline; cursor: grab;" data-fieldid="' +
|
|
1027
|
-
field.id +
|
|
992
|
+
he.escape(field.id) +
|
|
1028
993
|
'" data-fielddisplay="' +
|
|
1029
|
-
field.name +
|
|
994
|
+
he.escape(field.name) +
|
|
1030
995
|
'" src="' +
|
|
1031
996
|
(field.previewImageUrl ||
|
|
1032
|
-
this.
|
|
997
|
+
__classPrivateFieldGet(this, _SkyTextEditorMenubarComponent_adapterService, "f").getMergeFieldDataURI(field.name)) +
|
|
1033
998
|
'">');
|
|
1034
999
|
}
|
|
1035
|
-
closeDropdowns() {
|
|
1036
|
-
this.editDropdownStream.next({ type: SkyDropdownMessageType.Close });
|
|
1037
|
-
this.formatDropdownStream.next({ type: SkyDropdownMessageType.Close });
|
|
1038
|
-
this.mergeFieldDropdownStream.next({ type: SkyDropdownMessageType.Close });
|
|
1039
|
-
}
|
|
1040
|
-
clearFormat() {
|
|
1041
|
-
const currentSelection = this.adapterService.getCurrentSelection(this.editorId);
|
|
1042
|
-
/* istanbul ignore else */
|
|
1043
|
-
if (currentSelection.rangeCount > 0 &&
|
|
1044
|
-
currentSelection.getRangeAt(0).toString().length <= 0) {
|
|
1045
|
-
this.execCommand('selectAll');
|
|
1046
|
-
}
|
|
1047
|
-
this.execCommand('removeFormat');
|
|
1048
|
-
}
|
|
1049
1000
|
}
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1001
|
+
_SkyTextEditorMenubarComponent__disabled = new WeakMap(), _SkyTextEditorMenubarComponent_ngUnsubscribe = new WeakMap(), _SkyTextEditorMenubarComponent_adapterService = new WeakMap(), _SkyTextEditorMenubarComponent_changeDetector = new WeakMap(), _SkyTextEditorMenubarComponent_resources = new WeakMap(), _SkyTextEditorMenubarComponent_instances = new WeakSet(), _SkyTextEditorMenubarComponent_closeDropdowns = function _SkyTextEditorMenubarComponent_closeDropdowns() {
|
|
1002
|
+
this.editDropdownStream.next({ type: SkyDropdownMessageType.Close });
|
|
1003
|
+
this.formatDropdownStream.next({ type: SkyDropdownMessageType.Close });
|
|
1004
|
+
this.mergeFieldDropdownStream.next({ type: SkyDropdownMessageType.Close });
|
|
1005
|
+
}, _SkyTextEditorMenubarComponent_clearFormat = function _SkyTextEditorMenubarComponent_clearFormat() {
|
|
1006
|
+
const currentSelection = __classPrivateFieldGet(this, _SkyTextEditorMenubarComponent_adapterService, "f").getCurrentSelection();
|
|
1007
|
+
/* istanbul ignore else */
|
|
1008
|
+
if (currentSelection &&
|
|
1009
|
+
currentSelection.rangeCount > 0 &&
|
|
1010
|
+
currentSelection.getRangeAt(0).toString().length <= 0) {
|
|
1011
|
+
this.execCommand('selectAll');
|
|
1012
|
+
}
|
|
1013
|
+
this.execCommand('removeFormat');
|
|
1014
|
+
};
|
|
1015
|
+
SkyTextEditorMenubarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorMenubarComponent, deps: [{ token: SkyTextEditorAdapterService }, { token: i0.ChangeDetectorRef }, { token: i2.SkyLibResourcesService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1016
|
+
SkyTextEditorMenubarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.11", 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 });
|
|
1017
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorMenubarComponent, decorators: [{
|
|
1053
1018
|
type: Component,
|
|
1054
|
-
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
|
|
1019
|
+
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"] }]
|
|
1055
1020
|
}], ctorParameters: function () { return [{ type: SkyTextEditorAdapterService }, { type: i0.ChangeDetectorRef }, { type: i2.SkyLibResourcesService }]; }, propDecorators: { editorFocusStream: [{
|
|
1056
1021
|
type: Input
|
|
1057
|
-
}], editorId: [{
|
|
1058
|
-
type: Input
|
|
1059
1022
|
}], menus: [{
|
|
1060
1023
|
type: Input
|
|
1061
1024
|
}], mergeFields: [{
|
|
@@ -1094,6 +1057,7 @@ const TOOLBAR_ACTION_DEFAULTS = [
|
|
|
1094
1057
|
class SkyUrlModalContext {
|
|
1095
1058
|
}
|
|
1096
1059
|
|
|
1060
|
+
var _SkyTextEditorUrlModalComponent_instances, _SkyTextEditorUrlModalComponent_modalInstance, _SkyTextEditorUrlModalComponent__activeTab, _SkyTextEditorUrlModalComponent__emailAddress, _SkyTextEditorUrlModalComponent__url, _SkyTextEditorUrlModalComponent_getEmailUrl, _SkyTextEditorUrlModalComponent_isValid;
|
|
1097
1061
|
const emailKey = 'mailto:';
|
|
1098
1062
|
const queryStringParamKey = '?Subject=';
|
|
1099
1063
|
/**
|
|
@@ -1101,14 +1065,16 @@ const queryStringParamKey = '?Subject=';
|
|
|
1101
1065
|
*/
|
|
1102
1066
|
class SkyTextEditorUrlModalComponent {
|
|
1103
1067
|
constructor(modalInstance, modalContext) {
|
|
1104
|
-
this
|
|
1068
|
+
_SkyTextEditorUrlModalComponent_instances.add(this);
|
|
1105
1069
|
this.emailAddressValid = false;
|
|
1106
1070
|
this.subject = '';
|
|
1107
1071
|
this.target = 0;
|
|
1108
1072
|
this.valid = false;
|
|
1109
|
-
this
|
|
1110
|
-
this
|
|
1111
|
-
this
|
|
1073
|
+
_SkyTextEditorUrlModalComponent_modalInstance.set(this, void 0);
|
|
1074
|
+
_SkyTextEditorUrlModalComponent__activeTab.set(this, 0);
|
|
1075
|
+
_SkyTextEditorUrlModalComponent__emailAddress.set(this, '');
|
|
1076
|
+
_SkyTextEditorUrlModalComponent__url.set(this, 'https://');
|
|
1077
|
+
__classPrivateFieldSet(this, _SkyTextEditorUrlModalComponent_modalInstance, modalInstance, "f");
|
|
1112
1078
|
if (modalContext.urlResult) {
|
|
1113
1079
|
if (modalContext.urlResult.url.startsWith(emailKey)) {
|
|
1114
1080
|
this.emailAddress = modalContext.urlResult.url.replace(emailKey, '');
|
|
@@ -1134,34 +1100,34 @@ class SkyTextEditorUrlModalComponent {
|
|
|
1134
1100
|
}
|
|
1135
1101
|
}
|
|
1136
1102
|
set activeTab(value) {
|
|
1137
|
-
this
|
|
1138
|
-
this.valid = this.
|
|
1103
|
+
__classPrivateFieldSet(this, _SkyTextEditorUrlModalComponent__activeTab, value, "f");
|
|
1104
|
+
this.valid = __classPrivateFieldGet(this, _SkyTextEditorUrlModalComponent_instances, "m", _SkyTextEditorUrlModalComponent_isValid).call(this);
|
|
1139
1105
|
}
|
|
1140
1106
|
get activeTab() {
|
|
1141
|
-
return this
|
|
1107
|
+
return __classPrivateFieldGet(this, _SkyTextEditorUrlModalComponent__activeTab, "f");
|
|
1142
1108
|
}
|
|
1143
1109
|
set emailAddress(value) {
|
|
1144
|
-
this
|
|
1145
|
-
this.valid = this.
|
|
1110
|
+
__classPrivateFieldSet(this, _SkyTextEditorUrlModalComponent__emailAddress, value, "f");
|
|
1111
|
+
this.valid = __classPrivateFieldGet(this, _SkyTextEditorUrlModalComponent_instances, "m", _SkyTextEditorUrlModalComponent_isValid).call(this);
|
|
1146
1112
|
}
|
|
1147
1113
|
get emailAddress() {
|
|
1148
|
-
return this
|
|
1114
|
+
return __classPrivateFieldGet(this, _SkyTextEditorUrlModalComponent__emailAddress, "f");
|
|
1149
1115
|
}
|
|
1150
1116
|
set url(value) {
|
|
1151
|
-
this
|
|
1152
|
-
this.valid = this.
|
|
1117
|
+
__classPrivateFieldSet(this, _SkyTextEditorUrlModalComponent__url, value, "f");
|
|
1118
|
+
this.valid = __classPrivateFieldGet(this, _SkyTextEditorUrlModalComponent_instances, "m", _SkyTextEditorUrlModalComponent_isValid).call(this);
|
|
1153
1119
|
}
|
|
1154
1120
|
get url() {
|
|
1155
|
-
return this
|
|
1121
|
+
return __classPrivateFieldGet(this, _SkyTextEditorUrlModalComponent__url, "f");
|
|
1156
1122
|
}
|
|
1157
1123
|
activeTabChanged(value) {
|
|
1158
1124
|
this.activeTab = Number(value);
|
|
1159
1125
|
}
|
|
1160
1126
|
save() {
|
|
1161
1127
|
/* istanbul ignore else */
|
|
1162
|
-
if (this.
|
|
1128
|
+
if (__classPrivateFieldGet(this, _SkyTextEditorUrlModalComponent_instances, "m", _SkyTextEditorUrlModalComponent_isValid).call(this)) {
|
|
1163
1129
|
if (this.activeTab === 0) {
|
|
1164
|
-
this.
|
|
1130
|
+
__classPrivateFieldGet(this, _SkyTextEditorUrlModalComponent_modalInstance, "f").save({
|
|
1165
1131
|
url: this.url,
|
|
1166
1132
|
target: this.target
|
|
1167
1133
|
? parseInt(this.target, undefined)
|
|
@@ -1169,93 +1135,102 @@ class SkyTextEditorUrlModalComponent {
|
|
|
1169
1135
|
});
|
|
1170
1136
|
}
|
|
1171
1137
|
else {
|
|
1172
|
-
this.
|
|
1173
|
-
url: this.
|
|
1138
|
+
__classPrivateFieldGet(this, _SkyTextEditorUrlModalComponent_modalInstance, "f").save({
|
|
1139
|
+
url: __classPrivateFieldGet(this, _SkyTextEditorUrlModalComponent_instances, "m", _SkyTextEditorUrlModalComponent_getEmailUrl).call(this),
|
|
1174
1140
|
target: UrlTarget.None,
|
|
1175
1141
|
});
|
|
1176
1142
|
}
|
|
1177
1143
|
}
|
|
1178
1144
|
}
|
|
1179
1145
|
cancel() {
|
|
1180
|
-
this.
|
|
1181
|
-
}
|
|
1182
|
-
getEmailUrl() {
|
|
1183
|
-
return (emailKey +
|
|
1184
|
-
this.emailAddress +
|
|
1185
|
-
(this.subject ? '?Subject=' + encodeURI(this.subject) : ''));
|
|
1186
|
-
}
|
|
1187
|
-
isValid() {
|
|
1188
|
-
if (this.activeTab === 0) {
|
|
1189
|
-
return !!this.url && SkyValidation.isUrl(this.url);
|
|
1190
|
-
}
|
|
1191
|
-
return !!this.emailAddress && SkyValidation.isEmail(this.emailAddress);
|
|
1146
|
+
__classPrivateFieldGet(this, _SkyTextEditorUrlModalComponent_modalInstance, "f").cancel();
|
|
1192
1147
|
}
|
|
1193
1148
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1149
|
+
_SkyTextEditorUrlModalComponent_modalInstance = new WeakMap(), _SkyTextEditorUrlModalComponent__activeTab = new WeakMap(), _SkyTextEditorUrlModalComponent__emailAddress = new WeakMap(), _SkyTextEditorUrlModalComponent__url = new WeakMap(), _SkyTextEditorUrlModalComponent_instances = new WeakSet(), _SkyTextEditorUrlModalComponent_getEmailUrl = function _SkyTextEditorUrlModalComponent_getEmailUrl() {
|
|
1150
|
+
return (emailKey +
|
|
1151
|
+
this.emailAddress +
|
|
1152
|
+
(this.subject ? '?Subject=' + encodeURI(this.subject) : ''));
|
|
1153
|
+
}, _SkyTextEditorUrlModalComponent_isValid = function _SkyTextEditorUrlModalComponent_isValid() {
|
|
1154
|
+
if (this.activeTab === 0) {
|
|
1155
|
+
return !!this.url && SkyValidation.isUrl(this.url);
|
|
1156
|
+
}
|
|
1157
|
+
return !!this.emailAddress && SkyValidation.isEmail(this.emailAddress);
|
|
1158
|
+
};
|
|
1159
|
+
SkyTextEditorUrlModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorUrlModalComponent, deps: [{ token: i1$2.SkyModalInstance }, { token: SkyUrlModalContext }], target: i0.ɵɵFactoryTarget.Component });
|
|
1160
|
+
SkyTextEditorUrlModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.11", 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: i5$1.λ10, selector: "sky-input-box", inputs: ["hasErrors", "disabled"] }, { kind: "component", type: i1$2.λ5, selector: "sky-modal", inputs: ["ariaRole", "tiledBody", "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, selector: "sky-tab", inputs: ["active", "disabled", "permalinkValue", "tabHeaderCount", "tabHeading", "tabIndex"], outputs: ["close"] }, { kind: "component", type: i6.λ2, selector: "sky-tabset", inputs: ["active", "ariaLabel", "ariaLabelledBy", "permalinkId", "tabStyle"], outputs: ["activeChange", "newTab", "openTab", "tabIndexesChange"] }, { kind: "pipe", type: i2.SkyLibResourcesPipe, name: "skyLibResources" }] });
|
|
1161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorUrlModalComponent, decorators: [{
|
|
1197
1162
|
type: Component,
|
|
1198
1163
|
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"] }]
|
|
1199
|
-
}], ctorParameters: function () { return [{ type: i1$
|
|
1164
|
+
}], ctorParameters: function () { return [{ type: i1$2.SkyModalInstance }, { type: SkyUrlModalContext }]; } });
|
|
1200
1165
|
|
|
1166
|
+
var _SkyTextEditorToolbarComponent_instances, _SkyTextEditorToolbarComponent_editorFocusStreamSub, _SkyTextEditorToolbarComponent_adapterService, _SkyTextEditorToolbarComponent_changeDetector, _SkyTextEditorToolbarComponent_modalService, _SkyTextEditorToolbarComponent_ngUnsubscribe, _SkyTextEditorToolbarComponent__editorFocusStream, _SkyTextEditorToolbarComponent__disabled, _SkyTextEditorToolbarComponent__styleState, _SkyTextEditorToolbarComponent_subscribeEditorFocus, _SkyTextEditorToolbarComponent_closeDropdowns, _SkyTextEditorToolbarComponent_getFontName;
|
|
1201
1167
|
/**
|
|
1202
1168
|
* @internal
|
|
1203
1169
|
*/
|
|
1204
1170
|
class SkyTextEditorToolbarComponent {
|
|
1205
1171
|
constructor(adapterService, changeDetector, modalService) {
|
|
1206
|
-
this
|
|
1207
|
-
this.
|
|
1208
|
-
this.
|
|
1209
|
-
this.
|
|
1172
|
+
_SkyTextEditorToolbarComponent_instances.add(this);
|
|
1173
|
+
this.fontList = [];
|
|
1174
|
+
this.fontSizeList = [];
|
|
1175
|
+
this.toolbarActions = [];
|
|
1210
1176
|
this.backColorpickerStream = new Subject();
|
|
1211
1177
|
this.colorpickerStream = new Subject();
|
|
1212
1178
|
this.fontPickerStream = new Subject();
|
|
1213
1179
|
this.fontSizeStream = new Subject();
|
|
1214
|
-
this
|
|
1215
|
-
this
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1180
|
+
_SkyTextEditorToolbarComponent_editorFocusStreamSub.set(this, void 0);
|
|
1181
|
+
_SkyTextEditorToolbarComponent_adapterService.set(this, void 0);
|
|
1182
|
+
_SkyTextEditorToolbarComponent_changeDetector.set(this, void 0);
|
|
1183
|
+
_SkyTextEditorToolbarComponent_modalService.set(this, void 0);
|
|
1184
|
+
_SkyTextEditorToolbarComponent_ngUnsubscribe.set(this, new Subject());
|
|
1185
|
+
_SkyTextEditorToolbarComponent__editorFocusStream.set(this, new Subject());
|
|
1186
|
+
_SkyTextEditorToolbarComponent__disabled.set(this, false);
|
|
1187
|
+
_SkyTextEditorToolbarComponent__styleState.set(this, STYLE_STATE_DEFAULTS);
|
|
1188
|
+
__classPrivateFieldSet(this, _SkyTextEditorToolbarComponent_adapterService, adapterService, "f");
|
|
1189
|
+
__classPrivateFieldSet(this, _SkyTextEditorToolbarComponent_changeDetector, changeDetector, "f");
|
|
1190
|
+
__classPrivateFieldSet(this, _SkyTextEditorToolbarComponent_modalService, modalService, "f");
|
|
1191
|
+
}
|
|
1192
|
+
set editorFocusStream(value) {
|
|
1193
|
+
__classPrivateFieldSet(this, _SkyTextEditorToolbarComponent__editorFocusStream, value, "f");
|
|
1194
|
+
__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_instances, "m", _SkyTextEditorToolbarComponent_subscribeEditorFocus).call(this);
|
|
1195
|
+
}
|
|
1196
|
+
get editorFocusStream() {
|
|
1197
|
+
return __classPrivateFieldGet(this, _SkyTextEditorToolbarComponent__editorFocusStream, "f");
|
|
1219
1198
|
}
|
|
1220
1199
|
set styleState(value) {
|
|
1221
|
-
this
|
|
1200
|
+
__classPrivateFieldSet(this, _SkyTextEditorToolbarComponent__styleState, value, "f");
|
|
1222
1201
|
if (value.font !== this.styleStateFontName) {
|
|
1223
1202
|
if (value.font === '"Blackbaud Sans", Arial, sans-serif') {
|
|
1224
|
-
this.styleStateFontName = this.
|
|
1203
|
+
this.styleStateFontName = __classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_instances, "m", _SkyTextEditorToolbarComponent_getFontName).call(this, 'Blackbaud Sans');
|
|
1225
1204
|
}
|
|
1226
1205
|
else {
|
|
1227
|
-
this.styleStateFontName = this.
|
|
1206
|
+
this.styleStateFontName = __classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_instances, "m", _SkyTextEditorToolbarComponent_getFontName).call(this, value.font);
|
|
1228
1207
|
}
|
|
1229
1208
|
}
|
|
1230
1209
|
}
|
|
1210
|
+
get styleState() {
|
|
1211
|
+
return __classPrivateFieldGet(this, _SkyTextEditorToolbarComponent__styleState, "f");
|
|
1212
|
+
}
|
|
1231
1213
|
set disabled(value) {
|
|
1232
1214
|
const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);
|
|
1233
1215
|
if (coercedValue !== this.disabled) {
|
|
1234
|
-
this
|
|
1235
|
-
this.
|
|
1216
|
+
__classPrivateFieldSet(this, _SkyTextEditorToolbarComponent__disabled, coercedValue, "f");
|
|
1217
|
+
__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_changeDetector, "f").markForCheck();
|
|
1236
1218
|
}
|
|
1237
1219
|
}
|
|
1238
1220
|
get disabled() {
|
|
1239
|
-
return this
|
|
1221
|
+
return __classPrivateFieldGet(this, _SkyTextEditorToolbarComponent__disabled, "f");
|
|
1240
1222
|
}
|
|
1241
1223
|
ngOnInit() {
|
|
1242
|
-
this.
|
|
1243
|
-
this.styleState = {
|
|
1244
|
-
...this._styleState,
|
|
1245
|
-
...this.adapterService.getStyleState(this.editorId),
|
|
1246
|
-
};
|
|
1247
|
-
this.closeDropdowns();
|
|
1248
|
-
this.changeDetector.detectChanges();
|
|
1249
|
-
});
|
|
1224
|
+
__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_instances, "m", _SkyTextEditorToolbarComponent_subscribeEditorFocus).call(this);
|
|
1250
1225
|
}
|
|
1251
1226
|
execCommand(command, value = '') {
|
|
1252
|
-
this.
|
|
1227
|
+
__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f").execCommand({
|
|
1253
1228
|
command: command,
|
|
1254
1229
|
value: value,
|
|
1255
1230
|
});
|
|
1256
1231
|
this.styleState = {
|
|
1257
1232
|
...this.styleState,
|
|
1258
|
-
...this.
|
|
1233
|
+
...__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f").getStyleState(),
|
|
1259
1234
|
};
|
|
1260
1235
|
}
|
|
1261
1236
|
toggleFontStyle(currentState, newState, command) {
|
|
@@ -1263,12 +1238,12 @@ class SkyTextEditorToolbarComponent {
|
|
|
1263
1238
|
this.execCommand(command);
|
|
1264
1239
|
}
|
|
1265
1240
|
// Force sky-checkbox to show changes on user's initial click.
|
|
1266
|
-
this.
|
|
1241
|
+
__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_changeDetector, "f").detectChanges();
|
|
1267
1242
|
}
|
|
1268
1243
|
link() {
|
|
1269
|
-
const priorSelection = this.
|
|
1270
|
-
const currentLink = this.
|
|
1271
|
-
const inputModal = this.
|
|
1244
|
+
const priorSelection = __classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f").saveSelection();
|
|
1245
|
+
const currentLink = __classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f").getLink();
|
|
1246
|
+
const inputModal = __classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_modalService, "f").open(SkyTextEditorUrlModalComponent, [
|
|
1272
1247
|
{
|
|
1273
1248
|
provide: SkyUrlModalContext,
|
|
1274
1249
|
useValue: { urlResult: currentLink },
|
|
@@ -1277,8 +1252,10 @@ class SkyTextEditorToolbarComponent {
|
|
|
1277
1252
|
inputModal.closed.subscribe((result) => {
|
|
1278
1253
|
if (result.reason === 'save' && priorSelection) {
|
|
1279
1254
|
if (currentLink) {
|
|
1280
|
-
const anchor = this.
|
|
1281
|
-
|
|
1255
|
+
const anchor = __classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f").getSelectedAnchorTag();
|
|
1256
|
+
if (anchor) {
|
|
1257
|
+
__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f").selectElement(anchor);
|
|
1258
|
+
}
|
|
1282
1259
|
}
|
|
1283
1260
|
this.execCommand('unlink');
|
|
1284
1261
|
if (result.data.target === UrlTarget.None) {
|
|
@@ -1287,7 +1264,7 @@ class SkyTextEditorToolbarComponent {
|
|
|
1287
1264
|
}
|
|
1288
1265
|
else {
|
|
1289
1266
|
// New Window
|
|
1290
|
-
const sText = this.
|
|
1267
|
+
const sText = __classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f").getCurrentSelection();
|
|
1291
1268
|
this.execCommand('insertHTML', '<a href="' +
|
|
1292
1269
|
result.data.url +
|
|
1293
1270
|
'" rel="noopener noreferrer" target="_blank">' +
|
|
@@ -1298,50 +1275,63 @@ class SkyTextEditorToolbarComponent {
|
|
|
1298
1275
|
});
|
|
1299
1276
|
}
|
|
1300
1277
|
unlink() {
|
|
1301
|
-
const currentSelectionRange = this
|
|
1302
|
-
.getCurrentSelection(
|
|
1303
|
-
|
|
1304
|
-
if (currentSelectionRange.toString().length <= 0) {
|
|
1305
|
-
const anchorTag = this.
|
|
1306
|
-
|
|
1278
|
+
const currentSelectionRange = __classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f")
|
|
1279
|
+
.getCurrentSelection()
|
|
1280
|
+
?.getRangeAt(0);
|
|
1281
|
+
if (currentSelectionRange && currentSelectionRange.toString().length <= 0) {
|
|
1282
|
+
const anchorTag = __classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f").getSelectedAnchorTag();
|
|
1283
|
+
if (anchorTag) {
|
|
1284
|
+
__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f").selectElement(anchorTag);
|
|
1285
|
+
}
|
|
1307
1286
|
}
|
|
1308
1287
|
this.execCommand('unlink');
|
|
1309
1288
|
}
|
|
1310
1289
|
changeFontSize(size) {
|
|
1311
|
-
this.
|
|
1290
|
+
__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f").setFontSize(size);
|
|
1312
1291
|
this.styleState = {
|
|
1313
1292
|
...this.styleState,
|
|
1314
|
-
...this.
|
|
1293
|
+
...__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f").getStyleState(),
|
|
1315
1294
|
};
|
|
1316
1295
|
}
|
|
1317
1296
|
onColorpickerColorChanged(color, isBackground = false) {
|
|
1318
1297
|
this.execCommand(isBackground ? 'backColor' : 'foreColor', color.hex);
|
|
1319
1298
|
}
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1299
|
+
}
|
|
1300
|
+
_SkyTextEditorToolbarComponent_editorFocusStreamSub = new WeakMap(), _SkyTextEditorToolbarComponent_adapterService = new WeakMap(), _SkyTextEditorToolbarComponent_changeDetector = new WeakMap(), _SkyTextEditorToolbarComponent_modalService = new WeakMap(), _SkyTextEditorToolbarComponent_ngUnsubscribe = new WeakMap(), _SkyTextEditorToolbarComponent__editorFocusStream = new WeakMap(), _SkyTextEditorToolbarComponent__disabled = new WeakMap(), _SkyTextEditorToolbarComponent__styleState = new WeakMap(), _SkyTextEditorToolbarComponent_instances = new WeakSet(), _SkyTextEditorToolbarComponent_subscribeEditorFocus = function _SkyTextEditorToolbarComponent_subscribeEditorFocus() {
|
|
1301
|
+
__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_editorFocusStreamSub, "f")?.unsubscribe();
|
|
1302
|
+
__classPrivateFieldSet(this, _SkyTextEditorToolbarComponent_editorFocusStreamSub, this.editorFocusStream
|
|
1303
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_ngUnsubscribe, "f")))
|
|
1304
|
+
.subscribe(() => {
|
|
1305
|
+
this.styleState = {
|
|
1306
|
+
...this.styleState,
|
|
1307
|
+
...__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_adapterService, "f").getStyleState(),
|
|
1323
1308
|
};
|
|
1324
|
-
this.
|
|
1325
|
-
this.
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1309
|
+
__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_instances, "m", _SkyTextEditorToolbarComponent_closeDropdowns).call(this);
|
|
1310
|
+
__classPrivateFieldGet(this, _SkyTextEditorToolbarComponent_changeDetector, "f").detectChanges();
|
|
1311
|
+
}), "f");
|
|
1312
|
+
}, _SkyTextEditorToolbarComponent_closeDropdowns = function _SkyTextEditorToolbarComponent_closeDropdowns() {
|
|
1313
|
+
const message = {
|
|
1314
|
+
type: SkyColorpickerMessageType.Close,
|
|
1315
|
+
};
|
|
1316
|
+
this.colorpickerStream.next(message);
|
|
1317
|
+
this.backColorpickerStream.next(message);
|
|
1318
|
+
this.fontPickerStream.next({ type: SkyDropdownMessageType.Close });
|
|
1319
|
+
this.fontSizeStream.next({ type: SkyDropdownMessageType.Close });
|
|
1320
|
+
}, _SkyTextEditorToolbarComponent_getFontName = function _SkyTextEditorToolbarComponent_getFontName(fontName) {
|
|
1321
|
+
for (let i = 0; i < this.fontList.length; i++) {
|
|
1322
|
+
if (fontName.replace(/['"]+/g, '') === this.fontList[i].name) {
|
|
1323
|
+
return this.fontList[i].name;
|
|
1334
1324
|
}
|
|
1335
1325
|
}
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
SkyTextEditorToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyTextEditorToolbarComponent, selector: "sky-text-editor-toolbar", inputs: { editorFocusStream: "editorFocusStream", editorId: "editorId", 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 #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 >\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$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i3$2.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$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5$2.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "component", type: i6$1.λ1, selector: "sky-colorpicker", inputs: ["pickerButtonIcon", "pickerButtonIconType", "label", "labelledBy", "messageStream", "showResetButton"], outputs: ["selectedColorChanged", "selectedColorApplied"] }, { kind: "directive", type: i6$1.λ2, selector: "[skyColorpickerInput]", inputs: ["skyColorpickerInput", "initialColor", "returnFormat", "outputFormat", "presetColors", "alphaChannel", "allowTransparency"] }, { kind: "component", type: i5$1.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { 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 });
|
|
1339
|
-
i0.ɵɵ
|
|
1326
|
+
/* istanbul ignore next */
|
|
1327
|
+
return undefined;
|
|
1328
|
+
};
|
|
1329
|
+
SkyTextEditorToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorToolbarComponent, deps: [{ token: SkyTextEditorAdapterService }, { token: i0.ChangeDetectorRef }, { token: i1$2.SkyModalService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1330
|
+
SkyTextEditorToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.11", 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 #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 >\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$2.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "component", type: i6$1.λ1, selector: "sky-colorpicker", inputs: ["pickerButtonIcon", "pickerButtonIconType", "label", "labelledBy", "messageStream", "showResetButton"], outputs: ["selectedColorChanged", "selectedColorApplied"] }, { kind: "directive", type: i6$1.λ2, selector: "[skyColorpickerInput]", inputs: ["skyColorpickerInput", "initialColor", "returnFormat", "outputFormat", "presetColors", "alphaChannel", "allowTransparency"] }, { kind: "component", type: i5$1.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { 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 });
|
|
1331
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorToolbarComponent, decorators: [{
|
|
1340
1332
|
type: Component,
|
|
1341
1333
|
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 #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 >\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"] }]
|
|
1342
|
-
}], ctorParameters: function () { return [{ type: SkyTextEditorAdapterService }, { type: i0.ChangeDetectorRef }, { type: i1$
|
|
1343
|
-
type: Input
|
|
1344
|
-
}], editorId: [{
|
|
1334
|
+
}], ctorParameters: function () { return [{ type: SkyTextEditorAdapterService }, { type: i0.ChangeDetectorRef }, { type: i1$2.SkyModalService }]; }, propDecorators: { editorFocusStream: [{
|
|
1345
1335
|
type: Input
|
|
1346
1336
|
}], fontList: [{
|
|
1347
1337
|
type: Input
|
|
@@ -1355,68 +1345,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
1355
1345
|
type: Input
|
|
1356
1346
|
}] } });
|
|
1357
1347
|
|
|
1358
|
-
|
|
1359
|
-
* Auto-incrementing integer used to generate unique ids for radio components.
|
|
1360
|
-
*/
|
|
1361
|
-
let nextUniqueId = 0;
|
|
1348
|
+
var _SkyTextEditorComponent_instances, _SkyTextEditorComponent_defaultId, _SkyTextEditorComponent_id, _SkyTextEditorComponent_focusInitialized, _SkyTextEditorComponent_initialized, _SkyTextEditorComponent_ngUnsubscribe, _SkyTextEditorComponent_changeDetector, _SkyTextEditorComponent_coreAdapterService, _SkyTextEditorComponent_adapterService, _SkyTextEditorComponent_editorService, _SkyTextEditorComponent_sanitizationService, _SkyTextEditorComponent_ngControl, _SkyTextEditorComponent_zone, _SkyTextEditorComponent__fontList, _SkyTextEditorComponent__fontSizeList, _SkyTextEditorComponent__mergeFields, _SkyTextEditorComponent__menus, _SkyTextEditorComponent__toolbarActions, _SkyTextEditorComponent__disabled, _SkyTextEditorComponent__initialStyleState, _SkyTextEditorComponent__placeholder, _SkyTextEditorComponent__value, _SkyTextEditorComponent_updateStyle, _SkyTextEditorComponent_initIframe, _SkyTextEditorComponent_viewToModelUpdate;
|
|
1362
1349
|
/**
|
|
1363
1350
|
* The text editor component lets users format and manipulate text.
|
|
1364
1351
|
*/
|
|
1365
1352
|
class SkyTextEditorComponent {
|
|
1366
|
-
constructor(changeDetector, coreAdapterService, adapterService, editorService, sanitizationService, ngControl, zone) {
|
|
1367
|
-
this
|
|
1368
|
-
this.coreAdapterService = coreAdapterService;
|
|
1369
|
-
this.adapterService = adapterService;
|
|
1370
|
-
this.editorService = editorService;
|
|
1371
|
-
this.sanitizationService = sanitizationService;
|
|
1372
|
-
this.ngControl = ngControl;
|
|
1373
|
-
this.zone = zone;
|
|
1353
|
+
constructor(changeDetector, coreAdapterService, adapterService, editorService, sanitizationService, ngControl, zone, idSvc) {
|
|
1354
|
+
_SkyTextEditorComponent_instances.add(this);
|
|
1374
1355
|
/**
|
|
1375
1356
|
* Indicates whether to put focus on the editor after it renders.
|
|
1376
1357
|
*/
|
|
1377
1358
|
this.autofocus = false;
|
|
1378
1359
|
this.editorFocusStream = new Subject();
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
this
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
this
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
this
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
this
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
this
|
|
1409
|
-
this
|
|
1410
|
-
this
|
|
1411
|
-
this
|
|
1412
|
-
this
|
|
1413
|
-
this
|
|
1414
|
-
this
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1418
|
-
this._onChange = () => { };
|
|
1419
|
-
this.ngControl.valueAccessor = this;
|
|
1360
|
+
_SkyTextEditorComponent_defaultId.set(this, void 0);
|
|
1361
|
+
_SkyTextEditorComponent_id.set(this, void 0);
|
|
1362
|
+
_SkyTextEditorComponent_focusInitialized.set(this, false);
|
|
1363
|
+
_SkyTextEditorComponent_initialized.set(this, false);
|
|
1364
|
+
_SkyTextEditorComponent_ngUnsubscribe.set(this, new Subject());
|
|
1365
|
+
_SkyTextEditorComponent_changeDetector.set(this, void 0);
|
|
1366
|
+
_SkyTextEditorComponent_coreAdapterService.set(this, void 0);
|
|
1367
|
+
_SkyTextEditorComponent_adapterService.set(this, void 0);
|
|
1368
|
+
_SkyTextEditorComponent_editorService.set(this, void 0);
|
|
1369
|
+
_SkyTextEditorComponent_sanitizationService.set(this, void 0);
|
|
1370
|
+
_SkyTextEditorComponent_ngControl.set(this, void 0);
|
|
1371
|
+
_SkyTextEditorComponent_zone.set(this, void 0);
|
|
1372
|
+
_SkyTextEditorComponent__fontList.set(this, FONT_LIST_DEFAULTS);
|
|
1373
|
+
_SkyTextEditorComponent__fontSizeList.set(this, FONT_SIZE_LIST_DEFAULTS);
|
|
1374
|
+
_SkyTextEditorComponent__mergeFields.set(this, []);
|
|
1375
|
+
_SkyTextEditorComponent__menus.set(this, MENU_DEFAULTS);
|
|
1376
|
+
_SkyTextEditorComponent__toolbarActions.set(this, TOOLBAR_ACTION_DEFAULTS);
|
|
1377
|
+
_SkyTextEditorComponent__disabled.set(this, false);
|
|
1378
|
+
_SkyTextEditorComponent__initialStyleState.set(this, Object.assign({}, STYLE_STATE_DEFAULTS));
|
|
1379
|
+
_SkyTextEditorComponent__placeholder.set(this, '');
|
|
1380
|
+
_SkyTextEditorComponent__value.set(this, '<p></p>');
|
|
1381
|
+
/* istanbul ignore next */
|
|
1382
|
+
this._onTouched = () => {
|
|
1383
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1384
|
+
};
|
|
1385
|
+
/* istanbul ignore next */
|
|
1386
|
+
this._onChange = () => {
|
|
1387
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1388
|
+
};
|
|
1389
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent_changeDetector, changeDetector, "f");
|
|
1390
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent_coreAdapterService, coreAdapterService, "f");
|
|
1391
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent_adapterService, adapterService, "f");
|
|
1392
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent_editorService, editorService, "f");
|
|
1393
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent_sanitizationService, sanitizationService, "f");
|
|
1394
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent_ngControl, ngControl, "f");
|
|
1395
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent_zone, zone, "f");
|
|
1396
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent_id, __classPrivateFieldSet(this, _SkyTextEditorComponent_defaultId, idSvc.generateId(), "f"), "f");
|
|
1397
|
+
ngControl.valueAccessor = this;
|
|
1420
1398
|
}
|
|
1421
1399
|
/**
|
|
1422
1400
|
* Indicates whether to disable the text editor.
|
|
@@ -1425,27 +1403,57 @@ class SkyTextEditorComponent {
|
|
|
1425
1403
|
set disabled(value) {
|
|
1426
1404
|
const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);
|
|
1427
1405
|
if (coercedValue !== this.disabled) {
|
|
1428
|
-
this
|
|
1406
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent__disabled, coercedValue, "f");
|
|
1429
1407
|
// Update focusableChildren inside the iframe.
|
|
1430
1408
|
let focusableChildren;
|
|
1431
1409
|
/* istanbul ignore else */
|
|
1432
1410
|
if (this.iframeRef) {
|
|
1433
|
-
focusableChildren = this.
|
|
1411
|
+
focusableChildren = __classPrivateFieldGet(this, _SkyTextEditorComponent_coreAdapterService, "f").getFocusableChildren(this.iframeRef.nativeElement.contentDocument.body, {
|
|
1434
1412
|
ignoreVisibility: true,
|
|
1435
1413
|
ignoreTabIndex: true,
|
|
1436
1414
|
});
|
|
1415
|
+
if (__classPrivateFieldGet(this, _SkyTextEditorComponent__disabled, "f")) {
|
|
1416
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_adapterService, "f").disableEditor(focusableChildren, this.iframeRef.nativeElement);
|
|
1417
|
+
}
|
|
1418
|
+
else {
|
|
1419
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_adapterService, "f").enableEditor(focusableChildren, this.iframeRef.nativeElement);
|
|
1420
|
+
}
|
|
1421
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_changeDetector, "f").markForCheck();
|
|
1437
1422
|
}
|
|
1438
|
-
if (this._disabled) {
|
|
1439
|
-
this.adapterService.disableEditor(this.id, focusableChildren, this.iframeRef.nativeElement);
|
|
1440
|
-
}
|
|
1441
|
-
else {
|
|
1442
|
-
this.adapterService.enableEditor(this.id, focusableChildren, this.iframeRef.nativeElement);
|
|
1443
|
-
}
|
|
1444
|
-
this.changeDetector.markForCheck();
|
|
1445
1423
|
}
|
|
1446
1424
|
}
|
|
1447
1425
|
get disabled() {
|
|
1448
|
-
return this
|
|
1426
|
+
return __classPrivateFieldGet(this, _SkyTextEditorComponent__disabled, "f");
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* Specifies the fonts to include in the font picker.
|
|
1430
|
+
* @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'}]
|
|
1431
|
+
*/
|
|
1432
|
+
set fontList(value) {
|
|
1433
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent__fontList, value || FONT_LIST_DEFAULTS, "f");
|
|
1434
|
+
}
|
|
1435
|
+
get fontList() {
|
|
1436
|
+
return __classPrivateFieldGet(this, _SkyTextEditorComponent__fontList, "f");
|
|
1437
|
+
}
|
|
1438
|
+
/**
|
|
1439
|
+
* Specifies the font sizes to include in the font size picker.
|
|
1440
|
+
* @default [6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 36, 48]
|
|
1441
|
+
*/
|
|
1442
|
+
set fontSizeList(value) {
|
|
1443
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent__fontSizeList, value || FONT_SIZE_LIST_DEFAULTS, "f");
|
|
1444
|
+
}
|
|
1445
|
+
get fontSizeList() {
|
|
1446
|
+
return __classPrivateFieldGet(this, _SkyTextEditorComponent__fontSizeList, "f");
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Specifies a unique ID attribute for the text editor.
|
|
1450
|
+
* By default, the component generates a random ID.
|
|
1451
|
+
*/
|
|
1452
|
+
set id(value) {
|
|
1453
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent_id, value || __classPrivateFieldGet(this, _SkyTextEditorComponent_defaultId, "f"), "f");
|
|
1454
|
+
}
|
|
1455
|
+
get id() {
|
|
1456
|
+
return __classPrivateFieldGet(this, _SkyTextEditorComponent_id, "f");
|
|
1449
1457
|
}
|
|
1450
1458
|
/**
|
|
1451
1459
|
* Specifies the initial styles for all content, including background color, font size, and link state.
|
|
@@ -1453,83 +1461,110 @@ class SkyTextEditorComponent {
|
|
|
1453
1461
|
set initialStyleState(state) {
|
|
1454
1462
|
// Do not update the state after initialization has taken place
|
|
1455
1463
|
/* istanbul ignore else */
|
|
1456
|
-
if (!this
|
|
1457
|
-
this
|
|
1464
|
+
if (!__classPrivateFieldGet(this, _SkyTextEditorComponent_initialized, "f")) {
|
|
1465
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent__initialStyleState, {
|
|
1458
1466
|
...STYLE_STATE_DEFAULTS,
|
|
1459
1467
|
...state,
|
|
1460
|
-
};
|
|
1468
|
+
}, "f");
|
|
1461
1469
|
}
|
|
1462
1470
|
}
|
|
1463
1471
|
get initialStyleState() {
|
|
1464
|
-
return this
|
|
1472
|
+
return __classPrivateFieldGet(this, _SkyTextEditorComponent__initialStyleState, "f");
|
|
1473
|
+
}
|
|
1474
|
+
/**
|
|
1475
|
+
* Specifies the menus to include in the menu bar.
|
|
1476
|
+
* @default [ 'edit', 'format' ]
|
|
1477
|
+
*/
|
|
1478
|
+
set menus(value) {
|
|
1479
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent__menus, value || MENU_DEFAULTS, "f");
|
|
1480
|
+
}
|
|
1481
|
+
get menus() {
|
|
1482
|
+
return __classPrivateFieldGet(this, _SkyTextEditorComponent__menus, "f");
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Specifies the merge fields to include in the merge field menu.
|
|
1486
|
+
*/
|
|
1487
|
+
set mergeFields(value) {
|
|
1488
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent__mergeFields, value || [], "f");
|
|
1489
|
+
}
|
|
1490
|
+
get mergeFields() {
|
|
1491
|
+
return __classPrivateFieldGet(this, _SkyTextEditorComponent__mergeFields, "f");
|
|
1465
1492
|
}
|
|
1466
1493
|
/**
|
|
1467
1494
|
* Specifies placeholder text to display when the text entry area is empty.
|
|
1468
1495
|
*/
|
|
1469
1496
|
set placeholder(value) {
|
|
1470
1497
|
/* istanbul ignore else */
|
|
1471
|
-
if (value !== this
|
|
1472
|
-
this
|
|
1473
|
-
if (this
|
|
1474
|
-
this.
|
|
1498
|
+
if (value !== __classPrivateFieldGet(this, _SkyTextEditorComponent__placeholder, "f")) {
|
|
1499
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent__placeholder, value || '', "f");
|
|
1500
|
+
if (__classPrivateFieldGet(this, _SkyTextEditorComponent_initialized, "f")) {
|
|
1501
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_adapterService, "f").setPlaceholder(value);
|
|
1475
1502
|
}
|
|
1476
1503
|
}
|
|
1477
1504
|
}
|
|
1478
1505
|
get placeholder() {
|
|
1479
|
-
return this
|
|
1506
|
+
return __classPrivateFieldGet(this, _SkyTextEditorComponent__placeholder, "f");
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Specifies the actions to include in the toolbar and determines their order.
|
|
1510
|
+
* @default [ 'font-family', 'font-size', 'font-style', 'color', 'list', 'link ]
|
|
1511
|
+
*/
|
|
1512
|
+
set toolbarActions(value) {
|
|
1513
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent__toolbarActions, value || TOOLBAR_ACTION_DEFAULTS, "f");
|
|
1514
|
+
}
|
|
1515
|
+
get toolbarActions() {
|
|
1516
|
+
return __classPrivateFieldGet(this, _SkyTextEditorComponent__toolbarActions, "f");
|
|
1480
1517
|
}
|
|
1481
1518
|
/**
|
|
1482
1519
|
* The internal value of the control.
|
|
1483
1520
|
*/
|
|
1484
1521
|
set value(value) {
|
|
1485
1522
|
// Normalize value and set any empty state to an empty string.
|
|
1486
|
-
let normalizedValue
|
|
1523
|
+
let normalizedValue;
|
|
1524
|
+
const valueTrimmed = value?.trim();
|
|
1487
1525
|
if (!value ||
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1526
|
+
valueTrimmed === '<p></p>' ||
|
|
1527
|
+
valueTrimmed === '<br>' ||
|
|
1528
|
+
valueTrimmed === '<p><br></p>') {
|
|
1491
1529
|
normalizedValue = '';
|
|
1492
1530
|
}
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1531
|
+
else {
|
|
1532
|
+
normalizedValue = value;
|
|
1533
|
+
}
|
|
1534
|
+
normalizedValue = __classPrivateFieldGet(this, _SkyTextEditorComponent_sanitizationService, "f")
|
|
1535
|
+
.sanitize(normalizedValue)
|
|
1536
|
+
.trim();
|
|
1537
|
+
if (__classPrivateFieldGet(this, _SkyTextEditorComponent__value, "f") !== normalizedValue) {
|
|
1538
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent__value, normalizedValue, "f");
|
|
1496
1539
|
// Update angular form control if model has been normalized.
|
|
1497
1540
|
/* istanbul ignore else */
|
|
1498
|
-
if (this
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
});
|
|
1504
|
-
}
|
|
1541
|
+
if (__classPrivateFieldGet(this, _SkyTextEditorComponent_ngControl, "f")?.control &&
|
|
1542
|
+
normalizedValue !== __classPrivateFieldGet(this, _SkyTextEditorComponent_ngControl, "f").control.value) {
|
|
1543
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_ngControl, "f").control.setValue(normalizedValue, {
|
|
1544
|
+
emitModelToViewChange: false,
|
|
1545
|
+
});
|
|
1505
1546
|
}
|
|
1506
1547
|
// Autofocus isn't testable in Firefox and IE.
|
|
1507
1548
|
/* istanbul ignore next */
|
|
1508
|
-
if (this.autofocus && !this
|
|
1509
|
-
this.
|
|
1510
|
-
this
|
|
1549
|
+
if (this.autofocus && !__classPrivateFieldGet(this, _SkyTextEditorComponent_focusInitialized, "f")) {
|
|
1550
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_adapterService, "f").focusEditor();
|
|
1551
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent_focusInitialized, true, "f");
|
|
1511
1552
|
}
|
|
1512
1553
|
}
|
|
1513
1554
|
}
|
|
1514
1555
|
get value() {
|
|
1515
|
-
return this
|
|
1556
|
+
return __classPrivateFieldGet(this, _SkyTextEditorComponent__value, "f");
|
|
1516
1557
|
}
|
|
1517
1558
|
ngAfterViewInit() {
|
|
1518
|
-
this.
|
|
1559
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_instances, "m", _SkyTextEditorComponent_initIframe).call(this);
|
|
1519
1560
|
}
|
|
1520
1561
|
ngOnDestroy() {
|
|
1521
|
-
this.
|
|
1522
|
-
this.
|
|
1523
|
-
this.
|
|
1524
|
-
this.ngUnsubscribe.complete();
|
|
1562
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_adapterService, "f").removeObservers(__classPrivateFieldGet(this, _SkyTextEditorComponent_editorService, "f").editor);
|
|
1563
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_ngUnsubscribe, "f").next();
|
|
1564
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_ngUnsubscribe, "f").complete();
|
|
1525
1565
|
}
|
|
1526
1566
|
onIframeLoad() {
|
|
1527
|
-
|
|
1528
|
-
/* istanbul ignore else */
|
|
1529
|
-
if (this.editorService.editors[this.id]) {
|
|
1530
|
-
this.editorService.removeEditor(this.id);
|
|
1531
|
-
this.initIframe();
|
|
1532
|
-
}
|
|
1567
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_instances, "m", _SkyTextEditorComponent_initIframe).call(this);
|
|
1533
1568
|
}
|
|
1534
1569
|
/**
|
|
1535
1570
|
* Implemented as part of ControlValueAccessor.
|
|
@@ -1537,14 +1572,17 @@ class SkyTextEditorComponent {
|
|
|
1537
1572
|
writeValue(value) {
|
|
1538
1573
|
this.value = value;
|
|
1539
1574
|
// Update HTML if necessary.
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1575
|
+
if (__classPrivateFieldGet(this, _SkyTextEditorComponent_initialized, "f")) {
|
|
1576
|
+
const editorValue = __classPrivateFieldGet(this, _SkyTextEditorComponent_adapterService, "f").getEditorInnerHtml();
|
|
1577
|
+
if (editorValue !== __classPrivateFieldGet(this, _SkyTextEditorComponent__value, "f")) {
|
|
1578
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_adapterService, "f").setEditorInnerHtml(__classPrivateFieldGet(this, _SkyTextEditorComponent__value, "f"));
|
|
1579
|
+
}
|
|
1543
1580
|
}
|
|
1544
1581
|
}
|
|
1545
1582
|
/**
|
|
1546
1583
|
* Implemented as part of ControlValueAccessor.
|
|
1547
1584
|
*/
|
|
1585
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1548
1586
|
registerOnChange(fn) {
|
|
1549
1587
|
this._onChange = fn;
|
|
1550
1588
|
}
|
|
@@ -1560,75 +1598,81 @@ class SkyTextEditorComponent {
|
|
|
1560
1598
|
setDisabledState(isDisabled) {
|
|
1561
1599
|
this.disabled = isDisabled;
|
|
1562
1600
|
}
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
});
|
|
1580
|
-
});
|
|
1581
|
-
this.editorService
|
|
1582
|
-
.selectionChangeListener(this.id)
|
|
1583
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
1584
|
-
.subscribe(() => {
|
|
1585
|
-
this.updateStyle();
|
|
1586
|
-
this.editorFocusStream.next();
|
|
1587
|
-
});
|
|
1588
|
-
this.editorService
|
|
1589
|
-
.clickListener(this.id)
|
|
1590
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
1591
|
-
.subscribe(() => {
|
|
1592
|
-
this.editorFocusStream.next();
|
|
1593
|
-
});
|
|
1594
|
-
this.editorService
|
|
1595
|
-
.blurListener(this.id)
|
|
1596
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
1597
|
-
.subscribe(() => {
|
|
1598
|
-
// Angular doesn't run change detection for changes originating inside an iframe,
|
|
1599
|
-
// so we have to run markForCheck() inside the NgZone to force change propigation to consuming components.
|
|
1600
|
-
this.zone.run(() => {
|
|
1601
|
-
this._onTouched();
|
|
1602
|
-
});
|
|
1601
|
+
}
|
|
1602
|
+
_SkyTextEditorComponent_defaultId = new WeakMap(), _SkyTextEditorComponent_id = new WeakMap(), _SkyTextEditorComponent_focusInitialized = new WeakMap(), _SkyTextEditorComponent_initialized = new WeakMap(), _SkyTextEditorComponent_ngUnsubscribe = new WeakMap(), _SkyTextEditorComponent_changeDetector = new WeakMap(), _SkyTextEditorComponent_coreAdapterService = new WeakMap(), _SkyTextEditorComponent_adapterService = new WeakMap(), _SkyTextEditorComponent_editorService = new WeakMap(), _SkyTextEditorComponent_sanitizationService = new WeakMap(), _SkyTextEditorComponent_ngControl = new WeakMap(), _SkyTextEditorComponent_zone = new WeakMap(), _SkyTextEditorComponent__fontList = new WeakMap(), _SkyTextEditorComponent__fontSizeList = new WeakMap(), _SkyTextEditorComponent__mergeFields = new WeakMap(), _SkyTextEditorComponent__menus = new WeakMap(), _SkyTextEditorComponent__toolbarActions = new WeakMap(), _SkyTextEditorComponent__disabled = new WeakMap(), _SkyTextEditorComponent__initialStyleState = new WeakMap(), _SkyTextEditorComponent__placeholder = new WeakMap(), _SkyTextEditorComponent__value = new WeakMap(), _SkyTextEditorComponent_instances = new WeakSet(), _SkyTextEditorComponent_updateStyle = function _SkyTextEditorComponent_updateStyle() {
|
|
1603
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent__initialStyleState, {
|
|
1604
|
+
...__classPrivateFieldGet(this, _SkyTextEditorComponent__initialStyleState, "f"),
|
|
1605
|
+
...__classPrivateFieldGet(this, _SkyTextEditorComponent_adapterService, "f").getStyleState(),
|
|
1606
|
+
}, "f");
|
|
1607
|
+
}, _SkyTextEditorComponent_initIframe = function _SkyTextEditorComponent_initIframe() {
|
|
1608
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_adapterService, "f").initEditor(this.id, this.iframeRef.nativeElement, this.initialStyleState, this.placeholder);
|
|
1609
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_editorService, "f")
|
|
1610
|
+
.inputListener()
|
|
1611
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyTextEditorComponent_ngUnsubscribe, "f")))
|
|
1612
|
+
.subscribe(() => {
|
|
1613
|
+
// Angular doesn't run change detection for changes originating inside an iframe,
|
|
1614
|
+
// so we have to call the onChange() event inside NgZone to force change propigation to consuming components.
|
|
1615
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_zone, "f").run(() => {
|
|
1616
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_instances, "m", _SkyTextEditorComponent_viewToModelUpdate).call(this);
|
|
1603
1617
|
});
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1618
|
+
});
|
|
1619
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_editorService, "f")
|
|
1620
|
+
.selectionChangeListener()
|
|
1621
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyTextEditorComponent_ngUnsubscribe, "f")))
|
|
1622
|
+
.subscribe(() => {
|
|
1623
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_instances, "m", _SkyTextEditorComponent_updateStyle).call(this);
|
|
1624
|
+
this.editorFocusStream.next();
|
|
1625
|
+
});
|
|
1626
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_editorService, "f")
|
|
1627
|
+
.clickListener()
|
|
1628
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyTextEditorComponent_ngUnsubscribe, "f")))
|
|
1629
|
+
.subscribe(() => {
|
|
1630
|
+
this.editorFocusStream.next();
|
|
1631
|
+
});
|
|
1632
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_editorService, "f")
|
|
1633
|
+
.blurListener()
|
|
1634
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyTextEditorComponent_ngUnsubscribe, "f")))
|
|
1635
|
+
.subscribe(() => {
|
|
1636
|
+
// Angular doesn't run change detection for changes originating inside an iframe,
|
|
1637
|
+
// so we have to run markForCheck() inside the NgZone to force change propigation to consuming components.
|
|
1638
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_zone, "f").run(() => {
|
|
1639
|
+
this._onTouched();
|
|
1610
1640
|
});
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
this
|
|
1641
|
+
});
|
|
1642
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_editorService, "f")
|
|
1643
|
+
.commandChangeListener()
|
|
1644
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyTextEditorComponent_ngUnsubscribe, "f")))
|
|
1645
|
+
.subscribe(() => {
|
|
1646
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_instances, "m", _SkyTextEditorComponent_updateStyle).call(this);
|
|
1647
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_instances, "m", _SkyTextEditorComponent_viewToModelUpdate).call(this);
|
|
1648
|
+
});
|
|
1649
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_adapterService, "f").setEditorInnerHtml(__classPrivateFieldGet(this, _SkyTextEditorComponent__value, "f"));
|
|
1650
|
+
/* istanbul ignore next */
|
|
1651
|
+
if (this.autofocus) {
|
|
1652
|
+
__classPrivateFieldGet(this, _SkyTextEditorComponent_adapterService, "f").focusEditor();
|
|
1617
1653
|
}
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1654
|
+
__classPrivateFieldSet(this, _SkyTextEditorComponent_initialized, true, "f");
|
|
1655
|
+
}, _SkyTextEditorComponent_viewToModelUpdate = function _SkyTextEditorComponent_viewToModelUpdate(emitChange = true) {
|
|
1656
|
+
this.value = __classPrivateFieldGet(this, _SkyTextEditorComponent_adapterService, "f").getEditorInnerHtml();
|
|
1657
|
+
/* istanbul ignore else */
|
|
1658
|
+
if (emitChange) {
|
|
1659
|
+
this._onChange(__classPrivateFieldGet(this, _SkyTextEditorComponent__value, "f"));
|
|
1624
1660
|
}
|
|
1625
|
-
}
|
|
1626
|
-
SkyTextEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
1627
|
-
SkyTextEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.
|
|
1628
|
-
|
|
1661
|
+
};
|
|
1662
|
+
SkyTextEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", 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 });
|
|
1663
|
+
SkyTextEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.11", 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" }, providers: [
|
|
1664
|
+
SkyTextEditorService,
|
|
1665
|
+
SkyTextEditorSelectionService,
|
|
1666
|
+
SkyTextEditorAdapterService,
|
|
1667
|
+
], viewQueries: [{ propertyName: "iframeRef", first: true, predicate: ["iframe"], descendants: 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 });
|
|
1668
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorComponent, decorators: [{
|
|
1629
1669
|
type: Component,
|
|
1630
|
-
args: [{ selector: 'sky-text-editor', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None,
|
|
1631
|
-
|
|
1670
|
+
args: [{ selector: 'sky-text-editor', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
1671
|
+
SkyTextEditorService,
|
|
1672
|
+
SkyTextEditorSelectionService,
|
|
1673
|
+
SkyTextEditorAdapterService,
|
|
1674
|
+
], 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"] }]
|
|
1675
|
+
}], 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: [{
|
|
1632
1676
|
type: Input
|
|
1633
1677
|
}], disabled: [{
|
|
1634
1678
|
type: Input
|
|
@@ -1655,8 +1699,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
1655
1699
|
|
|
1656
1700
|
class SkyTextEditorModule {
|
|
1657
1701
|
}
|
|
1658
|
-
SkyTextEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
1659
|
-
SkyTextEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.
|
|
1702
|
+
SkyTextEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1703
|
+
SkyTextEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorModule, declarations: [SkyTextEditorComponent,
|
|
1660
1704
|
SkyTextEditorUrlModalComponent,
|
|
1661
1705
|
SkyTextEditorToolbarComponent,
|
|
1662
1706
|
SkyTextEditorMenubarComponent], imports: [CommonModule,
|
|
@@ -1678,7 +1722,7 @@ SkyTextEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", ver
|
|
|
1678
1722
|
SkyTextEditorUrlModalComponent,
|
|
1679
1723
|
SkyTextEditorToolbarComponent,
|
|
1680
1724
|
SkyTextEditorMenubarComponent] });
|
|
1681
|
-
SkyTextEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.
|
|
1725
|
+
SkyTextEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorModule, imports: [CommonModule,
|
|
1682
1726
|
FormsModule,
|
|
1683
1727
|
ReactiveFormsModule,
|
|
1684
1728
|
SkyCoreAdapterModule,
|
|
@@ -1694,7 +1738,7 @@ SkyTextEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
|
|
|
1694
1738
|
SkyTabsModule,
|
|
1695
1739
|
SkyThemeModule,
|
|
1696
1740
|
SkyToolbarModule] });
|
|
1697
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
1741
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyTextEditorModule, decorators: [{
|
|
1698
1742
|
type: NgModule,
|
|
1699
1743
|
args: [{
|
|
1700
1744
|
imports: [
|