@kolkov/angular-editor 3.0.0-beta.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +57 -1
  2. package/README.md +75 -16
  3. package/assets/icons/icons.svg +2 -2
  4. package/fesm2022/kolkov-angular-editor.mjs +1360 -0
  5. package/fesm2022/kolkov-angular-editor.mjs.map +1 -0
  6. package/index.d.ts +412 -0
  7. package/package.json +10 -16
  8. package/themes/default.scss +22 -0
  9. package/esm2020/kolkov-angular-editor.mjs +0 -5
  10. package/esm2020/lib/ae-button/ae-button.component.mjs +0 -21
  11. package/esm2020/lib/ae-select/ae-select.component.mjs +0 -185
  12. package/esm2020/lib/ae-toolbar-set/ae-toolbar-set.component.mjs +0 -14
  13. package/esm2020/lib/angular-editor-toolbar.component.mjs +0 -365
  14. package/esm2020/lib/angular-editor.component.mjs +0 -415
  15. package/esm2020/lib/angular-editor.module.mjs +0 -27
  16. package/esm2020/lib/angular-editor.service.mjs +0 -275
  17. package/esm2020/lib/config.mjs +0 -36
  18. package/esm2020/lib/utils.mjs +0 -4
  19. package/esm2020/public-api.mjs +0 -11
  20. package/fesm2015/kolkov-angular-editor.mjs +0 -1324
  21. package/fesm2015/kolkov-angular-editor.mjs.map +0 -1
  22. package/fesm2020/kolkov-angular-editor.mjs +0 -1318
  23. package/fesm2020/kolkov-angular-editor.mjs.map +0 -1
  24. package/kolkov-angular-editor.d.ts +0 -5
  25. package/lib/ae-button/ae-button.component.d.ts +0 -7
  26. package/lib/ae-select/ae-select.component.d.ts +0 -46
  27. package/lib/ae-toolbar-set/ae-toolbar-set.component.d.ts +0 -6
  28. package/lib/angular-editor-toolbar.component.d.ts +0 -97
  29. package/lib/angular-editor.component.d.ts +0 -133
  30. package/lib/angular-editor.module.d.ts +0 -13
  31. package/lib/angular-editor.service.d.ts +0 -87
  32. package/lib/config.d.ts +0 -39
  33. package/lib/utils.d.ts +0 -1
  34. package/public-api.d.ts +0 -8
  35. package/src/lib/style.scss +0 -290
