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