el-header-and-footer 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/el-header-and-footer.d.ts +5 -0
- package/esm2020/el-header-and-footer.mjs +5 -0
- package/esm2020/lib/el-header-and-footer.component.mjs +1046 -0
- package/esm2020/lib/el-header-and-footer.module.mjs +49 -0
- package/esm2020/lib/el-header-and-footer.service.mjs +14 -0
- package/esm2020/public-api.mjs +7 -0
- package/fesm2015/el-header-and-footer.mjs +1116 -0
- package/fesm2015/el-header-and-footer.mjs.map +1 -0
- package/fesm2020/el-header-and-footer.mjs +1113 -0
- package/fesm2020/el-header-and-footer.mjs.map +1 -0
- package/lib/el-header-and-footer.component.d.ts +142 -0
- package/lib/el-header-and-footer.module.d.ts +13 -0
- package/lib/el-header-and-footer.service.d.ts +6 -0
- package/package.json +31 -0
- package/public-api.d.ts +3 -0
@@ -0,0 +1,1113 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { Injectable, EventEmitter, forwardRef, Component, ViewChild, Input, Output, NgModule } from '@angular/core';
|
3
|
+
import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
4
|
+
import * as i4 from '@ng-bootstrap/ng-bootstrap';
|
5
|
+
import { NgbDropdown, NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
|
6
|
+
import * as i1 from '@angular/router';
|
7
|
+
import * as i2 from '@angular/platform-browser';
|
8
|
+
import * as i3 from 'ngx-color/sketch';
|
9
|
+
import { ColorSketchModule } from 'ngx-color/sketch';
|
10
|
+
import * as i5 from '@angular/common';
|
11
|
+
import { CommonModule } from '@angular/common';
|
12
|
+
import { ColorPickerModule } from 'ngx-color-picker';
|
13
|
+
import { NgxColorsModule } from 'ngx-colors';
|
14
|
+
|
15
|
+
class ElHeaderAndFooterService {
|
16
|
+
constructor() { }
|
17
|
+
}
|
18
|
+
ElHeaderAndFooterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ElHeaderAndFooterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
19
|
+
ElHeaderAndFooterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ElHeaderAndFooterService, providedIn: 'root' });
|
20
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ElHeaderAndFooterService, decorators: [{
|
21
|
+
type: Injectable,
|
22
|
+
args: [{
|
23
|
+
providedIn: 'root'
|
24
|
+
}]
|
25
|
+
}], ctorParameters: function () { return []; } });
|
26
|
+
|
27
|
+
class ElHeaderAndFooterComponent {
|
28
|
+
constructor(router, route, renderer, sanitizer) {
|
29
|
+
this.router = router;
|
30
|
+
this.route = route;
|
31
|
+
this.renderer = renderer;
|
32
|
+
this.sanitizer = sanitizer;
|
33
|
+
this.editorId = '';
|
34
|
+
this.editorText = '';
|
35
|
+
this.editorFrom = '';
|
36
|
+
this.clear = false;
|
37
|
+
this.toolbarMode = 'fixed';
|
38
|
+
this.editorTextChange = new EventEmitter();
|
39
|
+
this.editorActionResponse = new EventEmitter();
|
40
|
+
this.value = '';
|
41
|
+
this.editorTextClear = new EventEmitter();
|
42
|
+
this.showToolbar = false;
|
43
|
+
this.toolbarTop = 0;
|
44
|
+
this.toolbarLeft = 0;
|
45
|
+
this.fonts = ['Arial', 'Courier New', 'Georgia', 'Times New Roman', 'Verdana'];
|
46
|
+
this.fontSizes = [10, 12, 14, 16, 18, 20, 24, 28, 32, 36];
|
47
|
+
this.selectedFont = 'Arial';
|
48
|
+
this.selectedFontSize = 14;
|
49
|
+
this.isTableSelected = false;
|
50
|
+
this.tableAdded = false;
|
51
|
+
this.selectedTable = null;
|
52
|
+
this.isPlaceholderVisible = true;
|
53
|
+
this.selectedCell = null;
|
54
|
+
this.isBoldActive = false;
|
55
|
+
this.isItalicActive = false;
|
56
|
+
this.isUnderlineActive = false;
|
57
|
+
this.isStrikethroughActive = false;
|
58
|
+
this.isSubscriptActive = false;
|
59
|
+
this.isSuperscriptActive = false;
|
60
|
+
this.selectedFormatBlock = 'normal';
|
61
|
+
this.undoStack = [];
|
62
|
+
this.redoStack = [];
|
63
|
+
this.history = [];
|
64
|
+
this.historyIndex = -1;
|
65
|
+
this.selectedImage = null;
|
66
|
+
this.imageEditUrl = '';
|
67
|
+
this.imagePositionX = 0;
|
68
|
+
this.imagePositionY = 0;
|
69
|
+
this.imageResizeStartX = 0;
|
70
|
+
this.imageResizeStartY = 0;
|
71
|
+
this.imageResizeStartWidth = 0;
|
72
|
+
this.imageResizeStartHeight = 0;
|
73
|
+
this.imageResizeDirection = null;
|
74
|
+
this.onChange = () => { };
|
75
|
+
this.onTouched = () => { };
|
76
|
+
this.color = '#ddd';
|
77
|
+
this.selectedItemIndex = null;
|
78
|
+
this.parsedTable = null;
|
79
|
+
this.isFullScreen = false;
|
80
|
+
this.today = '';
|
81
|
+
this.CanvasColor = '#fff';
|
82
|
+
}
|
83
|
+
ngOnChanges(changes) {
|
84
|
+
if (changes['bgColor']) {
|
85
|
+
const event = { color: { hex: this.bgColor } };
|
86
|
+
this.setCanvasBackgroundColor(event, this.editorId);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
ngAfterViewInit() {
|
90
|
+
this.initEditor();
|
91
|
+
this.checkPlaceholder();
|
92
|
+
this.setupHistory();
|
93
|
+
}
|
94
|
+
ngOnInit() {
|
95
|
+
this.init_Func(this.editorText);
|
96
|
+
document.addEventListener('selectionchange', () => {
|
97
|
+
this.checkActiveStates();
|
98
|
+
this.checkFormatBlock(this.editorId);
|
99
|
+
});
|
100
|
+
this.addClickListenerToImages();
|
101
|
+
this.addClickListenerToElements();
|
102
|
+
// this.route.queryParams.subscribe(params => {
|
103
|
+
// const data = JSON.parse(params['data']);
|
104
|
+
// if (data.editedIMG) {
|
105
|
+
// const imgUrl = sessionStorage.getItem('editImageFromTemp');
|
106
|
+
// if (imgUrl) {
|
107
|
+
// this.replaceImageSrc(imgUrl, data.index.index)
|
108
|
+
// }
|
109
|
+
// sessionStorage.removeItem('editImageFromTemp');
|
110
|
+
// }
|
111
|
+
// })
|
112
|
+
}
|
113
|
+
writeValue(value) {
|
114
|
+
if (value !== undefined) {
|
115
|
+
this.editorText = value;
|
116
|
+
this.initEditor();
|
117
|
+
this.init_Func(this.editorText);
|
118
|
+
}
|
119
|
+
}
|
120
|
+
// private addClickListenerToImages() {
|
121
|
+
// const editor = document.getElementById('editor');
|
122
|
+
// if (editor) {
|
123
|
+
// editor.addEventListener('click', (event) => {
|
124
|
+
// const target = event.target as HTMLElement;
|
125
|
+
// if (target.tagName === 'IMG') {
|
126
|
+
// this.selectedImage = target as HTMLImageElement;
|
127
|
+
// this.imageEditUrl = this.selectedImage.src;
|
128
|
+
// // Position the edit button near the selected image
|
129
|
+
// } else {
|
130
|
+
// this.selectedImage = null;
|
131
|
+
// }
|
132
|
+
// });
|
133
|
+
// }
|
134
|
+
// }
|
135
|
+
addClickListenerToImages() {
|
136
|
+
const editor = document.getElementById(this.editorId);
|
137
|
+
if (editor) {
|
138
|
+
editor.addEventListener('click', (event) => {
|
139
|
+
const target = event.target;
|
140
|
+
if (target.tagName === 'IMG') {
|
141
|
+
this.selectedImage = target;
|
142
|
+
this.imageEditUrl = this.selectedImage.src;
|
143
|
+
// Get the index of the selected image
|
144
|
+
const images = editor.getElementsByTagName('img');
|
145
|
+
for (let i = 0; i < images.length; i++) {
|
146
|
+
if (images[i] === this.selectedImage) {
|
147
|
+
this.selectedItemIndex = i;
|
148
|
+
break;
|
149
|
+
}
|
150
|
+
}
|
151
|
+
if (this.toolbarMode === 'bubble') {
|
152
|
+
this.onTextSelect();
|
153
|
+
}
|
154
|
+
}
|
155
|
+
else {
|
156
|
+
this.selectedImage = null;
|
157
|
+
this.selectedItemIndex = null;
|
158
|
+
}
|
159
|
+
});
|
160
|
+
}
|
161
|
+
}
|
162
|
+
addClickListenerToElements() {
|
163
|
+
const editor = document.getElementById(this.editorId);
|
164
|
+
if (editor) {
|
165
|
+
editor.addEventListener('click', (event) => {
|
166
|
+
const target = event.target;
|
167
|
+
// Handle images
|
168
|
+
if (target.tagName === 'IMG') {
|
169
|
+
this.selectedImage = target;
|
170
|
+
this.imageEditUrl = this.selectedImage.src;
|
171
|
+
// Get the index of the selected image
|
172
|
+
const images = editor.getElementsByTagName('img');
|
173
|
+
for (let i = 0; i < images.length; i++) {
|
174
|
+
if (images[i] === this.selectedImage) {
|
175
|
+
this.selectedItemIndex = i;
|
176
|
+
break;
|
177
|
+
}
|
178
|
+
}
|
179
|
+
}
|
180
|
+
else {
|
181
|
+
this.selectedImage = null;
|
182
|
+
}
|
183
|
+
if (target.tagName === 'TD' || target.tagName === 'TH') {
|
184
|
+
this.selectedTable = target.closest('table');
|
185
|
+
const cells = this.selectedTable.getElementsByTagName(target.tagName);
|
186
|
+
for (let i = 0; i < cells.length; i++) {
|
187
|
+
if (cells[i] === target) {
|
188
|
+
this.selectedItemIndex = i;
|
189
|
+
break;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
}
|
193
|
+
else {
|
194
|
+
this.selectedTable = null;
|
195
|
+
}
|
196
|
+
if (target.tagName === 'P' || target.tagName === 'SPAN' || target.tagName === 'DIV') {
|
197
|
+
const paragraphs = editor.getElementsByTagName(target.tagName);
|
198
|
+
for (let i = 0; i < paragraphs.length; i++) {
|
199
|
+
if (paragraphs[i] === target) {
|
200
|
+
this.selectedItemIndex = i;
|
201
|
+
break;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
else {
|
206
|
+
}
|
207
|
+
});
|
208
|
+
}
|
209
|
+
}
|
210
|
+
replaceImageSrc(newSrc, index) {
|
211
|
+
const editor = document.getElementById(this.editorId);
|
212
|
+
if (editor) {
|
213
|
+
editor.focus();
|
214
|
+
const images = editor.getElementsByTagName('IMG');
|
215
|
+
if (index >= 0) {
|
216
|
+
images[index].setAttribute('src', newSrc);
|
217
|
+
}
|
218
|
+
else {
|
219
|
+
console.warn(`Index ${index} is out of bounds. Total images: ${images.length}`);
|
220
|
+
}
|
221
|
+
}
|
222
|
+
else {
|
223
|
+
console.error('Editor element not found');
|
224
|
+
}
|
225
|
+
}
|
226
|
+
initEditor() {
|
227
|
+
// Initialize editor content and listeners
|
228
|
+
const editor = document.getElementById(this.editorId);
|
229
|
+
if (editor) {
|
230
|
+
editor.innerHTML = this.editorText;
|
231
|
+
editor.addEventListener('input', () => {
|
232
|
+
this.onModelChange(editor.innerHTML);
|
233
|
+
});
|
234
|
+
}
|
235
|
+
this.checkPlaceholder();
|
236
|
+
}
|
237
|
+
registerOnChange(fn) {
|
238
|
+
this.onChange = fn;
|
239
|
+
}
|
240
|
+
registerOnTouched(fn) {
|
241
|
+
this.onTouched = fn;
|
242
|
+
}
|
243
|
+
setDisabledState(isDisabled) {
|
244
|
+
// Handle the disabled state if necessary
|
245
|
+
}
|
246
|
+
onModelChange(value) {
|
247
|
+
if (value) {
|
248
|
+
const VALUE = value;
|
249
|
+
this.editorText = this.mainCanvas(VALUE);
|
250
|
+
this.onChange(this.mainCanvas(VALUE));
|
251
|
+
this.editorTextChange.emit(this.mainCanvas(VALUE));
|
252
|
+
}
|
253
|
+
else {
|
254
|
+
this.selectedImage = null;
|
255
|
+
}
|
256
|
+
}
|
257
|
+
applyImageStyles(content) {
|
258
|
+
const div = document.createElement('div');
|
259
|
+
div.innerHTML = content;
|
260
|
+
const images = div.querySelectorAll('img');
|
261
|
+
images.forEach(img => {
|
262
|
+
if (img.style.maxWidth >= '700px') {
|
263
|
+
img.style.maxWidth = '700px';
|
264
|
+
// img.width = 300;
|
265
|
+
img.style.height = 'auto';
|
266
|
+
}
|
267
|
+
else {
|
268
|
+
img.style.maxWidth = '100%';
|
269
|
+
img.style.height = 'auto';
|
270
|
+
}
|
271
|
+
});
|
272
|
+
return div.innerHTML;
|
273
|
+
}
|
274
|
+
init_Func(html) {
|
275
|
+
if (html) {
|
276
|
+
let editor = document.getElementById(this.editorId);
|
277
|
+
if (editor) {
|
278
|
+
editor.focus();
|
279
|
+
this.setEditorContent(html);
|
280
|
+
// Set up a MutationObserver to handle content changes
|
281
|
+
this.setupMutationObserver(editor);
|
282
|
+
// Move the caret to the end after initial content setup
|
283
|
+
this.moveCaretToEnd(editor);
|
284
|
+
// editor.focus()
|
285
|
+
// editor.innerHTML = html;
|
286
|
+
// this.sanitizedContent = this.sanitizer.bypassSecurityTrustHtml(this.applyImageStyles(html));
|
287
|
+
// editor.innerHTML = this.sanitizedContent as string;
|
288
|
+
// editor.addEventListener('input', () => {
|
289
|
+
// if (editor) {
|
290
|
+
// editor.focus()
|
291
|
+
// this.onModelChange(editor.innerHTML);
|
292
|
+
// }
|
293
|
+
// });
|
294
|
+
}
|
295
|
+
}
|
296
|
+
else {
|
297
|
+
this.selectedImage = null;
|
298
|
+
}
|
299
|
+
}
|
300
|
+
setEditorContent(html) {
|
301
|
+
let editor = document.getElementById(this.editorId);
|
302
|
+
if (editor) {
|
303
|
+
// Sanitize and apply styles to the HTML
|
304
|
+
this.sanitizedContent = this.sanitizer.bypassSecurityTrustHtml(this.applyImageStyles(html));
|
305
|
+
editor.innerHTML = this.sanitizedContent;
|
306
|
+
}
|
307
|
+
}
|
308
|
+
setupMutationObserver(editor) {
|
309
|
+
const observer = new MutationObserver(() => {
|
310
|
+
// Move the caret to the end after content changes
|
311
|
+
this.moveCaretToEnd(editor);
|
312
|
+
// Update model with the current content
|
313
|
+
this.onModelChange(editor.innerHTML);
|
314
|
+
});
|
315
|
+
observer.observe(editor, { childList: true, subtree: true, characterData: true });
|
316
|
+
}
|
317
|
+
moveCaretToEnd(editor) {
|
318
|
+
const selection = window.getSelection();
|
319
|
+
const range = document.createRange();
|
320
|
+
if (editor.lastChild) {
|
321
|
+
range.selectNodeContents(editor);
|
322
|
+
range.collapse(false); // Collapse to the end
|
323
|
+
selection?.removeAllRanges();
|
324
|
+
selection?.addRange(range);
|
325
|
+
}
|
326
|
+
}
|
327
|
+
// format(command: string, value?: any) {
|
328
|
+
// document.execCommand(command, false, value ?? '');
|
329
|
+
// // if (command === 'underline') {
|
330
|
+
// // // Toggle underline
|
331
|
+
// // const isUnderlined = document.queryCommandState('underline');
|
332
|
+
// // document.execCommand('underline', false, isUnderlined ? 'false' : 'true');
|
333
|
+
// // } else {
|
334
|
+
// // document.execCommand(command, false, '');
|
335
|
+
// // }
|
336
|
+
// }
|
337
|
+
onFormatChange(data) {
|
338
|
+
const value = data;
|
339
|
+
this.selectedFormatBlock = value;
|
340
|
+
if (value) {
|
341
|
+
this.format('formatBlock', this.editorId, value);
|
342
|
+
}
|
343
|
+
}
|
344
|
+
format(command, editorId, value) {
|
345
|
+
const editor = document.getElementById(editorId);
|
346
|
+
if (editor) {
|
347
|
+
editor.focus();
|
348
|
+
if (command === 'subscript') {
|
349
|
+
this.isSubscriptActive = !this.isSubscriptActive;
|
350
|
+
document.execCommand('subscript', false, '');
|
351
|
+
}
|
352
|
+
else if (command === 'superscript') {
|
353
|
+
this.isSuperscriptActive = !this.isSuperscriptActive;
|
354
|
+
document.execCommand('superscript', false, '');
|
355
|
+
;
|
356
|
+
}
|
357
|
+
else {
|
358
|
+
document.execCommand(command, false, value ?? '');
|
359
|
+
if (value) {
|
360
|
+
const tag = value.toLowerCase().replace(/[<>]/g, '');
|
361
|
+
const toolbar = document.getElementById(editorId + 'toolbar');
|
362
|
+
if (toolbar) {
|
363
|
+
this.selectedFormatBlock = this.formatBlockDecode(tag);
|
364
|
+
}
|
365
|
+
}
|
366
|
+
}
|
367
|
+
}
|
368
|
+
this.checkActiveStates();
|
369
|
+
this.checkFormatBlock(editorId);
|
370
|
+
}
|
371
|
+
checkActiveStates() {
|
372
|
+
this.isBoldActive = document.queryCommandState('bold');
|
373
|
+
this.isItalicActive = document.queryCommandState('italic');
|
374
|
+
this.isUnderlineActive = document.queryCommandState('underline');
|
375
|
+
this.isStrikethroughActive = document.queryCommandState('strikethrough');
|
376
|
+
this.isSubscriptActive = document.queryCommandState('subscript');
|
377
|
+
this.isSuperscriptActive = document.queryCommandState('superscript');
|
378
|
+
}
|
379
|
+
checkFormatBlock(editorId) {
|
380
|
+
const editor = document.getElementById(editorId);
|
381
|
+
if (editor) {
|
382
|
+
const formatBlock = document.queryCommandValue('formatBlock');
|
383
|
+
const toolbar = document.getElementById(editorId + 'toolbar');
|
384
|
+
if (toolbar) {
|
385
|
+
this.selectedFormatBlock = this.formatBlockDecode(formatBlock);
|
386
|
+
}
|
387
|
+
// You can further handle the formatBlock value as needed
|
388
|
+
}
|
389
|
+
}
|
390
|
+
formatBlockDecode(data) {
|
391
|
+
switch (data) {
|
392
|
+
case 'h1':
|
393
|
+
return 'heading 1';
|
394
|
+
break;
|
395
|
+
case 'h2':
|
396
|
+
return 'heading 2';
|
397
|
+
break;
|
398
|
+
case 'h3':
|
399
|
+
return 'heading 3';
|
400
|
+
break;
|
401
|
+
case 'h4':
|
402
|
+
return 'heading 4';
|
403
|
+
break;
|
404
|
+
case 'h5':
|
405
|
+
return 'heading 5';
|
406
|
+
break;
|
407
|
+
case 'h6':
|
408
|
+
return 'heading 6';
|
409
|
+
break;
|
410
|
+
case 'p':
|
411
|
+
return 'normal';
|
412
|
+
break;
|
413
|
+
default:
|
414
|
+
return 'normal';
|
415
|
+
break;
|
416
|
+
}
|
417
|
+
}
|
418
|
+
changeFont(event) {
|
419
|
+
this.selectedFont = event;
|
420
|
+
document.execCommand('fontName', false, this.selectedFont);
|
421
|
+
}
|
422
|
+
insertCodeBlock() {
|
423
|
+
const code = `
|
424
|
+
<pre style="font-size: 12px;
|
425
|
+
color: white;
|
426
|
+
background-color: black;
|
427
|
+
overflow-x: auto;
|
428
|
+
margin-bottom: 5px;
|
429
|
+
margin-top: 5px;
|
430
|
+
padding: 5px 10px;">
|
431
|
+
<code style="display: block;
|
432
|
+
white-space: pre-wrap;
|
433
|
+
height: auto;
|
434
|
+
font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
|
435
|
+
font-size: 14px;" class="language-html">Insert code here...</code>
|
436
|
+
</pre>
|
437
|
+
`;
|
438
|
+
document.execCommand('insertHTML', false, code);
|
439
|
+
}
|
440
|
+
// changeFontSize(event: any) {
|
441
|
+
// document.execCommand('fontSize', false, '7');
|
442
|
+
// let editor = document.getElementById('editor');
|
443
|
+
// if (editor) {
|
444
|
+
// let fontElements = editor.getElementsByTagName('font');
|
445
|
+
// for (let i = 0; i < fontElements.length; i++) {
|
446
|
+
// if (fontElements[i].size == "7") {
|
447
|
+
// fontElements[i].removeAttribute("size");
|
448
|
+
// fontElements[i].style.fontSize = this.selectedFontSize + 'px';
|
449
|
+
// }
|
450
|
+
// }
|
451
|
+
// }
|
452
|
+
// }
|
453
|
+
changeFontSize(event) {
|
454
|
+
const selectedText = window.getSelection();
|
455
|
+
if (selectedText && selectedText.rangeCount > 0) {
|
456
|
+
const range = selectedText.getRangeAt(0);
|
457
|
+
const span = document.createElement('span');
|
458
|
+
span.style.fontSize = this.selectedFontSize + 'px';
|
459
|
+
range.surroundContents(span);
|
460
|
+
}
|
461
|
+
}
|
462
|
+
addLink() {
|
463
|
+
let url = prompt("Enter the link here: ", "http://");
|
464
|
+
if (url) {
|
465
|
+
document.execCommand("createLink", false, url);
|
466
|
+
}
|
467
|
+
}
|
468
|
+
insertsImage(editorId) {
|
469
|
+
const editor = document.getElementById(editorId);
|
470
|
+
if (editor) {
|
471
|
+
editor.focus();
|
472
|
+
let imageInput = document.getElementById('imageInput');
|
473
|
+
if (imageInput) {
|
474
|
+
imageInput.click();
|
475
|
+
}
|
476
|
+
}
|
477
|
+
}
|
478
|
+
handleImageUpload(event) {
|
479
|
+
const file = event.target.files[0];
|
480
|
+
if (file) {
|
481
|
+
const reader = new FileReader();
|
482
|
+
reader.onload = (e) => {
|
483
|
+
const img = new Image();
|
484
|
+
img.src = e.target.result;
|
485
|
+
img.onload = () => {
|
486
|
+
// Create the HTML string with the exact width and height
|
487
|
+
const imgHTML = `<img src="${img.src}" width="${img.width}" height="${img.height}">`;
|
488
|
+
// Insert the image into the editor
|
489
|
+
document.execCommand('insertHTML', false, imgHTML);
|
490
|
+
};
|
491
|
+
};
|
492
|
+
reader.readAsDataURL(file);
|
493
|
+
}
|
494
|
+
}
|
495
|
+
addTable(editorId) {
|
496
|
+
const tableWidth = 825; // Table width in pixels
|
497
|
+
const cols = 3; // Number of columns
|
498
|
+
const cellMinWidth = tableWidth / cols; // Calculate minimum width for each cell
|
499
|
+
let table = `<br /><table style="border-collapse: collapse; width: ${tableWidth}px; border: 1px solid black;">`;
|
500
|
+
for (let i = 0; i < 3; i++) { // Number of rows
|
501
|
+
table += '<tr>';
|
502
|
+
for (let j = 0; j < cols; j++) {
|
503
|
+
table += `<td style="border: 1px solid #000; word-wrap: break-word; word-break: break-all; white-space: normal; min-width: ${cellMinWidth}px;"> </td>`;
|
504
|
+
}
|
505
|
+
table += '</tr>';
|
506
|
+
}
|
507
|
+
table += '</table><br/ >';
|
508
|
+
// document.execCommand('insertHTML', false, table);
|
509
|
+
const editor = document.getElementById(editorId);
|
510
|
+
if (editor) {
|
511
|
+
editor.focus();
|
512
|
+
document.execCommand('insertHTML', false, table);
|
513
|
+
}
|
514
|
+
this.tableAdded = true;
|
515
|
+
this.checkTableSelection();
|
516
|
+
}
|
517
|
+
checkTableSelection(event) {
|
518
|
+
let target = event?.target;
|
519
|
+
if (target && (target.tagName === 'TD' || target.tagName === 'TH')) {
|
520
|
+
this.isTableSelected = true;
|
521
|
+
this.selectedTable = target.closest('table');
|
522
|
+
}
|
523
|
+
else {
|
524
|
+
this.isTableSelected = false;
|
525
|
+
this.selectedTable = null;
|
526
|
+
}
|
527
|
+
this.checkPlaceholder();
|
528
|
+
}
|
529
|
+
checkPlaceholder() {
|
530
|
+
// let editor = document.getElementById('editor');
|
531
|
+
// if (editor) {
|
532
|
+
// this.isPlaceholderVisible = editor.innerHTML === '' || editor.innerHTML === '<br>';
|
533
|
+
// if (this.isPlaceholderVisible) {
|
534
|
+
// // editor.innerHTML = '<span class="placeholder" style="background: transparent; color: #000000">Insert text here ...</span>';
|
535
|
+
// } else {
|
536
|
+
// let placeholder = editor.querySelector('.placeholder');
|
537
|
+
// if (placeholder) {
|
538
|
+
// editor.removeChild(placeholder);
|
539
|
+
// }
|
540
|
+
// }
|
541
|
+
// }
|
542
|
+
}
|
543
|
+
onFocus() {
|
544
|
+
// let editor = document.getElementById('editor');
|
545
|
+
// if (editor && this.isPlaceholderVisible) {
|
546
|
+
// editor.innerHTML = '';
|
547
|
+
// this.isPlaceholderVisible = false;
|
548
|
+
// }
|
549
|
+
}
|
550
|
+
// colorChange(newColor: string) {
|
551
|
+
// this.color = newColor;
|
552
|
+
// }
|
553
|
+
onBlur() {
|
554
|
+
this.checkPlaceholder();
|
555
|
+
}
|
556
|
+
addRow() {
|
557
|
+
if (this.selectedTable) {
|
558
|
+
let row = this.selectedTable.insertRow();
|
559
|
+
for (let i = 0; i < this.selectedTable.rows[0].cells.length; i++) {
|
560
|
+
let cell = row.insertCell(i);
|
561
|
+
cell.innerHTML = ' ';
|
562
|
+
cell.style.border = '1px solid black';
|
563
|
+
}
|
564
|
+
}
|
565
|
+
}
|
566
|
+
// deleteRow() {
|
567
|
+
// if (this.selectedTable) {
|
568
|
+
// this.selectedTable.deleteRow(-1);
|
569
|
+
// }
|
570
|
+
// }
|
571
|
+
// deleteRow() {
|
572
|
+
// if (this.selectedTable) {
|
573
|
+
// let rowIndex = this.selectedTable.rows.length - 1;
|
574
|
+
// if (window.getSelection) {
|
575
|
+
// let selection = window.getSelection();
|
576
|
+
// if (selection) {
|
577
|
+
// let row = selection.anchorNode?.parentElement?.closest('tr');
|
578
|
+
// if (row) {
|
579
|
+
// rowIndex = row.rowIndex;
|
580
|
+
// }
|
581
|
+
// }
|
582
|
+
// }
|
583
|
+
// this.selectedTable.deleteRow(rowIndex);
|
584
|
+
// }
|
585
|
+
// }
|
586
|
+
deleteRow() {
|
587
|
+
const selection = window.getSelection();
|
588
|
+
if (selection) {
|
589
|
+
if (!selection.rangeCount)
|
590
|
+
return;
|
591
|
+
const range = selection.getRangeAt(0);
|
592
|
+
const selectedNode = range.startContainer;
|
593
|
+
const row = selectedNode.parentElement?.closest('tr');
|
594
|
+
if (row) {
|
595
|
+
const table = row.closest('table');
|
596
|
+
if (table) {
|
597
|
+
table.deleteRow(row.rowIndex);
|
598
|
+
}
|
599
|
+
}
|
600
|
+
}
|
601
|
+
}
|
602
|
+
// addColumn() {
|
603
|
+
// if (this.selectedTable) {
|
604
|
+
// for (let i = 0; i < this.selectedTable.rows.length; i++) {
|
605
|
+
// let cell = this.selectedTable.rows[i].insertCell(-1);
|
606
|
+
// cell.innerHTML = ' ';
|
607
|
+
// cell.style.border = '1px solid black';
|
608
|
+
// }
|
609
|
+
// }
|
610
|
+
// }
|
611
|
+
addColumn() {
|
612
|
+
if (this.selectedTable) {
|
613
|
+
const columnCount = this.selectedTable.rows[0].cells.length + 1; // New column count
|
614
|
+
const tableWidth = this.selectedTable.offsetWidth;
|
615
|
+
const minWidth = tableWidth / columnCount;
|
616
|
+
for (let i = 0; i < this.selectedTable.rows.length; i++) {
|
617
|
+
let cell = this.selectedTable.rows[i].insertCell(-1);
|
618
|
+
cell.innerHTML = ' ';
|
619
|
+
cell.style.border = '1px solid black';
|
620
|
+
cell.style.minWidth = `${minWidth}px`;
|
621
|
+
cell.style.wordWrap = 'break-word';
|
622
|
+
cell.style.wordBreak = 'break-all';
|
623
|
+
cell.style.whiteSpace = 'normal';
|
624
|
+
}
|
625
|
+
// Update existing cells' minWidth
|
626
|
+
for (let i = 0; i < this.selectedTable.rows.length; i++) {
|
627
|
+
for (let j = 0; j < this.selectedTable.rows[i].cells.length; j++) {
|
628
|
+
this.selectedTable.rows[i].cells[j].style.minWidth = `${minWidth}px`;
|
629
|
+
}
|
630
|
+
}
|
631
|
+
}
|
632
|
+
}
|
633
|
+
deleteColumn() {
|
634
|
+
if (this.selectedTable) {
|
635
|
+
if (window.getSelection) {
|
636
|
+
let selection = window.getSelection();
|
637
|
+
if (selection) {
|
638
|
+
let cell = selection.anchorNode?.parentElement?.closest('td, th');
|
639
|
+
if (cell) {
|
640
|
+
let cellIndex = cell.cellIndex;
|
641
|
+
for (let i = 0; i < this.selectedTable.rows.length; i++) {
|
642
|
+
this.selectedTable.rows[i].deleteCell(cellIndex);
|
643
|
+
}
|
644
|
+
}
|
645
|
+
}
|
646
|
+
}
|
647
|
+
}
|
648
|
+
}
|
649
|
+
// deleteColumn() {
|
650
|
+
// if (this.selectedTable) {
|
651
|
+
// for (let i = 0; i < this.selectedTable.rows.length; i++) {
|
652
|
+
// this.selectedTable.rows[i].deleteCell(-1);
|
653
|
+
// }
|
654
|
+
// }
|
655
|
+
// }
|
656
|
+
adjustTableWidth(event) {
|
657
|
+
if (this.selectedTable) {
|
658
|
+
this.selectedTable.style.width = event.target.value + 'px';
|
659
|
+
}
|
660
|
+
}
|
661
|
+
adjustCellWidth(event) {
|
662
|
+
if (this.selectedTable) {
|
663
|
+
for (let i = 0; i < this.selectedTable.rows.length; i++) {
|
664
|
+
for (let j = 0; j < this.selectedTable.rows[i].cells.length; j++) {
|
665
|
+
this.selectedTable.rows[i].cells[j].style.width = event.target.value + 'px';
|
666
|
+
}
|
667
|
+
}
|
668
|
+
}
|
669
|
+
}
|
670
|
+
adjustCellHeight(event) {
|
671
|
+
if (this.selectedTable) {
|
672
|
+
for (let i = 0; i < this.selectedTable.rows.length; i++) {
|
673
|
+
for (let j = 0; j < this.selectedTable.rows[i].cells.length; j++) {
|
674
|
+
this.selectedTable.rows[i].cells[j].style.height = event.target.value + 'px';
|
675
|
+
}
|
676
|
+
}
|
677
|
+
}
|
678
|
+
}
|
679
|
+
setCaretToEnd(element) {
|
680
|
+
const range = document.createRange();
|
681
|
+
const sel = window.getSelection();
|
682
|
+
if (sel) {
|
683
|
+
range.selectNodeContents(element);
|
684
|
+
range.collapse(false);
|
685
|
+
sel.removeAllRanges();
|
686
|
+
sel.addRange(range);
|
687
|
+
}
|
688
|
+
}
|
689
|
+
openColorPicker(inputId) {
|
690
|
+
const inputElement = document.getElementById(inputId);
|
691
|
+
if (inputElement) {
|
692
|
+
inputElement.click();
|
693
|
+
}
|
694
|
+
}
|
695
|
+
setTextColor(event, editorId) {
|
696
|
+
const editor = document.getElementById(editorId);
|
697
|
+
if (editor) {
|
698
|
+
editor.focus();
|
699
|
+
const color = event.color.hex;
|
700
|
+
this.selectedTextColor = color;
|
701
|
+
document.execCommand('foreColor', true, color);
|
702
|
+
if (this.dropdown) {
|
703
|
+
this.dropdown.close();
|
704
|
+
}
|
705
|
+
}
|
706
|
+
}
|
707
|
+
setBackgroundColor(event, editorId) {
|
708
|
+
const editor = document.getElementById(editorId);
|
709
|
+
if (editor) {
|
710
|
+
editor.focus();
|
711
|
+
const color = event.color.hex;
|
712
|
+
this.backgroundColor = color;
|
713
|
+
document.execCommand('hiliteColor', true, color);
|
714
|
+
if (this.dropdown) {
|
715
|
+
this.dropdown.close();
|
716
|
+
}
|
717
|
+
}
|
718
|
+
}
|
719
|
+
// colorChanged(event: any) {
|
720
|
+
// this.color = event.color.hex;
|
721
|
+
// }
|
722
|
+
logEvent(event, trigger) {
|
723
|
+
const color = event;
|
724
|
+
this.setTextColor(color, this.editorId);
|
725
|
+
this.selectedTextColor = event;
|
726
|
+
document.execCommand('foreColor', false, event);
|
727
|
+
// this.logs.unshift([this.logs.length + 1, trigger, event]);
|
728
|
+
}
|
729
|
+
editImage() {
|
730
|
+
let data;
|
731
|
+
switch (this.editorFrom) {
|
732
|
+
case 'section-content':
|
733
|
+
data = { editIMG: true, from: 'htmlEditor', index: this.selectedItemIndex };
|
734
|
+
this.navigateToIMGEditor(data);
|
735
|
+
sessionStorage.setItem('editImageFromTemp', JSON.stringify(this.imageEditUrl));
|
736
|
+
sessionStorage.setItem('textEditor', this.editorText);
|
737
|
+
break;
|
738
|
+
case 'template':
|
739
|
+
data = { editIMG: true, from: 'templateEditor', index: this.selectedItemIndex };
|
740
|
+
this.navigateToIMGEditor(data);
|
741
|
+
// sessionStorage.setItem('editImageFromTemp2', JSON.stringify(this.imageEditUrl));
|
742
|
+
sessionStorage.setItem('templateEditor', this.editorText);
|
743
|
+
break;
|
744
|
+
default:
|
745
|
+
sessionStorage.removeItem('editImageFromTemp');
|
746
|
+
// sessionStorage.removeItem('editImageFromTemp2');
|
747
|
+
sessionStorage.removeItem('templateEditor');
|
748
|
+
sessionStorage.removeItem('textEditor');
|
749
|
+
break;
|
750
|
+
}
|
751
|
+
// if (this.editorFrom === 'section-content') {
|
752
|
+
// const data = {editIMG: true, from: 'htmlEditor', index: this.selectedItemIndex}
|
753
|
+
// this.navigateToIMGEditor(data)
|
754
|
+
// sessionStorage.setItem('editImageFromTemp', JSON.stringify(this.imageEditUrl))
|
755
|
+
// sessionStorage.setItem('textEditor', this.editorText)
|
756
|
+
// }
|
757
|
+
}
|
758
|
+
navigateToIMGEditor(data) {
|
759
|
+
this.router.navigate(['/admin/image-editor'], { queryParams: { data: JSON.stringify(data) } });
|
760
|
+
}
|
761
|
+
// onTextSelect(event: MouseEvent): void {
|
762
|
+
// if (this.toolbarMode === 'bubble') {
|
763
|
+
// const selection = window.getSelection();
|
764
|
+
// if (selection && selection.rangeCount > 0) {
|
765
|
+
// const range = selection.getRangeAt(0);
|
766
|
+
// if (!range.collapsed) {
|
767
|
+
// const rect = range.getBoundingClientRect();
|
768
|
+
// this.toolbarTop = rect.bottom + window.scrollY + 10;
|
769
|
+
// this.toolbarLeft = rect.left + window.scrollX + (rect.width / 2) - 50;
|
770
|
+
// this.showToolbar = true;
|
771
|
+
// } else {
|
772
|
+
// this.showToolbar = false;
|
773
|
+
// }
|
774
|
+
// }
|
775
|
+
// }
|
776
|
+
// }
|
777
|
+
onTextSelect(event) {
|
778
|
+
if (this.toolbarMode === 'bubble') {
|
779
|
+
const selection = window.getSelection();
|
780
|
+
if (selection && selection.rangeCount > 0) {
|
781
|
+
const range = selection.getRangeAt(0);
|
782
|
+
if (!range.collapsed) {
|
783
|
+
const rect = range.getBoundingClientRect();
|
784
|
+
const scrollY = document.documentElement.scrollTop;
|
785
|
+
const scrollX = document.documentElement.scrollLeft;
|
786
|
+
this.toolbarTop = rect.top + scrollY - 75;
|
787
|
+
this.toolbarLeft = rect.left + scrollX + (rect.width / 2) - 325;
|
788
|
+
this.showToolbar = true;
|
789
|
+
}
|
790
|
+
else {
|
791
|
+
this.showToolbar = false;
|
792
|
+
}
|
793
|
+
}
|
794
|
+
else {
|
795
|
+
this.showToolbar = false;
|
796
|
+
}
|
797
|
+
}
|
798
|
+
}
|
799
|
+
onPaste(event) {
|
800
|
+
event.preventDefault();
|
801
|
+
const clipboardData = event.clipboardData;
|
802
|
+
if (clipboardData) {
|
803
|
+
const pastedText = clipboardData.getData('text/plain');
|
804
|
+
if (this.isTableData(pastedText)) {
|
805
|
+
const html = this.convertTextToTable(pastedText);
|
806
|
+
this.insertHtmlAtCaret(html);
|
807
|
+
}
|
808
|
+
else {
|
809
|
+
this.insertHtmlAtCaret(pastedText);
|
810
|
+
}
|
811
|
+
}
|
812
|
+
}
|
813
|
+
isTableData(text) {
|
814
|
+
const rows = text.split('\n');
|
815
|
+
return rows.length > 1 && rows[0].split('\t').length > 1;
|
816
|
+
}
|
817
|
+
convertTextToTable(text) {
|
818
|
+
const rows = text.split('\n').filter(row => row.trim() !== '');
|
819
|
+
const tableRows = rows.map(row => {
|
820
|
+
const cells = row.split('\t').map(cell => `<td class="px-1 py-1 style="border: 1px solid #000">${cell}</td>`).join('');
|
821
|
+
return `<tr >${cells}</tr>`;
|
822
|
+
}).join('');
|
823
|
+
return `<table>${tableRows}</table>`;
|
824
|
+
}
|
825
|
+
insertHtmlAtCaret(html) {
|
826
|
+
const range = window.getSelection()?.getRangeAt(0);
|
827
|
+
if (range) {
|
828
|
+
range.deleteContents();
|
829
|
+
const tempDiv = document.createElement('div');
|
830
|
+
tempDiv.innerHTML = html;
|
831
|
+
const frag = document.createDocumentFragment();
|
832
|
+
let node;
|
833
|
+
while ((node = tempDiv.firstChild)) {
|
834
|
+
frag.appendChild(node);
|
835
|
+
}
|
836
|
+
range.insertNode(frag);
|
837
|
+
range.collapse(false);
|
838
|
+
}
|
839
|
+
}
|
840
|
+
openFullscreen() {
|
841
|
+
var elem = document.getElementById("textEditor");
|
842
|
+
this.isFullScreen = true;
|
843
|
+
if (elem.requestFullscreen) {
|
844
|
+
elem.requestFullscreen();
|
845
|
+
}
|
846
|
+
else if (elem.mozRequestFullScreen) {
|
847
|
+
elem.mozRequestFullScreen();
|
848
|
+
}
|
849
|
+
else if (elem.webkitRequestFullscreen) {
|
850
|
+
elem.webkitRequestFullscreen();
|
851
|
+
}
|
852
|
+
else if (elem.msRequestFullscreen) {
|
853
|
+
elem.msRequestFullscreen();
|
854
|
+
}
|
855
|
+
this.style = {
|
856
|
+
'min-height': '90vh',
|
857
|
+
'max-height': '90vh',
|
858
|
+
};
|
859
|
+
}
|
860
|
+
closeFullscreen() {
|
861
|
+
if (document.exitFullscreen) {
|
862
|
+
document.exitFullscreen();
|
863
|
+
this.isFullScreen = false;
|
864
|
+
this.style = {
|
865
|
+
'min-height': '400px',
|
866
|
+
'max-height': '400px',
|
867
|
+
};
|
868
|
+
}
|
869
|
+
}
|
870
|
+
openCanvasColorPicker(inputId) {
|
871
|
+
const inputElement = document.getElementById(inputId);
|
872
|
+
if (inputElement) {
|
873
|
+
inputElement.click();
|
874
|
+
}
|
875
|
+
}
|
876
|
+
setCanvasBackgroundColor(event, editorId) {
|
877
|
+
this.CanvasColor = event.color.hex;
|
878
|
+
const editor = document.getElementById(editorId);
|
879
|
+
if (editor) {
|
880
|
+
let color = '';
|
881
|
+
console.log('event bg color = ', event);
|
882
|
+
editor.style.backgroundColor = '#fff';
|
883
|
+
color = event.color.hex || event;
|
884
|
+
editor.style.backgroundColor = color;
|
885
|
+
this.mainCanvas();
|
886
|
+
// this.init_Func(`<div style="background-color: ${color};">${this.editorText}</div>`);
|
887
|
+
if (this.dropdown) {
|
888
|
+
this.dropdown.close();
|
889
|
+
}
|
890
|
+
}
|
891
|
+
}
|
892
|
+
getToday() {
|
893
|
+
const currentDate = new Date();
|
894
|
+
const day = currentDate.getDate();
|
895
|
+
const month = currentDate.getMonth() + 1;
|
896
|
+
const year = currentDate.getFullYear();
|
897
|
+
const formattedDate = `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
|
898
|
+
this.today = formattedDate;
|
899
|
+
// const label = `{(${this.today})}`;
|
900
|
+
const label = `{(date)}`;
|
901
|
+
const htmlContent = ` ${label} `;
|
902
|
+
const editor = document.getElementById(this.editorId);
|
903
|
+
if (editor) {
|
904
|
+
this.editorText += `<div> ${htmlContent} </div>`;
|
905
|
+
this.sanitizedContent = this.editorText;
|
906
|
+
}
|
907
|
+
else {
|
908
|
+
this.editorText += `<div> ${htmlContent} </div>`;
|
909
|
+
this.sanitizedContent = this.editorText;
|
910
|
+
}
|
911
|
+
}
|
912
|
+
insertPageNumber() {
|
913
|
+
const pageNumber = '{(page)}';
|
914
|
+
const editor = document.getElementById(this.editorId);
|
915
|
+
if (editor) {
|
916
|
+
this.editorText += `<div> ${pageNumber} </div>`;
|
917
|
+
this.sanitizedContent = this.editorText;
|
918
|
+
}
|
919
|
+
else {
|
920
|
+
this.editorText += `<div> ${pageNumber} </div>`;
|
921
|
+
this.sanitizedContent = this.editorText;
|
922
|
+
}
|
923
|
+
}
|
924
|
+
clearTextEditor() {
|
925
|
+
const editor = document.getElementById(this.editorId);
|
926
|
+
if (editor) {
|
927
|
+
this.editorTextClear.emit();
|
928
|
+
let data;
|
929
|
+
// data.color.hex = '#ffffff'
|
930
|
+
data = {
|
931
|
+
color: {
|
932
|
+
hex: '#353343'
|
933
|
+
}
|
934
|
+
};
|
935
|
+
editor.innerHTML = '';
|
936
|
+
this.setCanvasBackgroundColor(data, this.editorId);
|
937
|
+
}
|
938
|
+
}
|
939
|
+
setupHistory() {
|
940
|
+
this.saveState();
|
941
|
+
const editor = document.getElementById(this.editorId);
|
942
|
+
if (editor) {
|
943
|
+
editor.addEventListener('input', () => this.onInput());
|
944
|
+
}
|
945
|
+
}
|
946
|
+
onInput() {
|
947
|
+
this.saveState();
|
948
|
+
}
|
949
|
+
saveState() {
|
950
|
+
const editor = document.getElementById(this.editorId);
|
951
|
+
if (editor) {
|
952
|
+
const editorContent = editor.innerHTML;
|
953
|
+
if (this.historyIndex === this.history.length - 1) {
|
954
|
+
this.history.push(editorContent);
|
955
|
+
this.redoStack = [];
|
956
|
+
}
|
957
|
+
else {
|
958
|
+
this.history = this.history.slice(0, this.historyIndex + 1);
|
959
|
+
this.history.push(editorContent);
|
960
|
+
this.redoStack = [];
|
961
|
+
}
|
962
|
+
this.historyIndex++;
|
963
|
+
}
|
964
|
+
}
|
965
|
+
undo() {
|
966
|
+
if (this.historyIndex > 0) {
|
967
|
+
this.redoStack.push(this.history[this.historyIndex]);
|
968
|
+
this.historyIndex--;
|
969
|
+
const editor = document.getElementById(this.editorId);
|
970
|
+
if (editor) {
|
971
|
+
this.sanitizedContent = this.history[this.historyIndex];
|
972
|
+
}
|
973
|
+
}
|
974
|
+
}
|
975
|
+
redo() {
|
976
|
+
if (this.redoStack.length > 0) {
|
977
|
+
const redoContent = this.redoStack.pop();
|
978
|
+
this.history.push(redoContent);
|
979
|
+
this.historyIndex++;
|
980
|
+
const editor = document.getElementById(this.editorId);
|
981
|
+
if (editor) {
|
982
|
+
this.sanitizedContent = redoContent;
|
983
|
+
}
|
984
|
+
}
|
985
|
+
}
|
986
|
+
mainCanvas(data) {
|
987
|
+
let BG = '';
|
988
|
+
const editor = document.getElementById(this.editorId);
|
989
|
+
if (editor) {
|
990
|
+
editor.focus();
|
991
|
+
if (editor.style.backgroundColor === 'rgb(53, 51, 67)') {
|
992
|
+
BG = 'rgb(255, 255, 255)';
|
993
|
+
}
|
994
|
+
else {
|
995
|
+
BG = editor.style.backgroundColor;
|
996
|
+
}
|
997
|
+
return `<div style="background-color: ${BG}; padding: 10px 15px;">${data}</div>`;
|
998
|
+
}
|
999
|
+
else {
|
1000
|
+
return `<div>${data}</div>`;
|
1001
|
+
}
|
1002
|
+
}
|
1003
|
+
themeMode() {
|
1004
|
+
const clrMode = document.body.getAttribute('data-layout-color');
|
1005
|
+
if (clrMode == 'dark') {
|
1006
|
+
return '2px solid #414141 !important';
|
1007
|
+
}
|
1008
|
+
else {
|
1009
|
+
return '2px solid #D0D0D0 !important';
|
1010
|
+
}
|
1011
|
+
}
|
1012
|
+
themeModeClr() {
|
1013
|
+
const clrMode = document.body.getAttribute('data-layout-color');
|
1014
|
+
if (clrMode == 'dark') {
|
1015
|
+
return '#fff !important';
|
1016
|
+
}
|
1017
|
+
else {
|
1018
|
+
return '#000 !important';
|
1019
|
+
}
|
1020
|
+
}
|
1021
|
+
}
|
1022
|
+
ElHeaderAndFooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ElHeaderAndFooterComponent, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }, { token: i0.Renderer2 }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
1023
|
+
ElHeaderAndFooterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: ElHeaderAndFooterComponent, selector: "el-header-and-footer", inputs: { editorId: "editorId", editorText: "editorText", editorFrom: "editorFrom", clear: "clear", editorAction: "editorAction", style: "style", bgColor: "bgColor", toolbarMode: "toolbarMode", value: "value" }, outputs: { editorTextChange: "editorTextChange", editorActionResponse: "editorActionResponse", editorTextClear: "editorTextClear" }, providers: [{
|
1024
|
+
provide: NG_VALUE_ACCESSOR,
|
1025
|
+
useExisting: forwardRef(() => ElHeaderAndFooterComponent),
|
1026
|
+
multi: true
|
1027
|
+
}], viewQueries: [{ propertyName: "dropdown", first: true, predicate: NgbDropdown, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"container els-text-editor px-0\">\r\n <div class=\"btn-toolbar els-btn-toolbar p-2 py-2 mb-0\" role=\"toolbar\" [id]=\"editorId+'toolbar'\"\r\n aria-label=\"Toolbar with button groups\">\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Header Options\">\r\n <!-- <div class=\"dropdown\">\r\n <select class=\"els-form-select \" style=\" font-weight: 700 !important; color: #fff; width: 150px; border: 2px solid #7D6D6D !important;\" (change)=\"onFormatChange($event)\">\r\n <option [value]=\"'<h1>'\">Heading 1</option>\r\n <option [value]=\"'<h2>'\">Heading 2</option>\r\n <option [value]=\"'<h3>'\">Heading 3</option>\r\n <option [value]=\"'<h4>'\">Heading 4</option>\r\n <option [value]=\"'<h5>'\">Heading 5</option>\r\n <option [value]=\"'<h6>'\">Heading 6</option>\r\n <option selected [value]=\"'<p>'\">Normal</option>\r\n </select>\r\n </div> -->\r\n <div ngbDropdown class=\"dropdown\">\r\n <button class=\"btn btn-sm els-form-select border els-toolbar-dropdown-button dropdown-toggle text-start\"\r\n [style.border]=\"themeMode()\" [style.color]=\"themeModeClr()\"\r\n id=\"headerDropdown\" ngbDropdownToggle>\r\n <span style=\"width: 85px; font-weight: 700 !important;\">{{selectedFormatBlock | titlecase}}</span>\r\n <i class=\"mdi mdi-chevron-down \"></i>\r\n </button>\r\n <div ngbDropdownMenu aria-labelledby=\"headerDropdown\" class=\"els-text-format\">\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<h1>')\" [style.color]=\"themeModeClr()\">\r\n <h1>Heading 1</h1>\r\n </button>\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<h2>')\" [style.color]=\"themeModeClr()\">\r\n <h2>Heading 2</h2>\r\n </button>\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<h3>')\" [style.color]=\"themeModeClr()\">\r\n <h3>Heading 3</h3>\r\n </button>\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<h4>')\" [style.color]=\"themeModeClr()\">\r\n <h4>Heading 4</h4>\r\n </button>\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<h5>')\" [style.color]=\"themeModeClr()\">\r\n <h5>Heading 5</h5>\r\n </button>\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<h6>')\" [style.color]=\"themeModeClr()\">\r\n <h6>Heading 6</h6>\r\n </button>\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<p>')\" [style.color]=\"themeModeClr()\">\r\n <p>Normal</p>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"btn-group els-button-group\" role=\"group\" aria-label=\"Font Options\">\r\n <div ngbDropdown class=\"dropdown\">\r\n <button class=\"btn btn-sm els-form-select border els-toolbar-dropdown-button dropdown-toggle text-start\"\r\n id=\"headerDropdown\" [style.border]=\"themeMode()\" [style.color]=\"themeModeClr()\" ngbDropdownToggle>\r\n <span style=\"width: 85px; font-weight: 700 !important;\" class=\"text-truncate\">{{selectedFont |\r\n titlecase}}</span>\r\n <i class=\"mdi mdi-chevron-down \"></i>\r\n </button>\r\n <div ngbDropdownMenu aria-labelledby=\"headerDropdown\" class=\"els-text-format\">\r\n <button class=\"dropdown-item pb-0\" type=\"button\" *ngFor=\"let font of fonts\"\r\n (click)=\"changeFont(font)\">\r\n <span>{{ font }}</span>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"border py-0\" [style.border]=\"themeMode()\" style=\"height: fit-content;\">\r\n <div class=\"btn-group els-button-group mr-2 \" role=\"group\" aria-label=\"Text Formatting\">\r\n <button type=\"button\" class=\"btn btn-sm els-toolbar-button\" [class.active]=\"isBoldActive\"\r\n (click)=\"format('bold', editorId)\">\r\n <i class=\"mdi mdi-format-bold\"></i>\r\n </button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" [class.active]=\"isItalicActive\"\r\n (click)=\"format('italic', editorId)\">\r\n <i class=\"mdi mdi-format-italic\"></i>\r\n </button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" [class.active]=\"isUnderlineActive\"\r\n (click)=\"format('underline', editorId)\">\r\n <i class=\"mdi mdi-format-underline\"></i>\r\n </button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" [class.active]=\"isStrikethroughActive\"\r\n (click)=\"format('strikethrough', editorId)\">\r\n <i class=\"mdi mdi-format-strikethrough-variant\"></i>\r\n </button>\r\n <div class=\"btn-group\" role=\"group\" aria-label=\"Text Color\">\r\n <!-- <input type=\"color\" id=\"textColorPicker\"\r\n style=\"position: absolute; top: 100%; left: 0; z-index: 100; opacity: 0;\"\r\n (change)=\"setTextColor($event)\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" style=\"position: relative;\"\r\n (click)=\"openColorPicker('textColorPicker')\">\r\n <i class=\"mdi mdi-format-color-text icon-with-underline\" [style.color]=\"selectedTextColor\"></i>\r\n </button> -->\r\n <div ngbDropdown class=\"ql-align\">\r\n <button type=\"button\"\r\n class=\"btn btn-outline-primary els-toolbar-button arrow-none text-secondary border-none p-0\"\r\n id=\"dropdownBasic1\" aria-expanded=\"false\" ngbDropdownToggle>\r\n <i class=\"mdi mdi-format-color-text icon-with-underline\"\r\n [style.color]=\"selectedTextColor ?? '#000'\"></i>\r\n </button>\r\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\" style=\"width: 200px;\">\r\n <color-sketch color=\"#fff\" [presetColors]=\"[]\"\r\n (onChangeComplete)=\"setTextColor($event, editorId)\"></color-sketch>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"btn-group\" role=\"group\" aria-label=\"Background Color\" style=\"position: relative;\">\r\n <!-- <button type=\"button\" class=\"btn btn-white els-toolbar-button\" [style.color]=\"backgroundColor\"\r\n (click)=\"openColorPicker('bgColorPicker')\">\r\n <i class=\"mdi mdi-alpha-a-box\"></i>\r\n </button>\r\n <input type=\"color\" id=\"bgColorPicker\"\r\n style=\"position: absolute; top: 100%; left: 0; z-index: 100; opacity: 0;\"\r\n (change)=\"setBackgroundColor($event)\"> -->\r\n <div ngbDropdown class=\"ql-align\">\r\n <button type=\"button\"\r\n class=\"btn btn-outline-primary els-toolbar-button arrow-none text-secondary border-none p-0\"\r\n id=\"dropdownBasic1\" aria-expanded=\"false\" ngbDropdownToggle>\r\n <i class=\"mdi mdi-alpha-a-box\" [style.color]=\"backgroundColor ?? '#000'\"></i>\r\n </button>\r\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\" style=\"width: 200px;\">\r\n <color-sketch color=\"#fff\" [presetColors]=\"[]\"\r\n (onChangeComplete)=\"setBackgroundColor($event, editorId)\"></color-sketch>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Text Formatting\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\"\r\n (click)=\"format('insertOrderedList', editorId)\"><i\r\n class=\"mdi mdi-format-list-numbered\"></i></button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\"\r\n (click)=\"format('insertUnorderedList', editorId)\"><i\r\n class=\"mdi mdi-format-list-bulleted\"></i></button>\r\n <div ngbDropdown class=\"ql-align\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button arrow-none text-secondary\"\r\n id=\"dropdownBasic1\" aria-expanded=\"false\" ngbDropdownToggle>\r\n <i class=\"mdi mdi-format-align-left \"></i>\r\n </button>\r\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\" style=\"width: 3px;\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" style=\"color: #7A7982;\"\r\n (click)=\"format('justifyLeft', editorId)\"><i class=\"mdi mdi-format-align-left\"></i></button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" style=\"color: #7A7982;\"\r\n (click)=\"format('justifyCenter', editorId)\"><i\r\n class=\"mdi mdi-format-align-center\"></i></button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" style=\"color: #7A7982;\"\r\n (click)=\"format('justifyRight', editorId)\"><i\r\n class=\"mdi mdi-format-align-right\"></i></button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" style=\"color: #7A7982;\"\r\n (click)=\"format('justifyFull', editorId)\"><i\r\n class=\"mdi mdi-format-align-justify\"></i></button>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Text Formatting\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" [class.active]=\"isSubscriptActive\"\r\n (click)=\"format('subscript', editorId)\">\r\n <i class=\"mdi mdi-format-subscript\"></i>\r\n </button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" [class.active]=\"isSuperscriptActive\"\r\n (click)=\"format('superscript', editorId)\">\r\n <i class=\"mdi mdi-format-superscript\"></i>\r\n </button>\r\n\r\n </div>\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Table Options\">\r\n\r\n <div ngbDropdown class=\"ql-align\">\r\n <button type=\"button\" class=\"btn btn-outline-primary arrow-none els-toolbar-button border-none p-0\"\r\n id=\"dropdownBasic1\" aria-expanded=\"false\" ngbDropdownToggle>\r\n <i class=\"mdi mdi-format-color-fill\"></i>\r\n </button>\r\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\" style=\"width: 200px;\">\r\n <color-sketch color=\"#fff\"\r\n (onChangeComplete)=\"setCanvasBackgroundColor($event, editorId)\"></color-sketch>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n <div class=\"btn-group els-button-group-2 mr-3\" role=\"group\" aria-label=\"Table Options\">\r\n <button class=\"btn btn-white px-1\" style=\"height: 24px;\" (click)=\"getToday()\">Date</button>\r\n </div>\r\n <div class=\"btn-group els-button-group-2\" role=\"group\" aria-label=\"Table Options\">\r\n <button class=\"btn btn-white px-1\" style=\"height: 24px;\" (click)=\"insertPageNumber()\">Page\r\n No</button>\r\n\r\n </div>\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Text Formatting\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" (click)=\"addLink()\"><i\r\n class=\"mdi mdi-link-variant\"></i></button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" (click)=\"insertsImage(editorId)\"><i\r\n class=\"mdi mdi-image\"></i></button>\r\n <input type=\"file\" id=\"imageInput\" style=\"display: none;\" (change)=\"handleImageUpload($event)\">\r\n\r\n </div>\r\n <!-- <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Table Options\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" (click)=\"addTable()\"><i\r\n class=\"mdi mdi-table\"></i></button>\r\n <button *ngIf=\"isTableSelected\" type=\"button\" class=\"btn btn-white els-toolbar-button\" (click)=\"addRow()\"><i\r\n class=\"mdi mdi-table-row-plus-after\"></i></button>\r\n <button *ngIf=\"isTableSelected\" type=\"button\" class=\"btn btn-white els-toolbar-button\"\r\n (click)=\"deleteRow()\"><i class=\"mdi mdi-table-row-remove\"></i></button>\r\n <button *ngIf=\"isTableSelected\" type=\"button\" class=\"btn btn-white els-toolbar-button\"\r\n (click)=\"addColumn()\"><i class=\"mdi mdi-table-column-plus-after\"></i></button>\r\n <button *ngIf=\"isTableSelected\" type=\"button\" class=\"btn btn-white els-toolbar-button\"\r\n (click)=\"deleteColumn()\"><i class=\"mdi mdi-table-column-remove\"></i></button>\r\n </div>\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Table Options\">\r\n <button *ngIf=\"selectedImage\" class=\"btn btn-white els-toolbar-button-2\" (click)=\"editImage()\"\r\n style=\"position: absolute;\">Edit Image</button>\r\n </div> -->\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Text Formatting\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" (click)=\"undo()\">\r\n <i class=\"mdi mdi-undo\"></i>\r\n </button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" (click)=\"redo()\">\r\n <i class=\"mdi mdi-redo\"></i>\r\n </button>\r\n\r\n </div>\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Table Options\">\r\n <!-- <button *ngIf=\"selectedImage\" class=\"btn btn-white els-toolbar-button-2\" (click)=\"editImage()\"\r\n style=\"position: absolute;\">Edit Image</button> -->\r\n <button class=\"btn btn-white els-toolbar-button\" (click)=\"clearTextEditor()\">\r\n <i class=\"mdi mdi-close-circle\"></i>\r\n </button>\r\n </div>\r\n\r\n </div>\r\n </div>\r\n\r\n\r\n <div contenteditable=\"true\" [id]=\"editorId\" class=\"els-border p-3\" #editor\r\n style=\"position: relative !important; height: 130px; max-width: 100%; overflow: hidden; \"\r\n [ngStyle]=\"{'font-family': selectedFont, 'font-size': selectedFontSize + 'px'}\" [style]=\"style\"\r\n contenteditable=\"true\" (input)=\"onModelChange($event)\" placeholder=\"Insert text here ...\"\r\n (mouseup)=\"onTextSelect($event)\" [innerHTML]=\"sanitizedContent\" (paste)=\"onPaste($event)\" (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\" (click)=\"checkTableSelection($event)\">\r\n </div>\r\n <table *ngIf=\"parsedTable\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let header of parsedTable.headers\">{{ header }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let row of parsedTable.rows\">\r\n <td *ngFor=\"let cell of row\">{{ cell }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>", styles: ["*{font-family:Noto Sans Telugu UI,sans-serif}#editor{min-height:125px;max-height:125px;overflow-y:auto}#editor img{max-width:100%;height:auto}.bubble-toolbar{position:absolute;background-color:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 5px #00000026;z-index:1000;display:none}.els-text-editor{box-sizing:border-box}.els-btn-toolbar{width:\"1028px\"}.els-toolbar-button{background:none;border:none;cursor:pointer;display:inline-block;float:left;height:24px;padding:3px 5px;width:28px}.els-toolbar-button-2{background:none;border:none;cursor:pointer;display:inline-block;float:left;height:24px;padding:3px 5px;width:100px}.els-toolbar-dropdown-button{background:none;border:none;cursor:pointer;display:inline-block;float:left;height:24px;padding:3px 5px;color:#fff}.els-toolbar-dropdown-button:focus{outline:none}.els-form-select{cursor:pointer;display:inline-block;height:100%;padding:2px 5px 2px 8px;position:relative;width:100%;border:none;background-color:#fff;color:#6c757d}.els-button-group{margin-right:15px}.els-form-select:focus{outline:none}.els-border{border:#353343}.els-border:focus{outline:none}.els-dropdown-item{width:50px!important}.els-toolbar-button.active,.btn-toolbar .btn.active,.btn-toolbar .btn:hover{color:#06c}.dropdown-toggle:after{display:none}.table-container{overflow-x:auto;width:100%}table{width:100%;max-width:100%;margin-bottom:1rem;background-color:transparent;border-collapse:collapse;table-layout:fixed}table td,table th{padding:.75rem;vertical-align:top;border:1px solid #dee2e6;word-wrap:break-word}@media (max-width: 576px){table{display:block;overflow-x:auto;-webkit-overflow-scrolling:touch;border-spacing:0}table thead,table tbody,table tr,table th,table td{display:block}table thead tr{position:absolute;top:-9999px;left:-9999px}table tr{margin-bottom:.625rem;border:1px solid #ccc}table td,table th{border:none;border-bottom:1px solid #ddd;position:relative;padding-left:50%;white-space:normal;text-align:left}table td:before,table th:before{position:absolute;top:.75rem;left:.75rem;width:45%;padding-right:.75rem;white-space:nowrap;text-align:left;font-weight:700}}table.resizable{overflow:hidden;resize:both}.btn-group .btn{display:flex;align-items:center;justify-content:center}.btn-group .mdi{font-size:18px}.icon-with-underline{text-decoration:underline}pre{background-color:#f0f0f0;border:1px solid #ccc;border-radius:5px;overflow-x:auto}code{display:block;white-space:pre-wrap;font-family:Menlo,Monaco,Consolas,Courier New,monospace;font-size:14px}.custom-scrollbar::-webkit-scrollbar{width:4px}.custom-scrollbar::-webkit-scrollbar-thumb{background-color:#888;border-radius:10px;cursor:pointer}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background-color:#555}.custom-scrollbar::-webkit-scrollbar-track{background:transparent;border-radius:10px}.pasted-table{border-collapse:collapse;width:100%}.pasted-table td{border:1px solid black;padding:8px}.pasted-table tr:nth-child(even){background-color:#f2f2f2}.pasted-table tr:hover{background-color:#ddd}.vertical-line{border-left:2px solid #ccc;height:100%;margin:0 auto}.els-text-format{font-weight:800!important;background-color:#2b2936!important;border:2px solid #7D6D6D!important;color:#fff!important}.els-text-format>button{color:#fff!important}.els-text-format>button:hover{background-color:#7d6d6d!important;color:#fff!important}\n"], components: [{ type: i3.SketchComponent, selector: "color-sketch", inputs: ["disableAlpha", "presetColors", "width"] }], directives: [{ type: i4.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { type: i4.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { type: i4.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "titlecase": i5.TitleCasePipe } });
|
1028
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ElHeaderAndFooterComponent, decorators: [{
|
1029
|
+
type: Component,
|
1030
|
+
args: [{ selector: 'el-header-and-footer', providers: [{
|
1031
|
+
provide: NG_VALUE_ACCESSOR,
|
1032
|
+
useExisting: forwardRef(() => ElHeaderAndFooterComponent),
|
1033
|
+
multi: true
|
1034
|
+
}], template: "<div class=\"container els-text-editor px-0\">\r\n <div class=\"btn-toolbar els-btn-toolbar p-2 py-2 mb-0\" role=\"toolbar\" [id]=\"editorId+'toolbar'\"\r\n aria-label=\"Toolbar with button groups\">\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Header Options\">\r\n <!-- <div class=\"dropdown\">\r\n <select class=\"els-form-select \" style=\" font-weight: 700 !important; color: #fff; width: 150px; border: 2px solid #7D6D6D !important;\" (change)=\"onFormatChange($event)\">\r\n <option [value]=\"'<h1>'\">Heading 1</option>\r\n <option [value]=\"'<h2>'\">Heading 2</option>\r\n <option [value]=\"'<h3>'\">Heading 3</option>\r\n <option [value]=\"'<h4>'\">Heading 4</option>\r\n <option [value]=\"'<h5>'\">Heading 5</option>\r\n <option [value]=\"'<h6>'\">Heading 6</option>\r\n <option selected [value]=\"'<p>'\">Normal</option>\r\n </select>\r\n </div> -->\r\n <div ngbDropdown class=\"dropdown\">\r\n <button class=\"btn btn-sm els-form-select border els-toolbar-dropdown-button dropdown-toggle text-start\"\r\n [style.border]=\"themeMode()\" [style.color]=\"themeModeClr()\"\r\n id=\"headerDropdown\" ngbDropdownToggle>\r\n <span style=\"width: 85px; font-weight: 700 !important;\">{{selectedFormatBlock | titlecase}}</span>\r\n <i class=\"mdi mdi-chevron-down \"></i>\r\n </button>\r\n <div ngbDropdownMenu aria-labelledby=\"headerDropdown\" class=\"els-text-format\">\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<h1>')\" [style.color]=\"themeModeClr()\">\r\n <h1>Heading 1</h1>\r\n </button>\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<h2>')\" [style.color]=\"themeModeClr()\">\r\n <h2>Heading 2</h2>\r\n </button>\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<h3>')\" [style.color]=\"themeModeClr()\">\r\n <h3>Heading 3</h3>\r\n </button>\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<h4>')\" [style.color]=\"themeModeClr()\">\r\n <h4>Heading 4</h4>\r\n </button>\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<h5>')\" [style.color]=\"themeModeClr()\">\r\n <h5>Heading 5</h5>\r\n </button>\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<h6>')\" [style.color]=\"themeModeClr()\">\r\n <h6>Heading 6</h6>\r\n </button>\r\n <button class=\"dropdown-item pb-0\" type=\"button\" (click)=\"onFormatChange('<p>')\" [style.color]=\"themeModeClr()\">\r\n <p>Normal</p>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"btn-group els-button-group\" role=\"group\" aria-label=\"Font Options\">\r\n <div ngbDropdown class=\"dropdown\">\r\n <button class=\"btn btn-sm els-form-select border els-toolbar-dropdown-button dropdown-toggle text-start\"\r\n id=\"headerDropdown\" [style.border]=\"themeMode()\" [style.color]=\"themeModeClr()\" ngbDropdownToggle>\r\n <span style=\"width: 85px; font-weight: 700 !important;\" class=\"text-truncate\">{{selectedFont |\r\n titlecase}}</span>\r\n <i class=\"mdi mdi-chevron-down \"></i>\r\n </button>\r\n <div ngbDropdownMenu aria-labelledby=\"headerDropdown\" class=\"els-text-format\">\r\n <button class=\"dropdown-item pb-0\" type=\"button\" *ngFor=\"let font of fonts\"\r\n (click)=\"changeFont(font)\">\r\n <span>{{ font }}</span>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"border py-0\" [style.border]=\"themeMode()\" style=\"height: fit-content;\">\r\n <div class=\"btn-group els-button-group mr-2 \" role=\"group\" aria-label=\"Text Formatting\">\r\n <button type=\"button\" class=\"btn btn-sm els-toolbar-button\" [class.active]=\"isBoldActive\"\r\n (click)=\"format('bold', editorId)\">\r\n <i class=\"mdi mdi-format-bold\"></i>\r\n </button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" [class.active]=\"isItalicActive\"\r\n (click)=\"format('italic', editorId)\">\r\n <i class=\"mdi mdi-format-italic\"></i>\r\n </button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" [class.active]=\"isUnderlineActive\"\r\n (click)=\"format('underline', editorId)\">\r\n <i class=\"mdi mdi-format-underline\"></i>\r\n </button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" [class.active]=\"isStrikethroughActive\"\r\n (click)=\"format('strikethrough', editorId)\">\r\n <i class=\"mdi mdi-format-strikethrough-variant\"></i>\r\n </button>\r\n <div class=\"btn-group\" role=\"group\" aria-label=\"Text Color\">\r\n <!-- <input type=\"color\" id=\"textColorPicker\"\r\n style=\"position: absolute; top: 100%; left: 0; z-index: 100; opacity: 0;\"\r\n (change)=\"setTextColor($event)\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" style=\"position: relative;\"\r\n (click)=\"openColorPicker('textColorPicker')\">\r\n <i class=\"mdi mdi-format-color-text icon-with-underline\" [style.color]=\"selectedTextColor\"></i>\r\n </button> -->\r\n <div ngbDropdown class=\"ql-align\">\r\n <button type=\"button\"\r\n class=\"btn btn-outline-primary els-toolbar-button arrow-none text-secondary border-none p-0\"\r\n id=\"dropdownBasic1\" aria-expanded=\"false\" ngbDropdownToggle>\r\n <i class=\"mdi mdi-format-color-text icon-with-underline\"\r\n [style.color]=\"selectedTextColor ?? '#000'\"></i>\r\n </button>\r\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\" style=\"width: 200px;\">\r\n <color-sketch color=\"#fff\" [presetColors]=\"[]\"\r\n (onChangeComplete)=\"setTextColor($event, editorId)\"></color-sketch>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"btn-group\" role=\"group\" aria-label=\"Background Color\" style=\"position: relative;\">\r\n <!-- <button type=\"button\" class=\"btn btn-white els-toolbar-button\" [style.color]=\"backgroundColor\"\r\n (click)=\"openColorPicker('bgColorPicker')\">\r\n <i class=\"mdi mdi-alpha-a-box\"></i>\r\n </button>\r\n <input type=\"color\" id=\"bgColorPicker\"\r\n style=\"position: absolute; top: 100%; left: 0; z-index: 100; opacity: 0;\"\r\n (change)=\"setBackgroundColor($event)\"> -->\r\n <div ngbDropdown class=\"ql-align\">\r\n <button type=\"button\"\r\n class=\"btn btn-outline-primary els-toolbar-button arrow-none text-secondary border-none p-0\"\r\n id=\"dropdownBasic1\" aria-expanded=\"false\" ngbDropdownToggle>\r\n <i class=\"mdi mdi-alpha-a-box\" [style.color]=\"backgroundColor ?? '#000'\"></i>\r\n </button>\r\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\" style=\"width: 200px;\">\r\n <color-sketch color=\"#fff\" [presetColors]=\"[]\"\r\n (onChangeComplete)=\"setBackgroundColor($event, editorId)\"></color-sketch>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Text Formatting\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\"\r\n (click)=\"format('insertOrderedList', editorId)\"><i\r\n class=\"mdi mdi-format-list-numbered\"></i></button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\"\r\n (click)=\"format('insertUnorderedList', editorId)\"><i\r\n class=\"mdi mdi-format-list-bulleted\"></i></button>\r\n <div ngbDropdown class=\"ql-align\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button arrow-none text-secondary\"\r\n id=\"dropdownBasic1\" aria-expanded=\"false\" ngbDropdownToggle>\r\n <i class=\"mdi mdi-format-align-left \"></i>\r\n </button>\r\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\" style=\"width: 3px;\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" style=\"color: #7A7982;\"\r\n (click)=\"format('justifyLeft', editorId)\"><i class=\"mdi mdi-format-align-left\"></i></button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" style=\"color: #7A7982;\"\r\n (click)=\"format('justifyCenter', editorId)\"><i\r\n class=\"mdi mdi-format-align-center\"></i></button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" style=\"color: #7A7982;\"\r\n (click)=\"format('justifyRight', editorId)\"><i\r\n class=\"mdi mdi-format-align-right\"></i></button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" style=\"color: #7A7982;\"\r\n (click)=\"format('justifyFull', editorId)\"><i\r\n class=\"mdi mdi-format-align-justify\"></i></button>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Text Formatting\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" [class.active]=\"isSubscriptActive\"\r\n (click)=\"format('subscript', editorId)\">\r\n <i class=\"mdi mdi-format-subscript\"></i>\r\n </button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" [class.active]=\"isSuperscriptActive\"\r\n (click)=\"format('superscript', editorId)\">\r\n <i class=\"mdi mdi-format-superscript\"></i>\r\n </button>\r\n\r\n </div>\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Table Options\">\r\n\r\n <div ngbDropdown class=\"ql-align\">\r\n <button type=\"button\" class=\"btn btn-outline-primary arrow-none els-toolbar-button border-none p-0\"\r\n id=\"dropdownBasic1\" aria-expanded=\"false\" ngbDropdownToggle>\r\n <i class=\"mdi mdi-format-color-fill\"></i>\r\n </button>\r\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\" style=\"width: 200px;\">\r\n <color-sketch color=\"#fff\"\r\n (onChangeComplete)=\"setCanvasBackgroundColor($event, editorId)\"></color-sketch>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n <div class=\"btn-group els-button-group-2 mr-3\" role=\"group\" aria-label=\"Table Options\">\r\n <button class=\"btn btn-white px-1\" style=\"height: 24px;\" (click)=\"getToday()\">Date</button>\r\n </div>\r\n <div class=\"btn-group els-button-group-2\" role=\"group\" aria-label=\"Table Options\">\r\n <button class=\"btn btn-white px-1\" style=\"height: 24px;\" (click)=\"insertPageNumber()\">Page\r\n No</button>\r\n\r\n </div>\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Text Formatting\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" (click)=\"addLink()\"><i\r\n class=\"mdi mdi-link-variant\"></i></button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" (click)=\"insertsImage(editorId)\"><i\r\n class=\"mdi mdi-image\"></i></button>\r\n <input type=\"file\" id=\"imageInput\" style=\"display: none;\" (change)=\"handleImageUpload($event)\">\r\n\r\n </div>\r\n <!-- <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Table Options\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" (click)=\"addTable()\"><i\r\n class=\"mdi mdi-table\"></i></button>\r\n <button *ngIf=\"isTableSelected\" type=\"button\" class=\"btn btn-white els-toolbar-button\" (click)=\"addRow()\"><i\r\n class=\"mdi mdi-table-row-plus-after\"></i></button>\r\n <button *ngIf=\"isTableSelected\" type=\"button\" class=\"btn btn-white els-toolbar-button\"\r\n (click)=\"deleteRow()\"><i class=\"mdi mdi-table-row-remove\"></i></button>\r\n <button *ngIf=\"isTableSelected\" type=\"button\" class=\"btn btn-white els-toolbar-button\"\r\n (click)=\"addColumn()\"><i class=\"mdi mdi-table-column-plus-after\"></i></button>\r\n <button *ngIf=\"isTableSelected\" type=\"button\" class=\"btn btn-white els-toolbar-button\"\r\n (click)=\"deleteColumn()\"><i class=\"mdi mdi-table-column-remove\"></i></button>\r\n </div>\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Table Options\">\r\n <button *ngIf=\"selectedImage\" class=\"btn btn-white els-toolbar-button-2\" (click)=\"editImage()\"\r\n style=\"position: absolute;\">Edit Image</button>\r\n </div> -->\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Text Formatting\">\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" (click)=\"undo()\">\r\n <i class=\"mdi mdi-undo\"></i>\r\n </button>\r\n <button type=\"button\" class=\"btn btn-white els-toolbar-button\" (click)=\"redo()\">\r\n <i class=\"mdi mdi-redo\"></i>\r\n </button>\r\n\r\n </div>\r\n <div class=\"btn-group els-button-group mr-2\" role=\"group\" aria-label=\"Table Options\">\r\n <!-- <button *ngIf=\"selectedImage\" class=\"btn btn-white els-toolbar-button-2\" (click)=\"editImage()\"\r\n style=\"position: absolute;\">Edit Image</button> -->\r\n <button class=\"btn btn-white els-toolbar-button\" (click)=\"clearTextEditor()\">\r\n <i class=\"mdi mdi-close-circle\"></i>\r\n </button>\r\n </div>\r\n\r\n </div>\r\n </div>\r\n\r\n\r\n <div contenteditable=\"true\" [id]=\"editorId\" class=\"els-border p-3\" #editor\r\n style=\"position: relative !important; height: 130px; max-width: 100%; overflow: hidden; \"\r\n [ngStyle]=\"{'font-family': selectedFont, 'font-size': selectedFontSize + 'px'}\" [style]=\"style\"\r\n contenteditable=\"true\" (input)=\"onModelChange($event)\" placeholder=\"Insert text here ...\"\r\n (mouseup)=\"onTextSelect($event)\" [innerHTML]=\"sanitizedContent\" (paste)=\"onPaste($event)\" (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\" (click)=\"checkTableSelection($event)\">\r\n </div>\r\n <table *ngIf=\"parsedTable\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let header of parsedTable.headers\">{{ header }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let row of parsedTable.rows\">\r\n <td *ngFor=\"let cell of row\">{{ cell }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>", styles: ["*{font-family:Noto Sans Telugu UI,sans-serif}#editor{min-height:125px;max-height:125px;overflow-y:auto}#editor img{max-width:100%;height:auto}.bubble-toolbar{position:absolute;background-color:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 5px #00000026;z-index:1000;display:none}.els-text-editor{box-sizing:border-box}.els-btn-toolbar{width:\"1028px\"}.els-toolbar-button{background:none;border:none;cursor:pointer;display:inline-block;float:left;height:24px;padding:3px 5px;width:28px}.els-toolbar-button-2{background:none;border:none;cursor:pointer;display:inline-block;float:left;height:24px;padding:3px 5px;width:100px}.els-toolbar-dropdown-button{background:none;border:none;cursor:pointer;display:inline-block;float:left;height:24px;padding:3px 5px;color:#fff}.els-toolbar-dropdown-button:focus{outline:none}.els-form-select{cursor:pointer;display:inline-block;height:100%;padding:2px 5px 2px 8px;position:relative;width:100%;border:none;background-color:#fff;color:#6c757d}.els-button-group{margin-right:15px}.els-form-select:focus{outline:none}.els-border{border:#353343}.els-border:focus{outline:none}.els-dropdown-item{width:50px!important}.els-toolbar-button.active,.btn-toolbar .btn.active,.btn-toolbar .btn:hover{color:#06c}.dropdown-toggle:after{display:none}.table-container{overflow-x:auto;width:100%}table{width:100%;max-width:100%;margin-bottom:1rem;background-color:transparent;border-collapse:collapse;table-layout:fixed}table td,table th{padding:.75rem;vertical-align:top;border:1px solid #dee2e6;word-wrap:break-word}@media (max-width: 576px){table{display:block;overflow-x:auto;-webkit-overflow-scrolling:touch;border-spacing:0}table thead,table tbody,table tr,table th,table td{display:block}table thead tr{position:absolute;top:-9999px;left:-9999px}table tr{margin-bottom:.625rem;border:1px solid #ccc}table td,table th{border:none;border-bottom:1px solid #ddd;position:relative;padding-left:50%;white-space:normal;text-align:left}table td:before,table th:before{position:absolute;top:.75rem;left:.75rem;width:45%;padding-right:.75rem;white-space:nowrap;text-align:left;font-weight:700}}table.resizable{overflow:hidden;resize:both}.btn-group .btn{display:flex;align-items:center;justify-content:center}.btn-group .mdi{font-size:18px}.icon-with-underline{text-decoration:underline}pre{background-color:#f0f0f0;border:1px solid #ccc;border-radius:5px;overflow-x:auto}code{display:block;white-space:pre-wrap;font-family:Menlo,Monaco,Consolas,Courier New,monospace;font-size:14px}.custom-scrollbar::-webkit-scrollbar{width:4px}.custom-scrollbar::-webkit-scrollbar-thumb{background-color:#888;border-radius:10px;cursor:pointer}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background-color:#555}.custom-scrollbar::-webkit-scrollbar-track{background:transparent;border-radius:10px}.pasted-table{border-collapse:collapse;width:100%}.pasted-table td{border:1px solid black;padding:8px}.pasted-table tr:nth-child(even){background-color:#f2f2f2}.pasted-table tr:hover{background-color:#ddd}.vertical-line{border-left:2px solid #ccc;height:100%;margin:0 auto}.els-text-format{font-weight:800!important;background-color:#2b2936!important;border:2px solid #7D6D6D!important;color:#fff!important}.els-text-format>button{color:#fff!important}.els-text-format>button:hover{background-color:#7d6d6d!important;color:#fff!important}\n"] }]
|
1035
|
+
}], ctorParameters: function () { return [{ type: i1.Router }, { type: i1.ActivatedRoute }, { type: i0.Renderer2 }, { type: i2.DomSanitizer }]; }, propDecorators: { dropdown: [{
|
1036
|
+
type: ViewChild,
|
1037
|
+
args: [NgbDropdown, { static: true }]
|
1038
|
+
}], editorId: [{
|
1039
|
+
type: Input
|
1040
|
+
}], editorText: [{
|
1041
|
+
type: Input
|
1042
|
+
}], editorFrom: [{
|
1043
|
+
type: Input
|
1044
|
+
}], clear: [{
|
1045
|
+
type: Input
|
1046
|
+
}], editorAction: [{
|
1047
|
+
type: Input
|
1048
|
+
}], style: [{
|
1049
|
+
type: Input
|
1050
|
+
}], bgColor: [{
|
1051
|
+
type: Input
|
1052
|
+
}], toolbarMode: [{
|
1053
|
+
type: Input
|
1054
|
+
}], editorTextChange: [{
|
1055
|
+
type: Output
|
1056
|
+
}], editorActionResponse: [{
|
1057
|
+
type: Output
|
1058
|
+
}], value: [{
|
1059
|
+
type: Input
|
1060
|
+
}], editorTextClear: [{
|
1061
|
+
type: Output
|
1062
|
+
}] } });
|
1063
|
+
|
1064
|
+
class ElHeaderAndFooterModule {
|
1065
|
+
}
|
1066
|
+
ElHeaderAndFooterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ElHeaderAndFooterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1067
|
+
ElHeaderAndFooterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ElHeaderAndFooterModule, declarations: [ElHeaderAndFooterComponent], imports: [CommonModule,
|
1068
|
+
NgxColorsModule,
|
1069
|
+
FormsModule,
|
1070
|
+
ReactiveFormsModule,
|
1071
|
+
NgbDropdownModule,
|
1072
|
+
ColorSketchModule,
|
1073
|
+
ColorPickerModule], exports: [ElHeaderAndFooterComponent] });
|
1074
|
+
ElHeaderAndFooterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ElHeaderAndFooterModule, imports: [[
|
1075
|
+
CommonModule,
|
1076
|
+
NgxColorsModule,
|
1077
|
+
FormsModule,
|
1078
|
+
ReactiveFormsModule,
|
1079
|
+
NgbDropdownModule,
|
1080
|
+
ColorSketchModule,
|
1081
|
+
ColorPickerModule
|
1082
|
+
]] });
|
1083
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ElHeaderAndFooterModule, decorators: [{
|
1084
|
+
type: NgModule,
|
1085
|
+
args: [{
|
1086
|
+
declarations: [
|
1087
|
+
ElHeaderAndFooterComponent
|
1088
|
+
],
|
1089
|
+
imports: [
|
1090
|
+
CommonModule,
|
1091
|
+
NgxColorsModule,
|
1092
|
+
FormsModule,
|
1093
|
+
ReactiveFormsModule,
|
1094
|
+
NgbDropdownModule,
|
1095
|
+
ColorSketchModule,
|
1096
|
+
ColorPickerModule
|
1097
|
+
],
|
1098
|
+
exports: [
|
1099
|
+
ElHeaderAndFooterComponent
|
1100
|
+
]
|
1101
|
+
}]
|
1102
|
+
}] });
|
1103
|
+
|
1104
|
+
/*
|
1105
|
+
* Public API Surface of el-header-and-footer
|
1106
|
+
*/
|
1107
|
+
|
1108
|
+
/**
|
1109
|
+
* Generated bundle index. Do not edit.
|
1110
|
+
*/
|
1111
|
+
|
1112
|
+
export { ElHeaderAndFooterComponent, ElHeaderAndFooterModule, ElHeaderAndFooterService };
|
1113
|
+
//# sourceMappingURL=el-header-and-footer.mjs.map
|