@@ -1,1324 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, Inject, Component, ViewEncapsulation, Input, EventEmitter, forwardRef, HostBinding, Output, ViewChild, HostListener, SecurityContext, Attribute, ContentChild, NgModule } from '@angular/core';
3
- import * as i1$1 from '@angular/common';
4
- import { DOCUMENT, CommonModule } from '@angular/common';
5
- import * as i1 from '@angular/common/http';
6
- import * as i6 from '@angular/forms';
7
- import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
8
- import * as i2 from '@angular/platform-browser';
9
-
10
- class AngularEditorService {
11
- constructor(http, doc) {
12
- this.http = http;
13
- this.doc = doc;
14
- /**
15
- * save selection when the editor is focussed out
16
- */
17
- this.saveSelection = () => {
18
- if (this.doc.getSelection) {
19
- const sel = this.doc.getSelection();
20
- if (sel.getRangeAt && sel.rangeCount) {
21
- this.savedSelection = sel.getRangeAt(0);
22
- this.selectedText = sel.toString();
23
- }
24
- }
25
- else if (this.doc.getSelection && this.doc.createRange) {
26
- this.savedSelection = document.createRange();
27
- }
28
- else {
29
- this.savedSelection = null;
30
- }
31
- };
32
- }
33
- /**
34
- * Executed command from editor header buttons exclude toggleEditorMode
35
- * @param command string from triggerCommand
36
- * @param value
37
- */
38
- executeCommand(command, value) {
39
- const commands = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'pre'];
40
- if (commands.includes(command)) {
41
- this.doc.execCommand('formatBlock', false, command);
42
- return;
43
- }
44
- this.doc.execCommand(command, false, value);
45
- }
46
- /**
47
- * Create URL link
48
- * @param url string from UI prompt
49
- */
50
- createLink(url) {
51
- if (!url.includes('http')) {
52
- this.doc.execCommand('createlink', false, url);
53
- }
54
- else {
55
- const newUrl = '<a href="' + url + '" target="_blank">' + this.selectedText + '</a>';
56
- this.insertHtml(newUrl);
57
- }
58
- }
59
- /**
60
- * insert color either font or background
61
- *
62
- * @param color color to be inserted
63
- * @param where where the color has to be inserted either text/background
64
- */
65
- insertColor(color, where) {
66
- const restored = this.restoreSelection();
67
- if (restored) {
68
- if (where === 'textColor') {
69
- this.doc.execCommand('foreColor', false, color);
70
- }
71
- else {
72
- this.doc.execCommand('hiliteColor', false, color);
73
- }
74
- }
75
- }
76
- /**
77
- * Set font name
78
- * @param fontName string
79
- */
80
- setFontName(fontName) {
81
- this.doc.execCommand('fontName', false, fontName);
82
- }
83
- /**
84
- * Set font size
85
- * @param fontSize string
86
- */
87
- setFontSize(fontSize) {
88
- this.doc.execCommand('fontSize', false, fontSize);
89
- }
90
- /**
91
- * Create raw HTML
92
- * @param html HTML string
93
- */
94
- insertHtml(html) {
95
- const isHTMLInserted = this.doc.execCommand('insertHTML', false, html);
96
- if (!isHTMLInserted) {
97
- throw new Error('Unable to perform the operation');
98
- }
99
- }
100
- /**
101
- * restore selection when the editor is focused in
102
- *
103
- * saved selection when the editor is focused out
104
- */
105
- restoreSelection() {
106
- if (this.savedSelection) {
107
- if (this.doc.getSelection) {
108
- const sel = this.doc.getSelection();
109
- sel.removeAllRanges();
110
- sel.addRange(this.savedSelection);
111
- return true;
112
- }
113
- else if (this.doc.getSelection /*&& this.savedSelection.select*/) {
114
- // this.savedSelection.select();
115
- return true;
116
- }
117
- }
118
- else {
119
- return false;
120
- }
121
- }
122
- /**
123
- * setTimeout used for execute 'saveSelection' method in next event loop iteration
124
- */
125
- executeInNextQueueIteration(callbackFn, timeout = 1e2) {
126
- setTimeout(callbackFn, timeout);
127
- }
128
- /** check any selection is made or not */
129
- checkSelection() {
130
- const selectedText = this.savedSelection.toString();
131
- if (selectedText.length === 0) {
132
- throw new Error('No Selection Made');
133
- }
134
- return true;
135
- }
136
- /**
137
- * Upload file to uploadUrl
138
- * @param file The file
139
- */
140
- uploadImage(file) {
141
- const uploadData = new FormData();
142
- uploadData.append('file', file, file.name);
143
- return this.http.post(this.uploadUrl, uploadData, {
144
- reportProgress: true,
145
- observe: 'events',
146
- withCredentials: this.uploadWithCredentials,
147
- });
148
- }
149
- /**
150
- * Insert image with Url
151
- * @param imageUrl The imageUrl.
152
- */
153
- insertImage(imageUrl) {
154
- this.doc.execCommand('insertImage', false, imageUrl);
155
- }
156
- setDefaultParagraphSeparator(separator) {
157
- this.doc.execCommand('defaultParagraphSeparator', false, separator);
158
- }
159
- createCustomClass(customClass) {
160
- let newTag = this.selectedText;
161
- if (customClass) {
162
- const tagName = customClass.tag ? customClass.tag : 'span';
163
- newTag = '<' + tagName + ' class="' + customClass.class + '">' + this.selectedText + '</' + tagName + '>';
164
- }
165
- this.insertHtml(newTag);
166
- }
167
- insertVideo(videoUrl) {
168
- if (videoUrl.match('www.youtube.com')) {
169
- this.insertYouTubeVideoTag(videoUrl);
170
- }
171
- if (videoUrl.match('vimeo.com')) {
172
- this.insertVimeoVideoTag(videoUrl);
173
- }
174
- }
175
- insertYouTubeVideoTag(videoUrl) {
176
- const id = videoUrl.split('v=')[1];
177
- const imageUrl = `https://img.youtube.com/vi/${id}/0.jpg`;
178
- const thumbnail = `
179
- <div style='position: relative'>
180
- <a href='${videoUrl}' target='_blank'>
181
- <img src="${imageUrl}" alt="click to watch"/>
182
- <img style='position: absolute; left:200px; top:140px'
183
- src="https://img.icons8.com/color/96/000000/youtube-play.png"/>
184
- </a>
185
- </div>`;
186
- this.insertHtml(thumbnail);
187
- }
188
- insertVimeoVideoTag(videoUrl) {
189
- const sub = this.http.get(`https://vimeo.com/api/oembed.json?url=${videoUrl}`).subscribe(data => {
190
- const imageUrl = data.thumbnail_url_with_play_button;
191
- const thumbnail = `<div>
192
- <a href='${videoUrl}' target='_blank'>
193
- <img src="${imageUrl}" alt="${data.title}"/>
194
- </a>
195
- </div>`;
196
- this.insertHtml(thumbnail);
197
- sub.unsubscribe();
198
- });
199
- }
200
- nextNode(node) {
201
- if (node.hasChildNodes()) {
202
- return node.firstChild;
203
- }
204
- else {
205
- while (node && !node.nextSibling) {
206
- node = node.parentNode;
207
- }
208
- if (!node) {
209
- return null;
210
- }
211
- return node.nextSibling;
212
- }
213
- }
214
- getRangeSelectedNodes(range, includePartiallySelectedContainers) {
215
- let node = range.startContainer;
216
- const endNode = range.endContainer;
217
- let rangeNodes = [];
218
- // Special case for a range that is contained within a single node
219
- if (node === endNode) {
220
- rangeNodes = [node];
221
- }
222
- else {
223
- // Iterate nodes until we hit the end container
224
- while (node && node !== endNode) {
225
- rangeNodes.push(node = this.nextNode(node));
226
- }
227
- // Add partially selected nodes at the start of the range
228
- node = range.startContainer;
229
- while (node && node !== range.commonAncestorContainer) {
230
- rangeNodes.unshift(node);
231
- node = node.parentNode;
232
- }
233
- }
234
- // Add ancestors of the range container, if required
235
- if (includePartiallySelectedContainers) {
236
- node = range.commonAncestorContainer;
237
- while (node) {
238
- rangeNodes.push(node);
239
- node = node.parentNode;
240
- }
241
- }
242
- return rangeNodes;
243
- }
244
- getSelectedNodes() {
245
- const nodes = [];
246
- if (this.doc.getSelection) {
247
- const sel = this.doc.getSelection();
248
- for (let i = 0, len = sel.rangeCount; i < len; ++i) {
249
- nodes.push.apply(nodes, this.getRangeSelectedNodes(sel.getRangeAt(i), true));
250
- }
251
- }
252
- return nodes;
253
- }
254
- replaceWithOwnChildren(el) {
255
- const parent = el.parentNode;
256
- while (el.hasChildNodes()) {
257
- parent.insertBefore(el.firstChild, el);
258
- }
259
- parent.removeChild(el);
260
- }
261
- removeSelectedElements(tagNames) {
262
- const tagNamesArray = tagNames.toLowerCase().split(',');
263
- this.getSelectedNodes().forEach((node) => {
264
- if (node.nodeType === 1 &&
265
- tagNamesArray.indexOf(node.tagName.toLowerCase()) > -1) {
266
- // Remove the node and replace it with its children
267
- this.replaceWithOwnChildren(node);
268
- }
269
- });
270
- }
271
- }
272
- AngularEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AngularEditorService, deps: [{ token: i1.HttpClient }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
273
- AngularEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AngularEditorService });
274
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AngularEditorService, decorators: [{
275
- type: Injectable
276
- }], ctorParameters: function () {
277
- return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
278
- type: Inject,
279
- args: [DOCUMENT]
280
- }] }];
281
- } });
282
-
283
- const angularEditorConfig = {
284
- editable: true,
285
- spellcheck: true,
286
- height: 'auto',
287
- minHeight: '0',
288
- maxHeight: 'auto',
289
- width: 'auto',
290
- minWidth: '0',
291
- translate: 'yes',
292
- enableToolbar: true,
293
- showToolbar: true,
294
- placeholder: 'Enter text here...',
295
- defaultParagraphSeparator: '',
296
- defaultFontName: '',
297
- defaultFontSize: '',
298
- fonts: [
299
- { class: 'arial', name: 'Arial' },
300
- { class: 'times-new-roman', name: 'Times New Roman' },
301
- { class: 'calibri', name: 'Calibri' },
302
- { class: 'comic-sans-ms', name: 'Comic Sans MS' }
303
- ],
304
- uploadUrl: 'v1/image',
305
- uploadWithCredentials: false,
306
- sanitize: true,
307
- toolbarPosition: 'top',
308
- outline: true,
309
- /*toolbarHiddenButtons: [
310
- ['bold', 'italic', 'underline', 'strikeThrough', 'superscript', 'subscript'],
311
- ['heading', 'fontName', 'fontSize', 'color'],
312
- ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull', 'indent', 'outdent'],
313
- ['cut', 'copy', 'delete', 'removeFormat', 'undo', 'redo'],
314
- ['paragraph', 'blockquote', 'removeBlockquote', 'horizontalLine', 'orderedList', 'unorderedList'],
315
- ['link', 'unlink', 'image', 'video']
316
- ]*/
317
- };
318
-
319
- function isDefined(value) {
320
- return value !== undefined && value !== null;
321
- }
322
-
323
- class AeToolbarSetComponent {
324
- constructor() { }
325
- }
326
- AeToolbarSetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AeToolbarSetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
327
- AeToolbarSetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: AeToolbarSetComponent, selector: "ae-toolbar-set, [aeToolbarSet]", host: { classAttribute: "angular-editor-toolbar-set" }, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [""], encapsulation: i0.ViewEncapsulation.None });
328
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AeToolbarSetComponent, decorators: [{
329
- type: Component,
330
- args: [{ selector: 'ae-toolbar-set, [aeToolbarSet]', encapsulation: ViewEncapsulation.None, host: {
331
- 'class': 'angular-editor-toolbar-set'
332
- }, template: "<ng-content></ng-content>\n", styles: [""] }]
333
- }], ctorParameters: function () { return []; } });
334
-
335
- class AeButtonComponent {
336
- constructor() {
337
- this.iconName = '';
338
- }
339
- }
340
- AeButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AeButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
341
- AeButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: AeButtonComponent, selector: "ae-button, button[aeButton]", inputs: { iconName: "iconName" }, host: { properties: { "tabIndex": "-1", "type": "\"button\"" }, classAttribute: "angular-editor-button" }, ngImport: i0, template: "<ng-container *ngIf=\"iconName; else contentTemplate\">\n <svg>\n <use [attr.href]=\"'assets/ae-icons/icons.svg#' + iconName\" [attr.xlink:href]=\"'assets/ae-icons/icons.svg#' + iconName\"></use>\n </svg>\n</ng-container>\n<ng-template #contentTemplate>\n <ng-content></ng-content>\n</ng-template>\n", styles: ["a{cursor:pointer}.angular-editor-textarea{min-height:150px;overflow:auto;margin-top:5px;resize:vertical}.angular-editor-textarea:after{content:\"\";position:absolute;bottom:0;right:0;display:block;width:8px;height:8px;cursor:nwse-resize;background-color:#ffffff80}.angular-editor-toolbar{font:100 14px/15px Roboto,Arial,sans-serif;background-color:#f5f5f5;font-size:.8rem;padding:.2rem;border:1px solid #ddd;display:flex;flex-wrap:wrap;gap:4px}.angular-editor-toolbar .angular-editor-toolbar-set{display:flex;gap:1px;width:fit-content;vertical-align:baseline}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button{background-color:#fff;vertical-align:middle;border:1px solid #ddd;padding:.4rem;float:left;width:2rem;height:2rem}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:focus,.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.focus{outline:0}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label{pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label.foreground :after{background:#555555}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label.background{background:#555555}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.active{background:#fff5b9}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.active:hover{background-color:#fffa98}.angular-editor-toolbar .angular-editor-toolbar-set select{font-size:11px;width:90px;vertical-align:middle;background-color:transparent;border:.5px solid rgba(255,255,255,0);border-radius:5px;outline:none;padding:.4rem;cursor:pointer}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-heading optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading option{border:1px solid;background-color:#fff}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .default{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h1{font-size:24px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h2{font-size:20px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h3{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h4{font-size:15px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h5{font-size:14px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h6{font-size:13px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .div,.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .pre{font-size:12px}}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-font{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-font optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font option{border:1px solid;background-color:#fff}}.angular-editor-toolbar .angular-editor-toolbar-set .select-font:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-font:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size{display:inline-block;width:50px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size option{border:1px solid;background-color:#fff}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size1{font-size:10px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size2{font-size:12px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size3{font-size:14px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size4{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size5{font-size:18px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size6{font-size:20px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size7{font-size:22px}}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style option{border:1px solid;background-color:#fff}}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .color-label{position:relative;cursor:pointer}.angular-editor-toolbar .angular-editor-toolbar-set .background{font-size:smaller;background:#1b1b1b;color:#fff;padding:3px}.angular-editor-toolbar .angular-editor-toolbar-set .foreground :after{position:absolute;content:\"\";inset:auto auto -3px -1px;width:15px;height:2px;z-index:0;background:#1b1b1b}.select-button{display:inline-block}.select-button.disabled{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}\n"], directives: [{ type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None });
342
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AeButtonComponent, decorators: [{
343
- type: Component,
344
- args: [{ selector: 'ae-button, button[aeButton]', encapsulation: ViewEncapsulation.None, host: {
345
- 'class': 'angular-editor-button',
346
- '[tabIndex]': '-1',
347
- '[type]': '"button"',
348
- }, template: "<ng-container *ngIf=\"iconName; else contentTemplate\">\n <svg>\n <use [attr.href]=\"'assets/ae-icons/icons.svg#' + iconName\" [attr.xlink:href]=\"'assets/ae-icons/icons.svg#' + iconName\"></use>\n </svg>\n</ng-container>\n<ng-template #contentTemplate>\n <ng-content></ng-content>\n</ng-template>\n", styles: ["a{cursor:pointer}.angular-editor-textarea{min-height:150px;overflow:auto;margin-top:5px;resize:vertical}.angular-editor-textarea:after{content:\"\";position:absolute;bottom:0;right:0;display:block;width:8px;height:8px;cursor:nwse-resize;background-color:#ffffff80}.angular-editor-toolbar{font:100 14px/15px Roboto,Arial,sans-serif;background-color:#f5f5f5;font-size:.8rem;padding:.2rem;border:1px solid #ddd;display:flex;flex-wrap:wrap;gap:4px}.angular-editor-toolbar .angular-editor-toolbar-set{display:flex;gap:1px;width:fit-content;vertical-align:baseline}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button{background-color:#fff;vertical-align:middle;border:1px solid #ddd;padding:.4rem;float:left;width:2rem;height:2rem}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:focus,.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.focus{outline:0}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label{pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label.foreground :after{background:#555555}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label.background{background:#555555}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.active{background:#fff5b9}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.active:hover{background-color:#fffa98}.angular-editor-toolbar .angular-editor-toolbar-set select{font-size:11px;width:90px;vertical-align:middle;background-color:transparent;border:.5px solid rgba(255,255,255,0);border-radius:5px;outline:none;padding:.4rem;cursor:pointer}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-heading optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading option{border:1px solid;background-color:#fff}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .default{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h1{font-size:24px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h2{font-size:20px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h3{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h4{font-size:15px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h5{font-size:14px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h6{font-size:13px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .div,.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .pre{font-size:12px}}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-font{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-font optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font option{border:1px solid;background-color:#fff}}.angular-editor-toolbar .angular-editor-toolbar-set .select-font:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-font:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size{display:inline-block;width:50px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size option{border:1px solid;background-color:#fff}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size1{font-size:10px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size2{font-size:12px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size3{font-size:14px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size4{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size5{font-size:18px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size6{font-size:20px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size7{font-size:22px}}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style option{border:1px solid;background-color:#fff}}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .color-label{position:relative;cursor:pointer}.angular-editor-toolbar .angular-editor-toolbar-set .background{font-size:smaller;background:#1b1b1b;color:#fff;padding:3px}.angular-editor-toolbar .angular-editor-toolbar-set .foreground :after{position:absolute;content:\"\";inset:auto auto -3px -1px;width:15px;height:2px;z-index:0;background:#1b1b1b}.select-button{display:inline-block}.select-button.disabled{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}\n"] }]
349
- }], ctorParameters: function () { return []; }, propDecorators: { iconName: [{
350
- type: Input
351
- }] } });
352
-
353
- class AeSelectComponent {
354
- constructor(elRef, r) {
355
- this.elRef = elRef;
356
- this.r = r;
357
- this.options = [];
358
- this.disabled = false;
359
- this.optionId = 0;
360
- this.opened = false;
361
- this.hidden = 'inline-block';
362
- // eslint-disable-next-line @angular-eslint/no-output-native, @angular-eslint/no-output-rename
363
- this.changeEvent = new EventEmitter();
364
- this.onChange = () => {
365
- };
366
- this.onTouched = () => {
367
- };
368
- }
369
- get label() {
370
- return this.selectedOption && this.selectedOption.hasOwnProperty('label') ? this.selectedOption.label : 'Select';
371
- }
372
- get value() {
373
- return this.selectedOption.value;
374
- }
375
- ngOnInit() {
376
- this.selectedOption = this.options[0];
377
- if (isDefined(this.isHidden) && this.isHidden) {
378
- this.hide();
379
- }
380
- }
381
- hide() {
382
- this.hidden = 'none';
383
- }
384
- optionSelect(option, event) {
385
- event.stopPropagation();
386
- this.setValue(option.value);
387
- this.onChange(this.selectedOption.value);
388
- this.changeEvent.emit(this.selectedOption.value);
389
- this.onTouched();
390
- this.opened = false;
391
- }
392
- toggleOpen(event) {
393
- // event.stopPropagation();
394
- if (this.disabled) {
395
- return;
396
- }
397
- this.opened = !this.opened;
398
- }
399
- onClick($event) {
400
- if (!this.elRef.nativeElement.contains($event.target)) {
401
- this.close();
402
- }
403
- }
404
- close() {
405
- this.opened = false;
406
- }
407
- get isOpen() {
408
- return this.opened;
409
- }
410
- writeValue(value) {
411
- if (!value || typeof value !== 'string') {
412
- return;
413
- }
414
- this.setValue(value);
415
- }
416
- setValue(value) {
417
- let index = 0;
418
- const selectedEl = this.options.find((el, i) => {
419
- index = i;
420
- return el.value === value;
421
- });
422
- if (selectedEl) {
423
- this.selectedOption = selectedEl;
424
- this.optionId = index;
425
- }
426
- }
427
- registerOnChange(fn) {
428
- this.onChange = fn;
429
- }
430
- registerOnTouched(fn) {
431
- this.onTouched = fn;
432
- }
433
- setDisabledState(isDisabled) {
434
- this.labelButton.nativeElement.disabled = isDisabled;
435
- const div = this.labelButton.nativeElement;
436
- const action = isDisabled ? 'addClass' : 'removeClass';
437
- this.r[action](div, 'disabled');
438
- this.disabled = isDisabled;
439
- }
440
- handleKeyDown($event) {
441
- if (!this.opened) {
442
- return;
443
- }
444
- // console.log($event.key);
445
- // if (KeyCode[$event.key]) {
446
- switch ($event.key) {
447
- case 'ArrowDown':
448
- this._handleArrowDown($event);
449
- break;
450
- case 'ArrowUp':
451
- this._handleArrowUp($event);
452
- break;
453
- case 'Space':
454
- this._handleSpace($event);
455
- break;
456
- case 'Enter':
457
- this._handleEnter($event);
458
- break;
459
- case 'Tab':
460
- this._handleTab($event);
461
- break;
462
- case 'Escape':
463
- this.close();
464
- $event.preventDefault();
465
- break;
466
- case 'Backspace':
467
- this._handleBackspace();
468
- break;
469
- }
470
- // } else if ($event.key && $event.key.length === 1) {
471
- // this._keyPress$.next($event.key.toLocaleLowerCase());
472
- // }
473
- }
474
- _handleArrowDown($event) {
475
- if (this.optionId < this.options.length - 1) {
476
- this.optionId++;
477
- }
478
- }
479
- _handleArrowUp($event) {
480
- if (this.optionId >= 1) {
481
- this.optionId--;
482
- }
483
- }
484
- _handleSpace($event) {
485
- }
486
- _handleEnter($event) {
487
- this.optionSelect(this.options[this.optionId], $event);
488
- }
489
- _handleTab($event) {
490
- }
491
- _handleBackspace() {
492
- }
493
- }
494
- AeSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AeSelectComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
495
- AeSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: AeSelectComponent, selector: "ae-select", inputs: { options: "options", isHidden: ["hidden", "isHidden"] }, outputs: { changeEvent: "change" }, host: { listeners: { "document:click": "onClick($event)", "keydown": "handleKeyDown($event)" }, properties: { "style.display": "this.hidden" } }, providers: [
496
- {
497
- provide: NG_VALUE_ACCESSOR,
498
- useExisting: forwardRef(() => AeSelectComponent),
499
- multi: true,
500
- }
501
- ], viewQueries: [{ propertyName: "labelButton", first: true, predicate: ["labelButton"], descendants: true, static: true }], ngImport: i0, template: "<span class=\"ae-font ae-picker\" [ngClass]=\"{'ae-expanded':isOpen}\">\n <button [tabIndex]=\"-1\" #labelButton tabindex=\"0\" type=\"button\" role=\"button\" class=\"ae-picker-label\" (click)=\"toggleOpen($event);\">{{label}}\n <svg>\n <use [attr.href]=\"'assets/ae-icons/icons.svg#sort'\" [attr.xlink:href]=\"'assets/ae-icons/icons.svg#sort'\"></use>\n </svg>\n </button>\n <span class=\"ae-picker-options\">\n <button tabindex=\"-1\" type=\"button\" role=\"button\" class=\"ae-picker-item\"\n *ngFor=\"let item of options; let i = index\"\n [ngClass]=\"{'selected': item.value === value, 'focused': i === optionId}\"\n (click)=\"optionSelect(item, $event)\">\n {{item.label}}\n </button>\n <span class=\"dropdown-item\" *ngIf=\"!options.length\">No items for select</span>\n </span>\n</span>\n", styles: [".ae-font.ae-picker{color:#444;display:inline-block;float:left;width:100%;position:relative;vertical-align:middle}.ae-font .ae-picker-label{cursor:pointer;display:inline-block;padding-left:8px;padding-right:10px;position:relative;width:100%;line-height:1.8rem;vertical-align:middle;font-size:85%;text-align:left;background-color:#fff;min-width:2rem;float:left;border:1px solid #ddd;text-overflow:clip;overflow:hidden;white-space:nowrap;height:2rem}.ae-font .ae-picker-label:before{content:\"\";position:absolute;right:0;top:0;width:20px;height:100%;background:linear-gradient(to right,white,#ffffff 100%)}.ae-font .ae-picker-label:focus{outline:none}.ae-font .ae-picker-label:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.ae-font .ae-picker-label:hover:before{background:linear-gradient(to right,#f5f5f5 100%,#ffffff 100%)}.ae-font .ae-picker-label:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.ae-font .ae-picker-label:disabled:before{background:linear-gradient(to right,#f5f5f5 100%,#ffffff 100%)}.ae-font .ae-picker-label svg{position:absolute;right:0;width:1rem}.ae-font .ae-picker-label svg:not(:root){overflow:hidden}.ae-font .ae-picker-label svg .ae-stroke{fill:none;stroke:#444;stroke-linecap:round;stroke-linejoin:round;stroke-width:2}.ae-font .ae-picker-options{background-color:#fff;display:none;min-width:100%;position:absolute;white-space:nowrap;z-index:3;border:1px solid transparent;box-shadow:#0003 0 2px 8px}.ae-font .ae-picker-options .ae-picker-item{cursor:pointer;display:block;padding-bottom:5px;padding-top:5px;padding-left:5px;z-index:3;text-align:left;background-color:transparent;min-width:2rem;width:100%;border:0 solid #ddd}.ae-font .ae-picker-options .ae-picker-item.selected{color:#06c;background-color:#fff4c2}.ae-font .ae-picker-options .ae-picker-item.focused,.ae-font .ae-picker-options .ae-picker-item:hover{background-color:#fffa98}.ae-font.ae-expanded{display:block;margin-top:-1px;z-index:1}.ae-font.ae-expanded .ae-picker-label{color:#ccc;z-index:2}.ae-font.ae-expanded .ae-picker-label svg{color:#ccc;z-index:2}.ae-font.ae-expanded .ae-picker-label svg .ae-stroke{stroke:#ccc}.ae-font.ae-expanded .ae-picker-options{display:block;margin-top:-1px;top:100%;z-index:3;border-color:#ccc}svg{width:100%;height:100%}\n"], directives: [{ type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None });
502
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AeSelectComponent, decorators: [{
503
- type: Component,
504
- args: [{ selector: 'ae-select', encapsulation: ViewEncapsulation.None, providers: [
505
- {
506
- provide: NG_VALUE_ACCESSOR,
507
- useExisting: forwardRef(() => AeSelectComponent),
508
- multi: true,
509
- }
510
- ], template: "<span class=\"ae-font ae-picker\" [ngClass]=\"{'ae-expanded':isOpen}\">\n <button [tabIndex]=\"-1\" #labelButton tabindex=\"0\" type=\"button\" role=\"button\" class=\"ae-picker-label\" (click)=\"toggleOpen($event);\">{{label}}\n <svg>\n <use [attr.href]=\"'assets/ae-icons/icons.svg#sort'\" [attr.xlink:href]=\"'assets/ae-icons/icons.svg#sort'\"></use>\n </svg>\n </button>\n <span class=\"ae-picker-options\">\n <button tabindex=\"-1\" type=\"button\" role=\"button\" class=\"ae-picker-item\"\n *ngFor=\"let item of options; let i = index\"\n [ngClass]=\"{'selected': item.value === value, 'focused': i === optionId}\"\n (click)=\"optionSelect(item, $event)\">\n {{item.label}}\n </button>\n <span class=\"dropdown-item\" *ngIf=\"!options.length\">No items for select</span>\n </span>\n</span>\n", styles: [".ae-font.ae-picker{color:#444;display:inline-block;float:left;width:100%;position:relative;vertical-align:middle}.ae-font .ae-picker-label{cursor:pointer;display:inline-block;padding-left:8px;padding-right:10px;position:relative;width:100%;line-height:1.8rem;vertical-align:middle;font-size:85%;text-align:left;background-color:#fff;min-width:2rem;float:left;border:1px solid #ddd;text-overflow:clip;overflow:hidden;white-space:nowrap;height:2rem}.ae-font .ae-picker-label:before{content:\"\";position:absolute;right:0;top:0;width:20px;height:100%;background:linear-gradient(to right,white,#ffffff 100%)}.ae-font .ae-picker-label:focus{outline:none}.ae-font .ae-picker-label:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.ae-font .ae-picker-label:hover:before{background:linear-gradient(to right,#f5f5f5 100%,#ffffff 100%)}.ae-font .ae-picker-label:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.ae-font .ae-picker-label:disabled:before{background:linear-gradient(to right,#f5f5f5 100%,#ffffff 100%)}.ae-font .ae-picker-label svg{position:absolute;right:0;width:1rem}.ae-font .ae-picker-label svg:not(:root){overflow:hidden}.ae-font .ae-picker-label svg .ae-stroke{fill:none;stroke:#444;stroke-linecap:round;stroke-linejoin:round;stroke-width:2}.ae-font .ae-picker-options{background-color:#fff;display:none;min-width:100%;position:absolute;white-space:nowrap;z-index:3;border:1px solid transparent;box-shadow:#0003 0 2px 8px}.ae-font .ae-picker-options .ae-picker-item{cursor:pointer;display:block;padding-bottom:5px;padding-top:5px;padding-left:5px;z-index:3;text-align:left;background-color:transparent;min-width:2rem;width:100%;border:0 solid #ddd}.ae-font .ae-picker-options .ae-picker-item.selected{color:#06c;background-color:#fff4c2}.ae-font .ae-picker-options .ae-picker-item.focused,.ae-font .ae-picker-options .ae-picker-item:hover{background-color:#fffa98}.ae-font.ae-expanded{display:block;margin-top:-1px;z-index:1}.ae-font.ae-expanded .ae-picker-label{color:#ccc;z-index:2}.ae-font.ae-expanded .ae-picker-label svg{color:#ccc;z-index:2}.ae-font.ae-expanded .ae-picker-label svg .ae-stroke{stroke:#ccc}.ae-font.ae-expanded .ae-picker-options{display:block;margin-top:-1px;top:100%;z-index:3;border-color:#ccc}svg{width:100%;height:100%}\n"] }]
511
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { options: [{
512
- type: Input
513
- }], isHidden: [{
514
- type: Input,
515
- args: ['hidden']
516
- }], hidden: [{
517
- type: HostBinding,
518
- args: ['style.display']
519
- }], changeEvent: [{
520
- type: Output,
521
- args: ['change']
522
- }], labelButton: [{
523
- type: ViewChild,
524
- args: ['labelButton', { static: true }]
525
- }], onClick: [{
526
- type: HostListener,
527
- args: ['document:click', ['$event']]
528
- }], handleKeyDown: [{
529
- type: HostListener,
530
- args: ['keydown', ['$event']]
531
- }] } });
532
-
533
- class AngularEditorToolbarComponent {
534
- constructor(r, editorService, er, doc) {
535
- this.r = r;
536
- this.editorService = editorService;
537
- this.er = er;
538
- this.doc = doc;
539
- this.htmlMode = false;
540
- this.linkSelected = false;
541
- this.block = 'default';
542
- this.fontName = 'Times New Roman';
543
- this.fontSize = '3';
544
- this.headings = [
545
- {
546
- label: 'Heading 1',
547
- value: 'h1',
548
- },
549
- {
550
- label: 'Heading 2',
551
- value: 'h2',
552
- },
553
- {
554
- label: 'Heading 3',
555
- value: 'h3',
556
- },
557
- {
558
- label: 'Heading 4',
559
- value: 'h4',
560
- },
561
- {
562
- label: 'Heading 5',
563
- value: 'h5',
564
- },
565
- {
566
- label: 'Heading 6',
567
- value: 'h6',
568
- },
569
- {
570
- label: 'Heading 7',
571
- value: 'h7',
572
- },
573
- {
574
- label: 'Paragraph',
575
- value: 'p',
576
- },
577
- {
578
- label: 'Predefined',
579
- value: 'pre'
580
- },
581
- {
582
- label: 'Standard',
583
- value: 'div'
584
- },
585
- {
586
- label: 'default',
587
- value: 'default'
588
- }
589
- ];
590
- this.fontSizes = [
591
- {
592
- label: '1',
593
- value: '1',
594
- },
595
- {
596
- label: '2',
597
- value: '2',
598
- },
599
- {
600
- label: '3',
601
- value: '3',
602
- },
603
- {
604
- label: '4',
605
- value: '4',
606
- },
607
- {
608
- label: '5',
609
- value: '5',
610
- },
611
- {
612
- label: '6',
613
- value: '6',
614
- },
615
- {
616
- label: '7',
617
- value: '7',
618
- }
619
- ];
620
- this.customClassId = '-1';
621
- this.customClassList = [{ label: '', value: '' }];
622
- // uploadUrl: string;
623
- this.tagMap = {
624
- BLOCKQUOTE: 'indent',
625
- A: 'link'
626
- };
627
- this.select = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'P', 'PRE', 'DIV'];
628
- this.buttons = ['bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', 'justifyLeft', 'justifyCenter',
629
- 'justifyRight', 'justifyFull', 'indent', 'outdent', 'insertUnorderedList', 'insertOrderedList', 'link'];
630
- this.fonts = [{ label: '', value: '' }];
631
- this.execute = new EventEmitter();
632
- }
633
- set customClasses(classes) {
634
- if (classes) {
635
- this._customClasses = classes;
636
- this.customClassList = this._customClasses.map((x, i) => ({ label: x.name, value: i.toString() }));
637
- this.customClassList.unshift({ label: 'Clear Class', value: '-1' });
638
- }
639
- }
640
- set defaultFontName(value) {
641
- if (value) {
642
- this.fontName = value;
643
- }
644
- }
645
- set defaultFontSize(value) {
646
- if (value) {
647
- this.fontSize = value;
648
- }
649
- }
650
- get isLinkButtonDisabled() {
651
- return this.htmlMode || !Boolean(this.editorService.selectedText);
652
- }
653
- /**
654
- * Trigger command from editor header buttons
655
- * @param command string from toolbar buttons
656
- */
657
- triggerCommand(command) {
658
- this.execute.emit(command);
659
- }
660
- /**
661
- * highlight editor buttons when cursor moved or positioning
662
- */
663
- triggerButtons() {
664
- if (!this.showToolbar) {
665
- return;
666
- }
667
- this.buttons.forEach(e => {
668
- const result = this.doc.queryCommandState(e);
669
- const elementById = this.doc.getElementById(e + '-' + this.id);
670
- if (result) {
671
- this.r.addClass(elementById, 'active');
672
- }
673
- else {
674
- this.r.removeClass(elementById, 'active');
675
- }
676
- });
677
- }
678
- /**
679
- * trigger highlight editor buttons when cursor moved or positioning in block
680
- */
681
- triggerBlocks(nodes) {
682
- if (!this.showToolbar) {
683
- return;
684
- }
685
- this.linkSelected = nodes.findIndex(x => x.nodeName === 'A') > -1;
686
- let found = false;
687
- this.select.forEach(y => {
688
- const node = nodes.find(x => x.nodeName === y);
689
- if (node !== undefined && y === node.nodeName) {
690
- if (found === false) {
691
- this.block = node.nodeName.toLowerCase();
692
- found = true;
693
- }
694
- }
695
- else if (found === false) {
696
- this.block = 'default';
697
- }
698
- });
699
- found = false;
700
- if (this._customClasses) {
701
- this._customClasses.forEach((y, index) => {
702
- const node = nodes.find(x => {
703
- if (x instanceof Element) {
704
- return x.className === y.class;
705
- }
706
- });
707
- if (node !== undefined) {
708
- if (found === false) {
709
- this.customClassId = index.toString();
710
- found = true;
711
- }
712
- }
713
- else if (found === false) {
714
- this.customClassId = '-1';
715
- }
716
- });
717
- }
718
- Object.keys(this.tagMap).map(e => {
719
- const elementById = this.doc.getElementById(this.tagMap[e] + '-' + this.id);
720
- const node = nodes.find(x => x.nodeName === e);
721
- if (node !== undefined && e === node.nodeName) {
722
- this.r.addClass(elementById, 'active');
723
- }
724
- else {
725
- this.r.removeClass(elementById, 'active');
726
- }
727
- });
728
- this.foreColour = this.doc.queryCommandValue('ForeColor');
729
- this.fontSize = this.doc.queryCommandValue('FontSize');
730
- this.fontName = this.doc.queryCommandValue('FontName').replace(/"/g, '');
731
- this.backColor = this.doc.queryCommandValue('backColor');
732
- }
733
- /**
734
- * insert URL link
735
- */
736
- insertUrl() {
737
- let url = 'https:\/\/';
738
- const selection = this.editorService.savedSelection;
739
- if (selection && selection.commonAncestorContainer.parentElement.nodeName === 'A') {
740
- const parent = selection.commonAncestorContainer.parentElement;
741
- if (parent.href !== '') {
742
- url = parent.href;
743
- }
744
- }
745
- url = prompt('Insert URL link', url);
746
- if (url && url !== '' && url !== 'https://') {
747
- this.editorService.createLink(url);
748
- }
749
- }
750
- /**
751
- * insert Video link
752
- */
753
- insertVideo() {
754
- this.execute.emit('');
755
- const url = prompt('Insert Video link', `https://`);
756
- if (url && url !== '' && url !== `https://`) {
757
- this.editorService.insertVideo(url);
758
- }
759
- }
760
- /** insert color */
761
- insertColor(color, where) {
762
- this.editorService.insertColor(color, where);
763
- this.execute.emit('');
764
- }
765
- /**
766
- * set font Name/family
767
- * @param foreColor string
768
- */
769
- setFontName(foreColor) {
770
- this.editorService.setFontName(foreColor);
771
- this.execute.emit('');
772
- }
773
- /**
774
- * set font Size
775
- * @param fontSize string
776
- */
777
- setFontSize(fontSize) {
778
- this.editorService.setFontSize(fontSize);
779
- this.execute.emit('');
780
- }
781
- /**
782
- * toggle editor mode (WYSIWYG or SOURCE)
783
- * @param m boolean
784
- */
785
- setEditorMode(m) {
786
- const toggleEditorModeButton = this.doc.getElementById('toggleEditorMode' + '-' + this.id);
787
- if (m) {
788
- this.r.addClass(toggleEditorModeButton, 'active');
789
- }
790
- else {
791
- this.r.removeClass(toggleEditorModeButton, 'active');
792
- }
793
- this.htmlMode = m;
794
- }
795
- /**
796
- * Upload image when file is selected.
797
- */
798
- onFileChanged(event) {
799
- const file = event.target.files[0];
800
- if (file.type.includes('image/')) {
801
- if (this.upload) {
802
- this.upload(file).subscribe((response) => this.watchUploadImage(response, event));
803
- }
804
- else if (this.uploadUrl) {
805
- this.editorService.uploadImage(file).subscribe((response) => this.watchUploadImage(response, event));
806
- }
807
- else {
808
- const reader = new FileReader();
809
- reader.onload = (e) => {
810
- const fr = e.currentTarget;
811
- this.editorService.insertImage(fr.result.toString());
812
- };
813
- reader.readAsDataURL(file);
814
- }
815
- }
816
- }
817
- watchUploadImage(response, event) {
818
- const { imageUrl } = response.body;
819
- this.editorService.insertImage(imageUrl);
820
- event.srcElement.value = null;
821
- }
822
- /**
823
- * Set custom class
824
- */
825
- setCustomClass(classId) {
826
- if (classId === '-1') {
827
- this.execute.emit('clear');
828
- }
829
- else {
830
- this.editorService.createCustomClass(this._customClasses[+classId]);
831
- }
832
- }
833
- isButtonHidden(name) {
834
- if (!name) {
835
- return false;
836
- }
837
- if (!(this.hiddenButtons instanceof Array)) {
838
- return false;
839
- }
840
- let result;
841
- for (const arr of this.hiddenButtons) {
842
- if (arr instanceof Array) {
843
- result = arr.find(item => item === name);
844
- }
845
- if (result) {
846
- break;
847
- }
848
- }
849
- return result !== undefined;
850
- }
851
- focus() {
852
- this.execute.emit('focus');
853
- console.log('focused');
854
- }
855
- }
856
- AngularEditorToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AngularEditorToolbarComponent, deps: [{ token: i0.Renderer2 }, { token: AngularEditorService }, { token: i0.ElementRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
857
- AngularEditorToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: AngularEditorToolbarComponent, selector: "angular-editor-toolbar", inputs: { id: "id", uploadUrl: "uploadUrl", upload: "upload", showToolbar: "showToolbar", fonts: "fonts", customClasses: "customClasses", defaultFontName: "defaultFontName", defaultFontSize: "defaultFontSize", hiddenButtons: "hiddenButtons" }, outputs: { execute: "execute" }, viewQueries: [{ propertyName: "myInputFile", first: true, predicate: ["fileInput"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"angular-editor-toolbar\" *ngIf=\"showToolbar\">\n <div aeToolbarSet>\n <button aeButton title=\"Undo\" iconName=\"undo\" (click)=\"triggerCommand('undo')\" [hidden]=\"isButtonHidden('undo')\">\n </button>\n <button aeButton title=\"Redo\" iconName=\"redo\" (click)=\"triggerCommand('redo')\"\n [hidden]=\"isButtonHidden('redo')\">\n </button>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'bold-'+id\" aeButton title=\"Bold\" iconName=\"bold\" (click)=\"triggerCommand('bold')\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('bold')\">\n </button>\n <button [id]=\"'italic-'+id\" aeButton iconName=\"italic\" title=\"Italic\" (click)=\"triggerCommand('italic')\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('italic')\">\n </button>\n <button [id]=\"'underline-'+id\" aeButton title=\"Underline\" iconName=\"underline\"\n (click)=\"triggerCommand('underline')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('underline')\">\n </button>\n <button [id]=\"'strikeThrough-'+id\" aeButton iconName=\"strikeThrough\" title=\"Strikethrough\"\n (click)=\"triggerCommand('strikeThrough')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('strikeThrough')\">\n </button>\n <button [id]=\"'subscript-'+id\" aeButton title=\"Subscript\" iconName=\"subscript\"\n (click)=\"triggerCommand('subscript')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('subscript')\">\n </button>\n <button [id]=\"'superscript-'+id\" aeButton iconName=\"superscript\" title=\"Superscript\"\n (click)=\"triggerCommand('superscript')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('superscript')\">\n </button>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'justifyLeft-'+id\" aeButton iconName=\"justifyLeft\" title=\"Justify Left\"\n (click)=\"triggerCommand('justifyLeft')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('justifyLeft')\">\n </button>\n <button [id]=\"'justifyCenter-'+id\" aeButton iconName=\"justifyCenter\" title=\"Justify Center\"\n (click)=\"triggerCommand('justifyCenter')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('justifyCenter')\">\n </button>\n <button [id]=\"'justifyRight-'+id\" aeButton iconName=\"justifyRight\" title=\"Justify Right\"\n (click)=\"triggerCommand('justifyRight')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('justifyRight')\">\n </button>\n <button [id]=\"'justifyFull-'+id\" aeButton iconName=\"justifyFull\" title=\"Justify Full\"\n (click)=\"triggerCommand('justifyFull')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('justifyFull')\">\n </button>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'indent-'+id\" aeButton iconName=\"indent\" title=\"Indent\"\n (click)=\"triggerCommand('indent')\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('indent')\">\n </button>\n <button [id]=\"'outdent-'+id\" aeButton iconName=\"outdent\" title=\"Outdent\"\n (click)=\"triggerCommand('outdent')\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('outdent')\">\n </button>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'insertUnorderedList-'+id\" aeButton iconName=\"unorderedList\" title=\"Unordered List\"\n (click)=\"triggerCommand('insertUnorderedList')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('insertUnorderedList')\">\n </button>\n <button [id]=\"'insertOrderedList-'+id\" aeButton iconName=\"orderedList\" title=\"Ordered List\"\n (click)=\"triggerCommand('insertOrderedList')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('insertOrderedList')\">\n </button>\n </div>\n <div aeToolbarSet>\n <ae-select class=\"select-heading\" [options]=\"headings\"\n [(ngModel)]=\"block\"\n (change)=\"triggerCommand(block)\"\n [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('heading')\"\n tabindex=\"-1\"></ae-select>\n </div>\n <div aeToolbarSet>\n <ae-select class=\"select-font\" [options]=\"fonts\"\n [(ngModel)]=\"fontName\"\n (change)=\"setFontName(fontName)\"\n [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('fontName')\"\n tabindex=\"-1\"></ae-select>\n </div>\n <div aeToolbarSet>\n <ae-select class=\"select-font-size\" [options]=\"fontSizes\"\n [(ngModel)]=\"fontSize\"\n (change)=\"setFontSize(fontSize)\"\n [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('fontSize')\"\n tabindex=\"-1\">\n </ae-select>\n </div>\n <div aeToolbarSet>\n <input\n style=\"display: none\"\n type=\"color\" (change)=\"insertColor(fgInput.value, 'textColor')\"\n #fgInput>\n <button [id]=\"'foregroundColorPicker-'+id\" aeButton iconName=\"textColor\"\n (click)=\"focus(); ; fgInput.click()\"\n title=\"Text Color\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('textColor')\">\n </button>\n <input\n style=\"display: none\"\n type=\"color\" (change)=\"insertColor(bgInput.value, 'backgroundColor')\"\n #bgInput>\n <button [id]=\"'backgroundColorPicker-'+id\" aeButton iconName=\"backgroundColor\"\n (click)=\"focus(); ; bgInput.click()\"\n title=\"Background Color\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('backgroundColor')\">\n </button>\n </div>\n <div *ngIf=\"_customClasses\" aeToolbarSet>\n <ae-select class=\"select-custom-style\" [options]=\"customClassList\"\n [(ngModel)]=\"customClassId\"\n (change)=\"setCustomClass(customClassId)\"\n [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('customClasses')\"\n tabindex=\"-1\"></ae-select>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'link-'+id\" aeButton iconName=\"link\" (click)=\"insertUrl()\"\n title=\"Insert Link\" [disabled]=\"isLinkButtonDisabled\" [hidden]=\"isButtonHidden('link')\">\n </button>\n <button [id]=\"'unlink-'+id\" aeButton iconName=\"unlink\" (click)=\"triggerCommand('unlink')\"\n title=\"Unlink\" [disabled]=\"htmlMode || !linkSelected\" [hidden]=\"isButtonHidden('unlink')\">\n </button>\n <input\n style=\"display: none\"\n accept=\"image/*\"\n type=\"file\" (change)=\"onFileChanged($event)\"\n #fileInput>\n <button [id]=\"'insertImage-'+id\" aeButton iconName=\"image\" (click)=\"focus(); fileInput.click()\"\n title=\"Insert Image\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('insertImage')\">\n </button>\n <button [id]=\"'insertVideo-'+id\" aeButton iconName=\"video\"\n (click)=\"insertVideo()\" title=\"Insert Video\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('insertVideo')\">\n </button>\n <button [id]=\"'insertHorizontalRule-'+id\" aeButton iconName=\"horizontalLine\" title=\"Horizontal Line\"\n (click)=\"triggerCommand('insertHorizontalRule')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('insertHorizontalRule')\">\n </button>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'clearFormatting-'+id\" aeButton iconName=\"removeFormat\" title=\"Clear Formatting\"\n class=\"angular-editor-button\"\n (click)=\"triggerCommand('removeFormat')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('removeFormat')\">\n </button>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'toggleEditorMode-'+id\" aeButton iconName=\"htmlCode\" title=\"HTML Code\"\n (click)=\"triggerCommand('toggleEditorMode')\" [hidden]=\"isButtonHidden('toggleEditorMode')\">\n </button>\n </div>\n <ng-content></ng-content>\n</div>\n", styles: ["a{cursor:pointer}.angular-editor-textarea{min-height:150px;overflow:auto;margin-top:5px;resize:vertical}.angular-editor-textarea:after{content:\"\";position:absolute;bottom:0;right:0;display:block;width:8px;height:8px;cursor:nwse-resize;background-color:#ffffff80}.angular-editor-toolbar{font:100 14px/15px Roboto,Arial,sans-serif;background-color:#f5f5f5;font-size:.8rem;padding:.2rem;border:1px solid #ddd;display:flex;flex-wrap:wrap;gap:4px}.angular-editor-toolbar .angular-editor-toolbar-set{display:flex;gap:1px;width:fit-content;vertical-align:baseline}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button{background-color:#fff;vertical-align:middle;border:1px solid #ddd;padding:.4rem;float:left;width:2rem;height:2rem}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:focus,.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.focus{outline:0}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label{pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label.foreground :after{background:#555555}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label.background{background:#555555}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.active{background:#fff5b9}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.active:hover{background-color:#fffa98}.angular-editor-toolbar .angular-editor-toolbar-set select{font-size:11px;width:90px;vertical-align:middle;background-color:transparent;border:.5px solid rgba(255,255,255,0);border-radius:5px;outline:none;padding:.4rem;cursor:pointer}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-heading optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading option{border:1px solid;background-color:#fff}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .default{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h1{font-size:24px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h2{font-size:20px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h3{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h4{font-size:15px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h5{font-size:14px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h6{font-size:13px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .div,.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .pre{font-size:12px}}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-font{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-font optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font option{border:1px solid;background-color:#fff}}.angular-editor-toolbar .angular-editor-toolbar-set .select-font:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-font:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size{display:inline-block;width:50px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size option{border:1px solid;background-color:#fff}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size1{font-size:10px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size2{font-size:12px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size3{font-size:14px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size4{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size5{font-size:18px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size6{font-size:20px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size7{font-size:22px}}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style option{border:1px solid;background-color:#fff}}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .color-label{position:relative;cursor:pointer}.angular-editor-toolbar .angular-editor-toolbar-set .background{font-size:smaller;background:#1b1b1b;color:#fff;padding:3px}.angular-editor-toolbar .angular-editor-toolbar-set .foreground :after{position:absolute;content:\"\";inset:auto auto -3px -1px;width:15px;height:2px;z-index:0;background:#1b1b1b}\n"], components: [{ type: AeToolbarSetComponent, selector: "ae-toolbar-set, [aeToolbarSet]" }, { type: AeButtonComponent, selector: "ae-button, button[aeButton]", inputs: ["iconName"] }, { type: AeSelectComponent, selector: "ae-select", inputs: ["options", "hidden"], outputs: ["change"] }], directives: [{ type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
858
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AngularEditorToolbarComponent, decorators: [{
859
- type: Component,
860
- args: [{ selector: 'angular-editor-toolbar', template: "<div class=\"angular-editor-toolbar\" *ngIf=\"showToolbar\">\n <div aeToolbarSet>\n <button aeButton title=\"Undo\" iconName=\"undo\" (click)=\"triggerCommand('undo')\" [hidden]=\"isButtonHidden('undo')\">\n </button>\n <button aeButton title=\"Redo\" iconName=\"redo\" (click)=\"triggerCommand('redo')\"\n [hidden]=\"isButtonHidden('redo')\">\n </button>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'bold-'+id\" aeButton title=\"Bold\" iconName=\"bold\" (click)=\"triggerCommand('bold')\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('bold')\">\n </button>\n <button [id]=\"'italic-'+id\" aeButton iconName=\"italic\" title=\"Italic\" (click)=\"triggerCommand('italic')\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('italic')\">\n </button>\n <button [id]=\"'underline-'+id\" aeButton title=\"Underline\" iconName=\"underline\"\n (click)=\"triggerCommand('underline')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('underline')\">\n </button>\n <button [id]=\"'strikeThrough-'+id\" aeButton iconName=\"strikeThrough\" title=\"Strikethrough\"\n (click)=\"triggerCommand('strikeThrough')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('strikeThrough')\">\n </button>\n <button [id]=\"'subscript-'+id\" aeButton title=\"Subscript\" iconName=\"subscript\"\n (click)=\"triggerCommand('subscript')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('subscript')\">\n </button>\n <button [id]=\"'superscript-'+id\" aeButton iconName=\"superscript\" title=\"Superscript\"\n (click)=\"triggerCommand('superscript')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('superscript')\">\n </button>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'justifyLeft-'+id\" aeButton iconName=\"justifyLeft\" title=\"Justify Left\"\n (click)=\"triggerCommand('justifyLeft')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('justifyLeft')\">\n </button>\n <button [id]=\"'justifyCenter-'+id\" aeButton iconName=\"justifyCenter\" title=\"Justify Center\"\n (click)=\"triggerCommand('justifyCenter')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('justifyCenter')\">\n </button>\n <button [id]=\"'justifyRight-'+id\" aeButton iconName=\"justifyRight\" title=\"Justify Right\"\n (click)=\"triggerCommand('justifyRight')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('justifyRight')\">\n </button>\n <button [id]=\"'justifyFull-'+id\" aeButton iconName=\"justifyFull\" title=\"Justify Full\"\n (click)=\"triggerCommand('justifyFull')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('justifyFull')\">\n </button>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'indent-'+id\" aeButton iconName=\"indent\" title=\"Indent\"\n (click)=\"triggerCommand('indent')\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('indent')\">\n </button>\n <button [id]=\"'outdent-'+id\" aeButton iconName=\"outdent\" title=\"Outdent\"\n (click)=\"triggerCommand('outdent')\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('outdent')\">\n </button>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'insertUnorderedList-'+id\" aeButton iconName=\"unorderedList\" title=\"Unordered List\"\n (click)=\"triggerCommand('insertUnorderedList')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('insertUnorderedList')\">\n </button>\n <button [id]=\"'insertOrderedList-'+id\" aeButton iconName=\"orderedList\" title=\"Ordered List\"\n (click)=\"triggerCommand('insertOrderedList')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('insertOrderedList')\">\n </button>\n </div>\n <div aeToolbarSet>\n <ae-select class=\"select-heading\" [options]=\"headings\"\n [(ngModel)]=\"block\"\n (change)=\"triggerCommand(block)\"\n [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('heading')\"\n tabindex=\"-1\"></ae-select>\n </div>\n <div aeToolbarSet>\n <ae-select class=\"select-font\" [options]=\"fonts\"\n [(ngModel)]=\"fontName\"\n (change)=\"setFontName(fontName)\"\n [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('fontName')\"\n tabindex=\"-1\"></ae-select>\n </div>\n <div aeToolbarSet>\n <ae-select class=\"select-font-size\" [options]=\"fontSizes\"\n [(ngModel)]=\"fontSize\"\n (change)=\"setFontSize(fontSize)\"\n [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('fontSize')\"\n tabindex=\"-1\">\n </ae-select>\n </div>\n <div aeToolbarSet>\n <input\n style=\"display: none\"\n type=\"color\" (change)=\"insertColor(fgInput.value, 'textColor')\"\n #fgInput>\n <button [id]=\"'foregroundColorPicker-'+id\" aeButton iconName=\"textColor\"\n (click)=\"focus(); ; fgInput.click()\"\n title=\"Text Color\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('textColor')\">\n </button>\n <input\n style=\"display: none\"\n type=\"color\" (change)=\"insertColor(bgInput.value, 'backgroundColor')\"\n #bgInput>\n <button [id]=\"'backgroundColorPicker-'+id\" aeButton iconName=\"backgroundColor\"\n (click)=\"focus(); ; bgInput.click()\"\n title=\"Background Color\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('backgroundColor')\">\n </button>\n </div>\n <div *ngIf=\"_customClasses\" aeToolbarSet>\n <ae-select class=\"select-custom-style\" [options]=\"customClassList\"\n [(ngModel)]=\"customClassId\"\n (change)=\"setCustomClass(customClassId)\"\n [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('customClasses')\"\n tabindex=\"-1\"></ae-select>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'link-'+id\" aeButton iconName=\"link\" (click)=\"insertUrl()\"\n title=\"Insert Link\" [disabled]=\"isLinkButtonDisabled\" [hidden]=\"isButtonHidden('link')\">\n </button>\n <button [id]=\"'unlink-'+id\" aeButton iconName=\"unlink\" (click)=\"triggerCommand('unlink')\"\n title=\"Unlink\" [disabled]=\"htmlMode || !linkSelected\" [hidden]=\"isButtonHidden('unlink')\">\n </button>\n <input\n style=\"display: none\"\n accept=\"image/*\"\n type=\"file\" (change)=\"onFileChanged($event)\"\n #fileInput>\n <button [id]=\"'insertImage-'+id\" aeButton iconName=\"image\" (click)=\"focus(); fileInput.click()\"\n title=\"Insert Image\"\n [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('insertImage')\">\n </button>\n <button [id]=\"'insertVideo-'+id\" aeButton iconName=\"video\"\n (click)=\"insertVideo()\" title=\"Insert Video\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('insertVideo')\">\n </button>\n <button [id]=\"'insertHorizontalRule-'+id\" aeButton iconName=\"horizontalLine\" title=\"Horizontal Line\"\n (click)=\"triggerCommand('insertHorizontalRule')\" [disabled]=\"htmlMode\"\n [hidden]=\"isButtonHidden('insertHorizontalRule')\">\n </button>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'clearFormatting-'+id\" aeButton iconName=\"removeFormat\" title=\"Clear Formatting\"\n class=\"angular-editor-button\"\n (click)=\"triggerCommand('removeFormat')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('removeFormat')\">\n </button>\n </div>\n <div aeToolbarSet>\n <button [id]=\"'toggleEditorMode-'+id\" aeButton iconName=\"htmlCode\" title=\"HTML Code\"\n (click)=\"triggerCommand('toggleEditorMode')\" [hidden]=\"isButtonHidden('toggleEditorMode')\">\n </button>\n </div>\n <ng-content></ng-content>\n</div>\n", styles: ["a{cursor:pointer}.angular-editor-textarea{min-height:150px;overflow:auto;margin-top:5px;resize:vertical}.angular-editor-textarea:after{content:\"\";position:absolute;bottom:0;right:0;display:block;width:8px;height:8px;cursor:nwse-resize;background-color:#ffffff80}.angular-editor-toolbar{font:100 14px/15px Roboto,Arial,sans-serif;background-color:#f5f5f5;font-size:.8rem;padding:.2rem;border:1px solid #ddd;display:flex;flex-wrap:wrap;gap:4px}.angular-editor-toolbar .angular-editor-toolbar-set{display:flex;gap:1px;width:fit-content;vertical-align:baseline}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button{background-color:#fff;vertical-align:middle;border:1px solid #ddd;padding:.4rem;float:left;width:2rem;height:2rem}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:focus,.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.focus{outline:0}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label{pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label.foreground :after{background:#555555}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label.background{background:#555555}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.active{background:#fff5b9}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.active:hover{background-color:#fffa98}.angular-editor-toolbar .angular-editor-toolbar-set select{font-size:11px;width:90px;vertical-align:middle;background-color:transparent;border:.5px solid rgba(255,255,255,0);border-radius:5px;outline:none;padding:.4rem;cursor:pointer}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-heading optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading option{border:1px solid;background-color:#fff}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .default{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h1{font-size:24px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h2{font-size:20px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h3{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h4{font-size:15px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h5{font-size:14px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h6{font-size:13px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .div,.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .pre{font-size:12px}}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-font{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-font optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font option{border:1px solid;background-color:#fff}}.angular-editor-toolbar .angular-editor-toolbar-set .select-font:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-font:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size{display:inline-block;width:50px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size option{border:1px solid;background-color:#fff}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size1{font-size:10px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size2{font-size:12px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size3{font-size:14px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size4{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size5{font-size:18px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size6{font-size:20px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size7{font-size:22px}}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style option{border:1px solid;background-color:#fff}}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .color-label{position:relative;cursor:pointer}.angular-editor-toolbar .angular-editor-toolbar-set .background{font-size:smaller;background:#1b1b1b;color:#fff;padding:3px}.angular-editor-toolbar .angular-editor-toolbar-set .foreground :after{position:absolute;content:\"\";inset:auto auto -3px -1px;width:15px;height:2px;z-index:0;background:#1b1b1b}\n"] }]
861
- }], ctorParameters: function () {
862
- return [{ type: i0.Renderer2 }, { type: AngularEditorService }, { type: i0.ElementRef }, { type: undefined, decorators: [{
863
- type: Inject,
864
- args: [DOCUMENT]
865
- }] }];
866
- }, propDecorators: { id: [{
867
- type: Input
868
- }], uploadUrl: [{
869
- type: Input
870
- }], upload: [{
871
- type: Input
872
- }], showToolbar: [{
873
- type: Input
874
- }], fonts: [{
875
- type: Input
876
- }], customClasses: [{
877
- type: Input
878
- }], defaultFontName: [{
879
- type: Input
880
- }], defaultFontSize: [{
881
- type: Input
882
- }], hiddenButtons: [{
883
- type: Input
884
- }], execute: [{
885
- type: Output
886
- }], myInputFile: [{
887
- type: ViewChild,
888
- args: ['fileInput', { static: true }]
889
- }] } });
890
-
891
- class AngularEditorComponent {
892
- constructor(r, editorService, doc, sanitizer, cdRef, defaultTabIndex, autoFocus) {
893
- this.r = r;
894
- this.editorService = editorService;
895
- this.doc = doc;
896
- this.sanitizer = sanitizer;
897
- this.cdRef = cdRef;
898
- this.autoFocus = autoFocus;
899
- this.modeVisual = true;
900
- this.showPlaceholder = false;
901
- this.disabled = false;
902
- this.focused = false;
903
- this.touched = false;
904
- this.changed = false;
905
- this.id = '';
906
- this.config = angularEditorConfig;
907
- this.placeholder = '';
908
- this.executeCommandFn = this.executeCommand.bind(this);
909
- this.viewMode = new EventEmitter();
910
- /** emits `blur` event when focused out from the textarea */
911
- // eslint-disable-next-line @angular-eslint/no-output-native, @angular-eslint/no-output-rename
912
- this.blurEvent = new EventEmitter();
913
- /** emits `focus` event when focused in to the textarea */
914
- // eslint-disable-next-line @angular-eslint/no-output-rename, @angular-eslint/no-output-native
915
- this.focusEvent = new EventEmitter();
916
- this.tabindex = -1;
917
- const parsedTabIndex = Number(defaultTabIndex);
918
- this.tabIndex = (parsedTabIndex || parsedTabIndex === 0) ? parsedTabIndex : null;
919
- }
920
- onFocus() {
921
- this.focus();
922
- }
923
- ngOnInit() {
924
- this.config.toolbarPosition = this.config.toolbarPosition ? this.config.toolbarPosition : angularEditorConfig.toolbarPosition;
925
- }
926
- ngAfterViewInit() {
927
- if (isDefined(this.autoFocus)) {
928
- this.focus();
929
- }
930
- }
931
- onPaste(event) {
932
- if (this.config.rawPaste) {
933
- event.preventDefault();
934
- const text = event.clipboardData.getData('text/plain');
935
- document.execCommand('insertHTML', false, text);
936
- return text;
937
- }
938
- }
939
- /**
940
- * Executed command from editor header buttons
941
- * @param command string from triggerCommand
942
- * @param value
943
- */
944
- executeCommand(command, value) {
945
- this.focus();
946
- if (command === 'focus') {
947
- return;
948
- }
949
- if (command === 'toggleEditorMode') {
950
- this.toggleEditorMode(this.modeVisual);
951
- }
952
- else if (command !== '') {
953
- if (command === 'clear') {
954
- this.editorService.removeSelectedElements(this.getCustomTags());
955
- this.onContentChange(this.textArea.nativeElement);
956
- }
957
- else if (command === 'default') {
958
- this.editorService.removeSelectedElements('h1,h2,h3,h4,h5,h6,p,pre');
959
- this.onContentChange(this.textArea.nativeElement);
960
- }
961
- else {
962
- this.editorService.executeCommand(command, value);
963
- }
964
- this.exec();
965
- }
966
- }
967
- /**
968
- * focus event
969
- */
970
- onTextAreaFocus(event) {
971
- if (this.focused) {
972
- event.stopPropagation();
973
- return;
974
- }
975
- this.focused = true;
976
- this.focusEvent.emit(event);
977
- if (!this.touched || !this.changed) {
978
- this.editorService.executeInNextQueueIteration(() => {
979
- this.configure();
980
- this.touched = true;
981
- });
982
- }
983
- }
984
- /**
985
- * @description fires when cursor leaves textarea
986
- */
987
- onTextAreaMouseOut(event) {
988
- this.editorService.saveSelection();
989
- }
990
- /**
991
- * blur event
992
- */
993
- onTextAreaBlur(event) {
994
- /**
995
- * save selection if focussed out
996
- */
997
- this.editorService.executeInNextQueueIteration(this.editorService.saveSelection);
998
- if (typeof this.onTouched === 'function') {
999
- this.onTouched();
1000
- }
1001
- if (event.relatedTarget !== null) {
1002
- const parent = event.relatedTarget.parentElement;
1003
- if (!parent.classList.contains('angular-editor-toolbar-set') && !parent.classList.contains('ae-picker')) {
1004
- this.blurEvent.emit(event);
1005
- this.focused = false;
1006
- }
1007
- }
1008
- }
1009
- /**
1010
- * focus the text area when the editor is focused
1011
- */
1012
- focus() {
1013
- if (this.modeVisual) {
1014
- this.textArea.nativeElement.focus();
1015
- }
1016
- else {
1017
- const sourceText = this.doc.getElementById('sourceText' + this.id);
1018
- sourceText.focus();
1019
- this.focused = true;
1020
- }
1021
- }
1022
- /**
1023
- * Executed from the contenteditable section while the input property changes
1024
- * @param element html element from contenteditable
1025
- */
1026
- onContentChange(element) {
1027
- let html = '';
1028
- if (this.modeVisual) {
1029
- html = element.innerHTML;
1030
- }
1031
- else {
1032
- html = element.innerText;
1033
- }
1034
- if ((!html || html === '<br>')) {
1035
- html = '';
1036
- }
1037
- if (typeof this.onChange === 'function') {
1038
- this.onChange(this.config.sanitize || this.config.sanitize === undefined ?
1039
- this.sanitizer.sanitize(SecurityContext.HTML, html) : html);
1040
- if ((!html) !== this.showPlaceholder) {
1041
- this.togglePlaceholder(this.showPlaceholder);
1042
- }
1043
- }
1044
- this.changed = true;
1045
- }
1046
- /**
1047
- * Set the function to be called
1048
- * when the control receives a change event.
1049
- *
1050
- * @param fn a function
1051
- */
1052
- registerOnChange(fn) {
1053
- this.onChange = e => (e === '<br>' ? fn('') : fn(e));
1054
- }
1055
- /**
1056
- * Set the function to be called
1057
- * when the control receives a touch event.
1058
- *
1059
- * @param fn a function
1060
- */
1061
- registerOnTouched(fn) {
1062
- this.onTouched = fn;
1063
- }
1064
- /**
1065
- * Write a new value to the element.
1066
- *
1067
- * @param value value to be executed when there is a change in contenteditable
1068
- */
1069
- writeValue(value) {
1070
- if ((!value || value === '<br>' || value === '') !== this.showPlaceholder) {
1071
- this.togglePlaceholder(this.showPlaceholder);
1072
- }
1073
- if (value === undefined || value === '' || value === '<br>') {
1074
- value = null;
1075
- }
1076
- this.refreshView(value);
1077
- }
1078
- /**
1079
- * refresh view/HTML of the editor
1080
- *
1081
- * @param value html string from the editor
1082
- */
1083
- refreshView(value) {
1084
- const normalizedValue = value === null ? '' : value;
1085
- this.r.setProperty(this.textArea.nativeElement, 'innerHTML', normalizedValue);
1086
- return;
1087
- }
1088
- /**
1089
- * toggles placeholder based on input string
1090
- *
1091
- * @param value A HTML string from the editor
1092
- */
1093
- togglePlaceholder(value) {
1094
- if (!value) {
1095
- this.r.addClass(this.editorWrapper.nativeElement, 'show-placeholder');
1096
- this.showPlaceholder = true;
1097
- }
1098
- else {
1099
- this.r.removeClass(this.editorWrapper.nativeElement, 'show-placeholder');
1100
- this.showPlaceholder = false;
1101
- }
1102
- }
1103
- /**
1104
- * Implements disabled state for this element
1105
- *
1106
- * @param isDisabled Disabled flag
1107
- */
1108
- setDisabledState(isDisabled) {
1109
- const div = this.textArea.nativeElement;
1110
- const action = isDisabled ? 'addClass' : 'removeClass';
1111
- this.r[action](div, 'disabled');
1112
- this.disabled = isDisabled;
1113
- }
1114
- /**
1115
- * toggles editor mode based on bToSource bool
1116
- *
1117
- * @param bToSource A boolean value from the editor
1118
- */
1119
- toggleEditorMode(bToSource) {
1120
- let oContent;
1121
- const editableElement = this.textArea.nativeElement;
1122
- if (bToSource) {
1123
- oContent = this.r.createText(editableElement.innerHTML);
1124
- this.r.setProperty(editableElement, 'innerHTML', '');
1125
- this.r.setProperty(editableElement, 'contentEditable', false);
1126
- const oPre = this.r.createElement('pre');
1127
- this.r.setStyle(oPre, 'margin', '0');
1128
- this.r.setStyle(oPre, 'outline', 'none');
1129
- const oCode = this.r.createElement('code');
1130
- this.r.setProperty(oCode, 'id', 'sourceText' + this.id);
1131
- this.r.setStyle(oCode, 'display', 'block');
1132
- this.r.setStyle(oCode, 'white-space', 'pre-wrap');
1133
- this.r.setStyle(oCode, 'word-break', 'keep-all');
1134
- this.r.setStyle(oCode, 'outline', 'none');
1135
- this.r.setStyle(oCode, 'margin', '0');
1136
- this.r.setStyle(oCode, 'background-color', '#fff5b9');
1137
- this.r.setProperty(oCode, 'contentEditable', true);
1138
- this.r.appendChild(oCode, oContent);
1139
- this.focusInstance = this.r.listen(oCode, 'focus', (event) => this.onTextAreaFocus(event));
1140
- this.blurInstance = this.r.listen(oCode, 'blur', (event) => this.onTextAreaBlur(event));
1141
- this.r.appendChild(oPre, oCode);
1142
- this.r.appendChild(editableElement, oPre);
1143
- // ToDo move to service
1144
- this.doc.execCommand('defaultParagraphSeparator', false, 'div');
1145
- this.modeVisual = false;
1146
- this.viewMode.emit(false);
1147
- oCode.focus();
1148
- }
1149
- else {
1150
- if (this.doc.querySelectorAll) {
1151
- this.r.setProperty(editableElement, 'innerHTML', editableElement.innerText);
1152
- }
1153
- else {
1154
- oContent = this.doc.createRange();
1155
- oContent.selectNodeContents(editableElement.firstChild);
1156
- this.r.setProperty(editableElement, 'innerHTML', oContent.toString());
1157
- }
1158
- this.r.setProperty(editableElement, 'contentEditable', true);
1159
- this.modeVisual = true;
1160
- this.viewMode.emit(true);
1161
- this.onContentChange(editableElement);
1162
- editableElement.focus();
1163
- }
1164
- this.editorToolbar.setEditorMode(!this.modeVisual);
1165
- }
1166
- /**
1167
- * toggles editor buttons when cursor moved or positioning
1168
- *
1169
- * Send a node array from the contentEditable of the editor
1170
- */
1171
- exec() {
1172
- this.editorToolbar.triggerButtons();
1173
- let userSelection;
1174
- if (this.doc.getSelection) {
1175
- userSelection = this.doc.getSelection();
1176
- this.editorService.executeInNextQueueIteration(this.editorService.saveSelection);
1177
- }
1178
- let a = userSelection.focusNode;
1179
- const els = [];
1180
- while (a && a.id !== 'editor') {
1181
- els.unshift(a);
1182
- a = a.parentNode;
1183
- }
1184
- this.editorToolbar.triggerBlocks(els);
1185
- }
1186
- configure() {
1187
- this.editorService.uploadUrl = this.config.uploadUrl;
1188
- this.editorService.uploadWithCredentials = this.config.uploadWithCredentials;
1189
- if (this.config.defaultParagraphSeparator) {
1190
- this.editorService.setDefaultParagraphSeparator(this.config.defaultParagraphSeparator);
1191
- }
1192
- if (this.config.defaultFontName) {
1193
- this.editorService.setFontName(this.config.defaultFontName);
1194
- }
1195
- if (this.config.defaultFontSize) {
1196
- this.editorService.setFontSize(this.config.defaultFontSize);
1197
- }
1198
- }
1199
- getFonts() {
1200
- const fonts = this.config.fonts ? this.config.fonts : angularEditorConfig.fonts;
1201
- return fonts.map(x => {
1202
- return { label: x.name, value: x.name };
1203
- });
1204
- }
1205
- getCustomTags() {
1206
- const tags = ['span'];
1207
- this.config.customClasses.forEach(x => {
1208
- if (x.tag !== undefined) {
1209
- if (!tags.includes(x.tag)) {
1210
- tags.push(x.tag);
1211
- }
1212
- }
1213
- });
1214
- return tags.join(',');
1215
- }
1216
- ngOnDestroy() {
1217
- if (this.blurInstance) {
1218
- this.blurInstance();
1219
- }
1220
- if (this.focusInstance) {
1221
- this.focusInstance();
1222
- }
1223
- }
1224
- filterStyles(html) {
1225
- html = html.replace('position: fixed;', '');
1226
- return html;
1227
- }
1228
- }
1229
- AngularEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AngularEditorComponent, deps: [{ token: i0.Renderer2 }, { token: AngularEditorService }, { token: DOCUMENT }, { token: i2.DomSanitizer }, { token: i0.ChangeDetectorRef }, { token: 'tabindex', attribute: true }, { token: 'autofocus', attribute: true }], target: i0.ɵɵFactoryTarget.Component });
1230
- AngularEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: AngularEditorComponent, selector: "angular-editor", inputs: { id: "id", config: "config", placeholder: "placeholder", tabIndex: "tabIndex" }, outputs: { html: "html", viewMode: "viewMode", blurEvent: "blur", focusEvent: "focus" }, host: { listeners: { "focus": "onFocus()" }, properties: { "attr.tabindex": "this.tabindex" } }, providers: [
1231
- {
1232
- provide: NG_VALUE_ACCESSOR,
1233
- useExisting: forwardRef(() => AngularEditorComponent),
1234
- multi: true
1235
- },
1236
- AngularEditorService
1237
- ], queries: [{ propertyName: "customButtonsTemplateRef", first: true, predicate: ["customButtons"], descendants: true }], viewQueries: [{ propertyName: "textArea", first: true, predicate: ["editor"], descendants: true, static: true }, { propertyName: "editorWrapper", first: true, predicate: ["editorWrapper"], descendants: true, static: true }, { propertyName: "editorToolbar", first: true, predicate: ["editorToolbar"], descendants: true }], ngImport: i0, template: "<div\n class=\"angular-editor\"\n #angularEditor\n [style.width]=\"config.width\"\n [style.minWidth]=\"config.minWidth\"\n>\n <angular-editor-toolbar\n *ngIf=\"config.toolbarPosition === 'top'\"\n #editorToolbar\n [id]=\"id\"\n [uploadUrl]=\"config.uploadUrl\"\n [upload]=\"config.upload\"\n [showToolbar]=\"config.showToolbar !== undefined ? config.showToolbar : true\"\n [fonts]=\"getFonts()\"\n [customClasses]=\"config.customClasses\"\n [defaultFontName]=\"config.defaultFontName\"\n [defaultFontSize]=\"config.defaultFontSize\"\n [hiddenButtons]=\"config.toolbarHiddenButtons\"\n (execute)=\"executeCommand($event)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"customButtonsTemplateRef\"\n [ngTemplateOutletContext]=\"{ executeCommandFn: this.executeCommandFn}\"\n >\n </ng-container>\n </angular-editor-toolbar>\n\n <div\n class=\"angular-editor-wrapper\"\n #editorWrapper\n >\n <div\n #editor\n class=\"angular-editor-textarea\"\n [attr.contenteditable]=\"config.editable\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [attr.translate]=\"config.translate\"\n [attr.spellcheck]=\"config.spellcheck\"\n [style.height]=\"config.height\"\n [style.minHeight]=\"config.minHeight\"\n [style.maxHeight]=\"config.maxHeight\"\n [style.outline]=\"config.outline === false ? 'none': undefined\"\n (input)=\"onContentChange($event.target)\"\n (focus)=\"onTextAreaFocus($event)\"\n (blur)=\"onTextAreaBlur($event)\"\n (click)=\"exec()\"\n (keyup)=\"exec()\"\n (mouseout)=\"onTextAreaMouseOut($event)\"\n (paste)=\"onPaste($event)\"\n >\n </div>\n <span class=\"angular-editor-placeholder\">{{ placeholder || config['placeholder'] }}</span>\n </div>\n <angular-editor-toolbar\n *ngIf=\"config.toolbarPosition === 'bottom'\"\n #editorToolbar\n [id]=\"id\"\n [uploadUrl]=\"config.uploadUrl\"\n [upload]=\"config.upload\"\n [showToolbar]=\"config.showToolbar !== undefined ? config.showToolbar : true\"\n [fonts]=\"getFonts()\"\n [customClasses]=\"config.customClasses\"\n [defaultFontName]=\"config.defaultFontName\"\n [defaultFontSize]=\"config.defaultFontSize\"\n [hiddenButtons]=\"config.toolbarHiddenButtons\"\n (execute)=\"executeCommand($event)\"\n ></angular-editor-toolbar>\n</div>\n", styles: ["a{cursor:pointer}.angular-editor-textarea{min-height:150px;overflow:auto;margin-top:5px;resize:vertical}.angular-editor-textarea:after{content:\"\";position:absolute;bottom:0;right:0;display:block;width:8px;height:8px;cursor:nwse-resize;background-color:#ffffff80}.angular-editor-toolbar{font:100 14px/15px Roboto,Arial,sans-serif;background-color:#f5f5f5;font-size:.8rem;padding:.2rem;border:1px solid #ddd;display:flex;flex-wrap:wrap;gap:4px}.angular-editor-toolbar .angular-editor-toolbar-set{display:flex;gap:1px;width:fit-content;vertical-align:baseline}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button{background-color:#fff;vertical-align:middle;border:1px solid #ddd;padding:.4rem;float:left;width:2rem;height:2rem}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:focus,.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.focus{outline:0}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label{pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label.foreground :after{background:#555555}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label.background{background:#555555}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.active{background:#fff5b9}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.active:hover{background-color:#fffa98}.angular-editor-toolbar .angular-editor-toolbar-set select{font-size:11px;width:90px;vertical-align:middle;background-color:transparent;border:.5px solid rgba(255,255,255,0);border-radius:5px;outline:none;padding:.4rem;cursor:pointer}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-heading optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading option{border:1px solid;background-color:#fff}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .default{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h1{font-size:24px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h2{font-size:20px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h3{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h4{font-size:15px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h5{font-size:14px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h6{font-size:13px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .div,.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .pre{font-size:12px}}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-font{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-font optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font option{border:1px solid;background-color:#fff}}.angular-editor-toolbar .angular-editor-toolbar-set .select-font:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-font:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size{display:inline-block;width:50px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size option{border:1px solid;background-color:#fff}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size1{font-size:10px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size2{font-size:12px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size3{font-size:14px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size4{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size5{font-size:18px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size6{font-size:20px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size7{font-size:22px}}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style option{border:1px solid;background-color:#fff}}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .color-label{position:relative;cursor:pointer}.angular-editor-toolbar .angular-editor-toolbar-set .background{font-size:smaller;background:#1b1b1b;color:#fff;padding:3px}.angular-editor-toolbar .angular-editor-toolbar-set .foreground :after{position:absolute;content:\"\";inset:auto auto -3px -1px;width:15px;height:2px;z-index:0;background:#1b1b1b}.angular-editor{display:flex;flex-direction:column}.angular-editor ::ng-deep [contenteditable=true]:empty:before{content:attr(placeholder);color:#868e96;opacity:1}.angular-editor .angular-editor-wrapper{position:relative}.angular-editor .angular-editor-wrapper .angular-editor-textarea{min-height:5rem;padding:.5rem .8rem 1rem;border:1px solid #ddd;background-color:transparent;overflow-x:hidden;overflow-y:auto;position:relative}.angular-editor .angular-editor-wrapper .angular-editor-textarea ::ng-deep blockquote{margin-left:1rem;border-left:.2em solid #dfe2e5;padding-left:.5rem}.angular-editor .angular-editor-wrapper ::ng-deep p{margin-bottom:0}.angular-editor .angular-editor-wrapper .angular-editor-placeholder{display:none;position:absolute;top:0;padding:.9rem .8rem 1rem .9rem;color:#6c757d;opacity:.75}.angular-editor .angular-editor-wrapper.show-placeholder .angular-editor-placeholder{display:block}.angular-editor .angular-editor-wrapper.disabled{cursor:not-allowed;opacity:.5;pointer-events:none}\n"], components: [{ type: AngularEditorToolbarComponent, selector: "angular-editor-toolbar", inputs: ["id", "uploadUrl", "upload", "showToolbar", "fonts", "customClasses", "defaultFontName", "defaultFontSize", "hiddenButtons"], outputs: ["execute"] }], directives: [{ type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
1238
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AngularEditorComponent, decorators: [{
1239
- type: Component,
1240
- args: [{ selector: 'angular-editor', providers: [
1241
- {
1242
- provide: NG_VALUE_ACCESSOR,
1243
- useExisting: forwardRef(() => AngularEditorComponent),
1244
- multi: true
1245
- },
1246
- AngularEditorService
1247
- ], template: "<div\n class=\"angular-editor\"\n #angularEditor\n [style.width]=\"config.width\"\n [style.minWidth]=\"config.minWidth\"\n>\n <angular-editor-toolbar\n *ngIf=\"config.toolbarPosition === 'top'\"\n #editorToolbar\n [id]=\"id\"\n [uploadUrl]=\"config.uploadUrl\"\n [upload]=\"config.upload\"\n [showToolbar]=\"config.showToolbar !== undefined ? config.showToolbar : true\"\n [fonts]=\"getFonts()\"\n [customClasses]=\"config.customClasses\"\n [defaultFontName]=\"config.defaultFontName\"\n [defaultFontSize]=\"config.defaultFontSize\"\n [hiddenButtons]=\"config.toolbarHiddenButtons\"\n (execute)=\"executeCommand($event)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"customButtonsTemplateRef\"\n [ngTemplateOutletContext]=\"{ executeCommandFn: this.executeCommandFn}\"\n >\n </ng-container>\n </angular-editor-toolbar>\n\n <div\n class=\"angular-editor-wrapper\"\n #editorWrapper\n >\n <div\n #editor\n class=\"angular-editor-textarea\"\n [attr.contenteditable]=\"config.editable\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [attr.translate]=\"config.translate\"\n [attr.spellcheck]=\"config.spellcheck\"\n [style.height]=\"config.height\"\n [style.minHeight]=\"config.minHeight\"\n [style.maxHeight]=\"config.maxHeight\"\n [style.outline]=\"config.outline === false ? 'none': undefined\"\n (input)=\"onContentChange($event.target)\"\n (focus)=\"onTextAreaFocus($event)\"\n (blur)=\"onTextAreaBlur($event)\"\n (click)=\"exec()\"\n (keyup)=\"exec()\"\n (mouseout)=\"onTextAreaMouseOut($event)\"\n (paste)=\"onPaste($event)\"\n >\n </div>\n <span class=\"angular-editor-placeholder\">{{ placeholder || config['placeholder'] }}</span>\n </div>\n <angular-editor-toolbar\n *ngIf=\"config.toolbarPosition === 'bottom'\"\n #editorToolbar\n [id]=\"id\"\n [uploadUrl]=\"config.uploadUrl\"\n [upload]=\"config.upload\"\n [showToolbar]=\"config.showToolbar !== undefined ? config.showToolbar : true\"\n [fonts]=\"getFonts()\"\n [customClasses]=\"config.customClasses\"\n [defaultFontName]=\"config.defaultFontName\"\n [defaultFontSize]=\"config.defaultFontSize\"\n [hiddenButtons]=\"config.toolbarHiddenButtons\"\n (execute)=\"executeCommand($event)\"\n ></angular-editor-toolbar>\n</div>\n", styles: ["a{cursor:pointer}.angular-editor-textarea{min-height:150px;overflow:auto;margin-top:5px;resize:vertical}.angular-editor-textarea:after{content:\"\";position:absolute;bottom:0;right:0;display:block;width:8px;height:8px;cursor:nwse-resize;background-color:#ffffff80}.angular-editor-toolbar{font:100 14px/15px Roboto,Arial,sans-serif;background-color:#f5f5f5;font-size:.8rem;padding:.2rem;border:1px solid #ddd;display:flex;flex-wrap:wrap;gap:4px}.angular-editor-toolbar .angular-editor-toolbar-set{display:flex;gap:1px;width:fit-content;vertical-align:baseline}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button{background-color:#fff;vertical-align:middle;border:1px solid #ddd;padding:.4rem;float:left;width:2rem;height:2rem}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:focus,.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.focus{outline:0}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label{pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label.foreground :after{background:#555555}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button:disabled>.color-label.background{background:#555555}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.active{background:#fff5b9}.angular-editor-toolbar .angular-editor-toolbar-set .angular-editor-button.active:hover{background-color:#fffa98}.angular-editor-toolbar .angular-editor-toolbar-set select{font-size:11px;width:90px;vertical-align:middle;background-color:transparent;border:.5px solid rgba(255,255,255,0);border-radius:5px;outline:none;padding:.4rem;cursor:pointer}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-heading optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading option{border:1px solid;background-color:#fff}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .default{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h1{font-size:24px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h2{font-size:20px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h3{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h4{font-size:15px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h5{font-size:14px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .h6{font-size:13px}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .div,.angular-editor-toolbar .angular-editor-toolbar-set .select-heading .pre{font-size:12px}}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-heading:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-font{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-font optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font option{border:1px solid;background-color:#fff}}.angular-editor-toolbar .angular-editor-toolbar-set .select-font:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-font:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size{display:inline-block;width:50px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size option{border:1px solid;background-color:#fff}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size1{font-size:10px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size2{font-size:12px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size3{font-size:14px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size4{font-size:16px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size5{font-size:18px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size6{font-size:20px}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size .size7{font-size:22px}}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-font-size:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style{display:inline-block;width:90px}@supports not (-moz-appearance: none){.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style optgroup{font-size:12px;background-color:#f4f4f4;padding:5px}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style option{border:1px solid;background-color:#fff}}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.angular-editor-toolbar .angular-editor-toolbar-set .select-custom-style:hover{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}.angular-editor-toolbar .angular-editor-toolbar-set .color-label{position:relative;cursor:pointer}.angular-editor-toolbar .angular-editor-toolbar-set .background{font-size:smaller;background:#1b1b1b;color:#fff;padding:3px}.angular-editor-toolbar .angular-editor-toolbar-set .foreground :after{position:absolute;content:\"\";inset:auto auto -3px -1px;width:15px;height:2px;z-index:0;background:#1b1b1b}.angular-editor{display:flex;flex-direction:column}.angular-editor ::ng-deep [contenteditable=true]:empty:before{content:attr(placeholder);color:#868e96;opacity:1}.angular-editor .angular-editor-wrapper{position:relative}.angular-editor .angular-editor-wrapper .angular-editor-textarea{min-height:5rem;padding:.5rem .8rem 1rem;border:1px solid #ddd;background-color:transparent;overflow-x:hidden;overflow-y:auto;position:relative}.angular-editor .angular-editor-wrapper .angular-editor-textarea ::ng-deep blockquote{margin-left:1rem;border-left:.2em solid #dfe2e5;padding-left:.5rem}.angular-editor .angular-editor-wrapper ::ng-deep p{margin-bottom:0}.angular-editor .angular-editor-wrapper .angular-editor-placeholder{display:none;position:absolute;top:0;padding:.9rem .8rem 1rem .9rem;color:#6c757d;opacity:.75}.angular-editor .angular-editor-wrapper.show-placeholder .angular-editor-placeholder{display:block}.angular-editor .angular-editor-wrapper.disabled{cursor:not-allowed;opacity:.5;pointer-events:none}\n"] }]
1248
- }], ctorParameters: function () {
1249
- return [{ type: i0.Renderer2 }, { type: AngularEditorService }, { type: undefined, decorators: [{
1250
- type: Inject,
1251
- args: [DOCUMENT]
1252
- }] }, { type: i2.DomSanitizer }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
1253
- type: Attribute,
1254
- args: ['tabindex']
1255
- }] }, { type: undefined, decorators: [{
1256
- type: Attribute,
1257
- args: ['autofocus']
1258
- }] }];
1259
- }, propDecorators: { id: [{
1260
- type: Input
1261
- }], config: [{
1262
- type: Input
1263
- }], placeholder: [{
1264
- type: Input
1265
- }], tabIndex: [{
1266
- type: Input
1267
- }], html: [{
1268
- type: Output
1269
- }], textArea: [{
1270
- type: ViewChild,
1271
- args: ['editor', { static: true }]
1272
- }], editorWrapper: [{
1273
- type: ViewChild,
1274
- args: ['editorWrapper', { static: true }]
1275
- }], editorToolbar: [{
1276
- type: ViewChild,
1277
- args: ['editorToolbar']
1278
- }], customButtonsTemplateRef: [{
1279
- type: ContentChild,
1280
- args: ["customButtons"]
1281
- }], viewMode: [{
1282
- type: Output
1283
- }], blurEvent: [{
1284
- type: Output,
1285
- args: ['blur']
1286
- }], focusEvent: [{
1287
- type: Output,
1288
- args: ['focus']
1289
- }], tabindex: [{
1290
- type: HostBinding,
1291
- args: ['attr.tabindex']
1292
- }], onFocus: [{
1293
- type: HostListener,
1294
- args: ['focus']
1295
- }] } });
1296
-
1297
- class AngularEditorModule {
1298
- }
1299
- AngularEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AngularEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1300
- AngularEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AngularEditorModule, declarations: [AngularEditorComponent, AngularEditorToolbarComponent, AeSelectComponent, AeButtonComponent, AeToolbarSetComponent], imports: [CommonModule, FormsModule, ReactiveFormsModule], exports: [AngularEditorComponent, AngularEditorToolbarComponent, AeButtonComponent, AeToolbarSetComponent] });
1301
- AngularEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AngularEditorModule, imports: [[
1302
- CommonModule, FormsModule, ReactiveFormsModule
1303
- ]] });
1304
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AngularEditorModule, decorators: [{
1305
- type: NgModule,
1306
- args: [{
1307
- imports: [
1308
- CommonModule, FormsModule, ReactiveFormsModule
1309
- ],
1310
- declarations: [AngularEditorComponent, AngularEditorToolbarComponent, AeSelectComponent, AeButtonComponent, AeToolbarSetComponent],
1311
- exports: [AngularEditorComponent, AngularEditorToolbarComponent, AeButtonComponent, AeToolbarSetComponent]
1312
- }]
1313
- }] });
1314
-
1315
- /*
1316
- * Public API Surface of angular-editor
1317
- */
1318
-
1319
- /**
1320
- * Generated bundle index. Do not edit.
1321
- */
1322
-
1323
- export { AeButtonComponent, AeSelectComponent, AeToolbarSetComponent, AngularEditorComponent, AngularEditorModule, AngularEditorService, AngularEditorToolbarComponent };
1324
- //# sourceMappingURL=kolkov-angular-editor.mjs.map