@acorex/components 18.12.1 → 18.12.3
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg-container/wysiwyg-container.component.mjs +43 -31
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg-toolbar/wysiwyg-toolbar.component.mjs +11 -5
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg-tools/wysiwyg-alignment/wysiwyg-alignment.component.mjs +7 -12
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg-tools/wysiwyg-colors/wysiwyg-colors.component.mjs +6 -11
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg-tools/wysiwyg-font-style/wysiwyg-font-style.component.mjs +23 -28
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg-tools/wysiwyg-history/wysiwyg-history.component.mjs +5 -11
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg-tools/wysiwyg-insert/wysiwyg-insert.component.mjs +4 -10
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg-tools/wysiwyg-list/wysiwyg-list.component.mjs +10 -15
- package/fesm2022/acorex-components-wysiwyg.mjs +93 -107
- package/fesm2022/acorex-components-wysiwyg.mjs.map +1 -1
- package/package.json +36 -36
- package/wysiwyg/lib/wysiwyg/wysiwyg-container/wysiwyg-container.component.d.ts +3 -7
- package/wysiwyg/lib/wysiwyg/wysiwyg-toolbar/wysiwyg-toolbar.component.d.ts +1 -0
- package/wysiwyg/lib/wysiwyg/wysiwyg-tools/wysiwyg-alignment/wysiwyg-alignment.component.d.ts +0 -3
- package/wysiwyg/lib/wysiwyg/wysiwyg-tools/wysiwyg-colors/wysiwyg-colors.component.d.ts +0 -3
- package/wysiwyg/lib/wysiwyg/wysiwyg-tools/wysiwyg-font-style/wysiwyg-font-style.component.d.ts +0 -3
- package/wysiwyg/lib/wysiwyg/wysiwyg-tools/wysiwyg-history/wysiwyg-history.component.d.ts +0 -5
- package/wysiwyg/lib/wysiwyg/wysiwyg-tools/wysiwyg-insert/wysiwyg-insert.component.d.ts +0 -5
- package/wysiwyg/lib/wysiwyg/wysiwyg-tools/wysiwyg-list/wysiwyg-list.component.d.ts +0 -3
@@ -10,6 +10,7 @@ import * as i3$1 from '@angular/forms';
|
|
10
10
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
11
11
|
import { AXWysiwyg } from '@acorex/cdk/wysiwyg';
|
12
12
|
import { MXInputBaseValueComponent, MXLookComponent, AXComponent, AXFocusableComponent, AXClearableComponent, AXValuableComponent } from '@acorex/components/common';
|
13
|
+
import { isBrowser } from '@acorex/core/platform';
|
13
14
|
import { classes } from 'polytype';
|
14
15
|
import { QuillDeltaToHtmlConverter } from 'quill-delta-to-html';
|
15
16
|
import * as i4 from '@acorex/components/color-palette';
|
@@ -39,51 +40,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
39
40
|
* @category Components
|
40
41
|
*/
|
41
42
|
class AXWysiwygContainerComponent extends classes((MXInputBaseValueComponent), MXLookComponent) {
|
42
|
-
/** @ignore */
|
43
43
|
constructor() {
|
44
44
|
super();
|
45
45
|
/** @ignore */
|
46
|
-
this.zone = inject(NgZone);
|
47
|
-
this.wysiwyg = signal(null);
|
48
|
-
/** @ignore */
|
49
|
-
this.view = signal(null);
|
50
|
-
/** @ignore */
|
51
46
|
this.service = inject(AXWysiwygService);
|
47
|
+
/** @ignore */
|
48
|
+
this.zone = inject(NgZone);
|
52
49
|
/**
|
53
50
|
* Specifies the placeholder text.
|
54
51
|
*
|
55
52
|
*/
|
56
53
|
this.placeHolder = input();
|
57
|
-
afterNextRender(() => {
|
58
|
-
|
59
|
-
this.zone.runOutsideAngular(() => {
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
54
|
+
this.#init = afterNextRender(() => {
|
55
|
+
const view = this.getHostElement().querySelector('ax-wysiwyg-view');
|
56
|
+
this.zone.runOutsideAngular(async () => {
|
57
|
+
if (isBrowser()) {
|
58
|
+
const newWysiwyg = new AXWysiwyg();
|
59
|
+
await newWysiwyg.init(view, {
|
60
|
+
readOnly: true,
|
61
|
+
});
|
62
|
+
this.service.wysiwyg.set(newWysiwyg);
|
63
|
+
}
|
64
64
|
});
|
65
|
-
this.service.wysiwyg.set(this.wysiwyg());
|
66
|
-
this.setTimeOut = setTimeout(() => {
|
67
|
-
this.wysiwyg().wysiwygObj.enable();
|
68
|
-
}, 1000);
|
69
65
|
});
|
70
|
-
effect(() => {
|
71
|
-
if (this.placeHolder() && this.wysiwyg()) {
|
72
|
-
this.wysiwyg().
|
66
|
+
this.#effect1 = effect(() => {
|
67
|
+
if (this.placeHolder() && this.service.wysiwyg()?.quillObj()) {
|
68
|
+
this.service.wysiwyg().quillObj().root.setAttribute('data-placeholder', this.placeHolder());
|
73
69
|
}
|
74
|
-
else {
|
75
|
-
this.wysiwyg().
|
70
|
+
else if (this.service.wysiwyg()?.quillObj()) {
|
71
|
+
this.service.wysiwyg().quillObj().root.setAttribute('data-placeholder', 'Write Your Message ...');
|
76
72
|
}
|
77
73
|
});
|
78
|
-
effect(() => {
|
79
|
-
if (this.value) {
|
80
|
-
this.wysiwyg().
|
74
|
+
this.#effect2 = effect(() => {
|
75
|
+
if (this.value && this.service.wysiwyg()?.quillObj()) {
|
76
|
+
this.service.wysiwyg().quillObj().root.innerHTML = this.value;
|
81
77
|
}
|
82
|
-
}
|
78
|
+
});
|
79
|
+
this.#effect3 = effect(() => {
|
80
|
+
if (this.service.wysiwyg()?.quillObj()) {
|
81
|
+
this.service.wysiwyg().quillObj().on('text-change', this.changeHandler.bind(this));
|
82
|
+
this.setTimeOut = setTimeout(() => {
|
83
|
+
this.service.wysiwyg()?.quillObj().enable();
|
84
|
+
}, 1000);
|
85
|
+
}
|
86
|
+
});
|
87
|
+
this.onValueChanged.subscribe((v) => {
|
88
|
+
this.service.wysiwyg()?.setContent(v.value);
|
89
|
+
});
|
83
90
|
}
|
91
|
+
#init;
|
92
|
+
#effect1;
|
93
|
+
#effect2;
|
94
|
+
#effect3;
|
84
95
|
/** @ignore */
|
85
96
|
changeHandler() {
|
86
|
-
const value = this.wysiwyg().
|
97
|
+
const value = this.service.wysiwyg()?.quillObj().root.innerHTML;
|
87
98
|
if (value === '<p><br></p>' || !value) {
|
88
99
|
this.commitValue(null);
|
89
100
|
if (this.service.isEditorClean())
|
@@ -91,7 +102,7 @@ class AXWysiwygContainerComponent extends classes((MXInputBaseValueComponent), M
|
|
91
102
|
this.service.isEditorClean.set(true);
|
92
103
|
}
|
93
104
|
else {
|
94
|
-
const delta = this.wysiwyg().
|
105
|
+
const delta = this.service.wysiwyg()?.quillObj().editor.delta.ops;
|
95
106
|
const cfg = { inlineStyles: true };
|
96
107
|
const converter = new QuillDeltaToHtmlConverter(delta, cfg);
|
97
108
|
const html = converter.convert();
|
@@ -103,8 +114,9 @@ class AXWysiwygContainerComponent extends classes((MXInputBaseValueComponent), M
|
|
103
114
|
}
|
104
115
|
/** @ignore */
|
105
116
|
ngOnDestroy() {
|
106
|
-
this.wysiwyg().
|
117
|
+
this.service.wysiwyg()?.quillObj().off('text-change', this.changeHandler);
|
107
118
|
clearTimeout(this.setTimeOut);
|
119
|
+
this.onValueChanged.unsubscribe();
|
108
120
|
}
|
109
121
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXWysiwygContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
110
122
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: AXWysiwygContainerComponent, selector: "ax-wysiwyg-container", inputs: { look: { classPropertyName: "look", publicName: "look", isSignal: false, isRequired: false, transformFunction: null }, placeHolder: { classPropertyName: "placeHolder", publicName: "placeHolder", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onValueChanged: "onValueChanged" }, providers: [
|
@@ -139,13 +151,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
139
151
|
* @category Components
|
140
152
|
*/
|
141
153
|
class AXWysiwygToolbarComponent {
|
154
|
+
get __hostClass() {
|
155
|
+
return `ax-sm`;
|
156
|
+
}
|
142
157
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXWysiwygToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
143
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: AXWysiwygToolbarComponent, selector: "ax-wysiwyg-toolbar", ngImport: i0, template: "<
|
158
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: AXWysiwygToolbarComponent, selector: "ax-wysiwyg-toolbar", host: { properties: { "class": "this.__hostClass" } }, ngImport: i0, template: "<ng-content select=\"ax-prefix\"></ng-content>\r\n<div class=\"ax-wysiwyg-tools\"><ng-content></ng-content></div>\r\n<ng-content select=\"ax-suffix\"></ng-content>\r\n", styles: ["ax-wysiwyg-toolbar{overflow:hidden;display:flex;flex-wrap:wrap;justify-content:space-between;padding:.5rem}ax-wysiwyg-toolbar .ax-icon{font-weight:900;font-size:1rem}ax-wysiwyg-toolbar ax-button{margin-inline:.1rem}ax-wysiwyg-toolbar ax-select-box{margin-inline:.5rem}ax-wysiwyg-toolbar .ax-wysiwyg-tools{display:flex;flex-wrap:wrap}ax-wysiwyg-toolbar ax-select-box{width:auto!important}\n"], encapsulation: i0.ViewEncapsulation.None }); }
|
144
159
|
}
|
145
160
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXWysiwygToolbarComponent, decorators: [{
|
146
161
|
type: Component,
|
147
|
-
args: [{ selector: 'ax-wysiwyg-toolbar', encapsulation: ViewEncapsulation.None, template: "<
|
148
|
-
}]
|
162
|
+
args: [{ selector: 'ax-wysiwyg-toolbar', encapsulation: ViewEncapsulation.None, template: "<ng-content select=\"ax-prefix\"></ng-content>\r\n<div class=\"ax-wysiwyg-tools\"><ng-content></ng-content></div>\r\n<ng-content select=\"ax-suffix\"></ng-content>\r\n", styles: ["ax-wysiwyg-toolbar{overflow:hidden;display:flex;flex-wrap:wrap;justify-content:space-between;padding:.5rem}ax-wysiwyg-toolbar .ax-icon{font-weight:900;font-size:1rem}ax-wysiwyg-toolbar ax-button{margin-inline:.1rem}ax-wysiwyg-toolbar ax-select-box{margin-inline:.5rem}ax-wysiwyg-toolbar .ax-wysiwyg-tools{display:flex;flex-wrap:wrap}ax-wysiwyg-toolbar ax-select-box{width:auto!important}\n"] }]
|
163
|
+
}], propDecorators: { __hostClass: [{
|
164
|
+
type: HostBinding,
|
165
|
+
args: ['class']
|
166
|
+
}] } });
|
149
167
|
|
150
168
|
/**
|
151
169
|
* A container component for WYSIWYG (What You See Is What You Get) editor functionality.
|
@@ -159,8 +177,6 @@ class AXWysiwygAlignmentComponent {
|
|
159
177
|
/** @ignore */
|
160
178
|
this.alignState = signal('');
|
161
179
|
/** @ignore */
|
162
|
-
this.wysiwyg = signal(null);
|
163
|
-
/** @ignore */
|
164
180
|
this.popoverOption = {
|
165
181
|
openOn: 'click',
|
166
182
|
closeOn: 'clickOut',
|
@@ -169,30 +185,27 @@ class AXWysiwygAlignmentComponent {
|
|
169
185
|
offsetY: 0,
|
170
186
|
};
|
171
187
|
effect(() => {
|
172
|
-
if (!this.wysiwyg())
|
188
|
+
if (!this.service.wysiwyg())
|
173
189
|
return;
|
174
190
|
switch (this.service.currentSelectedElemAlign()) {
|
175
191
|
case 'ql-align-center':
|
176
192
|
this.alignState.set('center');
|
177
|
-
this.wysiwyg().align('center');
|
193
|
+
this.service.wysiwyg().align('center');
|
178
194
|
break;
|
179
195
|
case 'ql-align-right':
|
180
196
|
this.alignState.set('right');
|
181
|
-
this.wysiwyg().align('right');
|
197
|
+
this.service.wysiwyg().align('right');
|
182
198
|
break;
|
183
199
|
default:
|
184
200
|
this.alignState.set('left');
|
185
|
-
this.wysiwyg().align('left');
|
201
|
+
this.service.wysiwyg().align('left');
|
186
202
|
}
|
187
203
|
}, { allowSignalWrites: true });
|
188
|
-
afterNextRender(() => {
|
189
|
-
this.wysiwyg.set(this.service.wysiwyg());
|
190
|
-
});
|
191
204
|
}
|
192
205
|
/** @ignore */
|
193
206
|
alignStateHandler(e) {
|
194
207
|
this.alignState.set(e);
|
195
|
-
this.wysiwyg().align(e);
|
208
|
+
this.service.wysiwyg().align(e);
|
196
209
|
}
|
197
210
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXWysiwygAlignmentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
198
211
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: AXWysiwygAlignmentComponent, selector: "ax-wysiwyg-alignment", ngImport: i0, template: "<ax-button look=\"blank\" #alignPop>\n <ax-icon class=\"ax-icon ax-icon-align-left\"></ax-icon>\n</ax-button>\n<ax-popover [openOn]=\"popoverOption.openOn\" [closeOn]=\"popoverOption.closeOn\" [target]=\"alignPop\" [placement]=\"popoverOption.placement\">\n <div class=\"ax-overlay-pane ax-alignment-cotainer ax-sm\">\n <ax-button (click)=\"alignStateHandler('left')\" look=\"blank\" [selected]=\"alignState() === 'left' ? true : false\">\n <ax-icon class=\"ax-icon ax-icon-align-left\"></ax-icon>\n </ax-button>\n\n <ax-button (click)=\"alignStateHandler('center')\" look=\"blank\" [selected]=\"alignState() === 'center' ? true : false\">\n <ax-icon class=\"ax-icon ax-icon-align-center\"></ax-icon>\n </ax-button>\n\n <ax-button (click)=\"alignStateHandler('right')\" look=\"blank\" [selected]=\"alignState() === 'right' ? true : false\">\n <ax-icon class=\"ax-icon ax-icon-align-right\"></ax-icon>\n </ax-button>\n </div>\n</ax-popover>\n", styles: [".ax-alignment-cotainer{padding:.5rem}\n"], dependencies: [{ kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type", "responsiveOn", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "responsiveOnChange", "loadingTextChange"] }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i3.AXPopoverComponent, selector: "ax-popover", inputs: ["offsetX", "offsetY", "target", "placement", "content", "openOn", "closeOn", "hasBackdrop", "openAfter", "closeAfter", "backdropClass", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }] }); }
|
@@ -212,8 +225,6 @@ class AXWysiwygColorsComponent {
|
|
212
225
|
/** @ignore */
|
213
226
|
this.service = inject(AXWysiwygService);
|
214
227
|
/** @ignore */
|
215
|
-
this.wysiwyg = signal(null);
|
216
|
-
/** @ignore */
|
217
228
|
this.selectedColor = signal('rgb(151, 148, 148)');
|
218
229
|
/** @ignore */
|
219
230
|
this.selectedHighlightColor = signal('rgba(223, 223, 24, 0.5)');
|
@@ -229,9 +240,6 @@ class AXWysiwygColorsComponent {
|
|
229
240
|
offsetX: 0,
|
230
241
|
offsetY: 0,
|
231
242
|
};
|
232
|
-
afterNextRender(() => {
|
233
|
-
this.wysiwyg.set(this.service.wysiwyg());
|
234
|
-
});
|
235
243
|
effect(() => {
|
236
244
|
if (this.service.isEditorClean()) {
|
237
245
|
this.selectedHighlightColor.set('rgba(223, 223, 24, 0.5)');
|
@@ -244,28 +252,28 @@ class AXWysiwygColorsComponent {
|
|
244
252
|
if (!this.userInteractColor())
|
245
253
|
return;
|
246
254
|
this.selectedColor.set(e);
|
247
|
-
this.wysiwyg().color(e);
|
255
|
+
this.service.wysiwyg().color(e);
|
248
256
|
}
|
249
257
|
/** @ignore */
|
250
258
|
changeHighlightColorHandler(e) {
|
251
259
|
if (!this.userInteractHighligh())
|
252
260
|
return;
|
253
261
|
this.selectedHighlightColor.set(e);
|
254
|
-
this.wysiwyg().background(e);
|
262
|
+
this.service.wysiwyg().background(e);
|
255
263
|
}
|
256
264
|
/** @ignore */
|
257
265
|
initialHighlightHandler() {
|
258
266
|
if (this.userInteractHighligh())
|
259
267
|
return;
|
260
268
|
this.userInteractHighligh.set(true);
|
261
|
-
this.wysiwyg().background('rgba(223, 223, 24, 0.5)');
|
269
|
+
this.service.wysiwyg().background('rgba(223, 223, 24, 0.5)');
|
262
270
|
}
|
263
271
|
/** @ignore */
|
264
272
|
initialColorHandler() {
|
265
273
|
if (this.userInteractColor())
|
266
274
|
return;
|
267
275
|
this.userInteractColor.set(true);
|
268
|
-
this.wysiwyg().color('rgb(151, 148, 148)');
|
276
|
+
this.service.wysiwyg().color('rgb(151, 148, 148)');
|
269
277
|
}
|
270
278
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXWysiwygColorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
271
279
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: AXWysiwygColorsComponent, selector: "ax-wysiwyg-colors", ngImport: i0, template: "<div class=\"ax-color-picker-wysiwyg-container\">\n <div (click)=\"initialColorHandler()\" class=\"ax-color-flex-wysiwyg-container\">\n <div [style]=\"{ backgroundColor: selectedColor() }\" class=\"ax-submit-color\"></div>\n <ax-button #colorBtn look=\"blank\">\n <ax-icon class=\"ax-icon ax-icon-color-palette\"></ax-icon>\n </ax-button>\n </div>\n\n <div (click)=\"initialHighlightHandler()\" class=\"ax-color-flex-wysiwyg-container\">\n <div [style]=\"{ backgroundColor: selectedHighlightColor() }\" class=\"ax-submit-color\"></div>\n <ax-button #highlightBtn look=\"blank\">\n <ax-icon class=\"ax-icon ax-icon-highlight\"></ax-icon>\n </ax-button>\n </div>\n</div>\n\n<ax-popover\n [openOn]=\"popoverOption.openOn\"\n [closeOn]=\"popoverOption.closeOn\"\n [target]=\"colorBtn\"\n [placement]=\"popoverOption.placement\"\n>\n <div class=\"ax-overlay-pane\">\n <ax-color-palette (ngModelChange)=\"changeColorHandler($event)\" [ngModel]=\"selectedColor()\">\n <ax-color-palette-preview></ax-color-palette-preview>\n <ax-color-palette-picker></ax-color-palette-picker>\n <ax-color-palette-input></ax-color-palette-input>\n </ax-color-palette>\n </div>\n</ax-popover>\n\n<ax-popover\n [openOn]=\"popoverOption.openOn\"\n [closeOn]=\"popoverOption.closeOn\"\n [target]=\"highlightBtn\"\n [placement]=\"popoverOption.placement\"\n>\n <div class=\"ax-overlay-pane\">\n <ax-color-palette\n (ngModelChange)=\"changeHighlightColorHandler($event)\"\n [ngModel]=\"selectedHighlightColor()\"\n >\n <ax-color-palette-preview></ax-color-palette-preview>\n <ax-color-palette-picker></ax-color-palette-picker>\n <ax-color-palette-input></ax-color-palette-input>\n </ax-color-palette>\n </div>\n</ax-popover>\n", styles: [".ax-color-picker-wysiwyg-container{display:flex;align-items:center}.ax-color-picker-wysiwyg-container .ax-color-flex-wysiwyg-container{display:flex;align-items:center;cursor:pointer}.ax-color-picker-wysiwyg-container .ax-submit-color{border:1px solid rgb(var(--ax-color-text-default));width:.6rem;height:.6rem;border-radius:1000vmax}\n"], dependencies: [{ kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type", "responsiveOn", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "responsiveOnChange", "loadingTextChange"] }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.AXColorPalleteComponent, selector: "ax-color-palette", inputs: ["disabled", "tabIndex", "readonly", "value", "state", "name", "checked"], outputs: ["onBlur", "onFocus", "valueChange", "stateChange", "onValueChanged", "readonlyChange", "disabledChange"] }, { kind: "component", type: i4.AXColorPalettePreviewComponent, selector: "ax-color-palette-preview" }, { kind: "component", type: i4.AXColorPaletteInputComponent, selector: "ax-color-palette-input" }, { kind: "component", type: i4.AXColorPalettePickerComponent, selector: "ax-color-palette-picker" }, { kind: "component", type: i3.AXPopoverComponent, selector: "ax-popover", inputs: ["offsetX", "offsetY", "target", "placement", "content", "openOn", "closeOn", "hasBackdrop", "openAfter", "closeAfter", "backdropClass", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
@@ -285,8 +293,6 @@ class AXWysiwygFontStyleComponent {
|
|
285
293
|
/** @ignore */
|
286
294
|
this.parent = inject(AXWysiwygContainerComponent);
|
287
295
|
/** @ignore */
|
288
|
-
this.wysiwyg = signal(null);
|
289
|
-
/** @ignore */
|
290
296
|
this.boldState = signal(false);
|
291
297
|
/** @ignore */
|
292
298
|
this.italicState = signal(false);
|
@@ -299,97 +305,94 @@ class AXWysiwygFontStyleComponent {
|
|
299
305
|
/** @ignore */
|
300
306
|
this.service = inject(AXWysiwygService);
|
301
307
|
effect(() => {
|
302
|
-
if (!this.wysiwyg())
|
308
|
+
if (!this.service.wysiwyg())
|
303
309
|
return;
|
304
310
|
this.service.currentSelectedElemArray().forEach((item) => {
|
305
311
|
switch (item) {
|
306
312
|
case 'U':
|
307
|
-
this.wysiwyg().underLine(true);
|
313
|
+
this.service.wysiwyg().underLine(true);
|
308
314
|
this.underLineState.set(true);
|
309
315
|
break;
|
310
316
|
case 'S':
|
311
|
-
this.wysiwyg().strike(true);
|
317
|
+
this.service.wysiwyg().strike(true);
|
312
318
|
this.strikeLineState.set(true);
|
313
319
|
break;
|
314
320
|
case 'EM':
|
315
|
-
this.wysiwyg().italic(true);
|
321
|
+
this.service.wysiwyg().italic(true);
|
316
322
|
this.italicState.set(true);
|
317
323
|
break;
|
318
324
|
case 'STRONG':
|
319
|
-
this.wysiwyg().bold(true);
|
325
|
+
this.service.wysiwyg().bold(true);
|
320
326
|
this.boldState.set(true);
|
321
327
|
break;
|
322
328
|
default:
|
323
329
|
if (this.boldState())
|
324
|
-
this.wysiwyg().bold(true);
|
330
|
+
this.service.wysiwyg().bold(true);
|
325
331
|
if (this.italicState())
|
326
|
-
this.wysiwyg().italic(true);
|
332
|
+
this.service.wysiwyg().italic(true);
|
327
333
|
if (this.strikeLineState())
|
328
|
-
this.wysiwyg().strike(true);
|
334
|
+
this.service.wysiwyg().strike(true);
|
329
335
|
if (this.underLineState())
|
330
|
-
this.wysiwyg().underLine(true);
|
336
|
+
this.service.wysiwyg().underLine(true);
|
331
337
|
}
|
332
338
|
});
|
333
339
|
}, { allowSignalWrites: true });
|
334
|
-
afterNextRender(() => {
|
335
|
-
this.wysiwyg.set(this.service.wysiwyg());
|
336
|
-
});
|
337
340
|
}
|
338
341
|
/** @ignore */
|
339
342
|
bold() {
|
340
343
|
if (this.boldState()) {
|
341
|
-
this.wysiwyg().bold(false);
|
344
|
+
this.service.wysiwyg().bold(false);
|
342
345
|
this.boldState.set(false);
|
343
346
|
}
|
344
347
|
else {
|
345
|
-
this.wysiwyg().bold(true);
|
348
|
+
this.service.wysiwyg().bold(true);
|
346
349
|
this.boldState.set(true);
|
347
350
|
}
|
348
351
|
}
|
349
352
|
/** @ignore */
|
350
353
|
italic() {
|
351
354
|
if (this.italicState()) {
|
352
|
-
this.wysiwyg().italic(false);
|
355
|
+
this.service.wysiwyg().italic(false);
|
353
356
|
this.italicState.set(false);
|
354
357
|
}
|
355
358
|
else {
|
356
|
-
this.wysiwyg().italic(true);
|
359
|
+
this.service.wysiwyg().italic(true);
|
357
360
|
this.italicState.set(true);
|
358
361
|
}
|
359
362
|
}
|
360
363
|
/** @ignore */
|
361
364
|
underLine() {
|
362
365
|
if (this.underLineState()) {
|
363
|
-
this.wysiwyg().underLine(false);
|
366
|
+
this.service.wysiwyg().underLine(false);
|
364
367
|
this.underLineState.set(false);
|
365
368
|
}
|
366
369
|
else {
|
367
|
-
this.wysiwyg().underLine(true);
|
370
|
+
this.service.wysiwyg().underLine(true);
|
368
371
|
this.underLineState.set(true);
|
369
372
|
}
|
370
373
|
}
|
371
374
|
/** @ignore */
|
372
375
|
strike() {
|
373
376
|
if (this.strikeLineState()) {
|
374
|
-
this.wysiwyg().strike(false);
|
377
|
+
this.service.wysiwyg().strike(false);
|
375
378
|
this.strikeLineState.set(false);
|
376
379
|
}
|
377
380
|
else {
|
378
|
-
this.wysiwyg().strike(true);
|
381
|
+
this.service.wysiwyg().strike(true);
|
379
382
|
this.strikeLineState.set(true);
|
380
383
|
}
|
381
384
|
}
|
382
385
|
/** @ignore */
|
383
386
|
fontSizeHandler(e) {
|
384
|
-
const range = this.wysiwyg().
|
385
|
-
if (!range
|
387
|
+
const range = this.service.wysiwyg()?.quillObj().getSelection();
|
388
|
+
if (!range?.length)
|
386
389
|
return;
|
387
390
|
if (e === 'medium') {
|
388
|
-
this.wysiwyg().fontSize(false, range);
|
391
|
+
this.service.wysiwyg().fontSize(false, range);
|
389
392
|
this.selectedFont.set('medium');
|
390
393
|
}
|
391
394
|
else {
|
392
|
-
this.wysiwyg().fontSize(e, range);
|
395
|
+
this.service.wysiwyg().fontSize(e, range);
|
393
396
|
this.selectedFont.set(e);
|
394
397
|
}
|
395
398
|
}
|
@@ -406,23 +409,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
406
409
|
* @category Components
|
407
410
|
*/
|
408
411
|
class AXWysiwygHistoryComponent {
|
409
|
-
/** @ignore */
|
410
412
|
constructor() {
|
411
413
|
/** @ignore */
|
412
414
|
this.service = inject(AXWysiwygService);
|
413
|
-
/** @ignore */
|
414
|
-
this.wysiwyg = signal(null);
|
415
|
-
afterNextRender(() => {
|
416
|
-
this.wysiwyg.set(this.service.wysiwyg());
|
417
|
-
});
|
418
415
|
}
|
419
416
|
/** @ignore */
|
420
417
|
undo() {
|
421
|
-
this.wysiwyg().undo();
|
418
|
+
this.service.wysiwyg().undo();
|
422
419
|
}
|
423
420
|
/** @ignore */
|
424
421
|
redo() {
|
425
|
-
this.wysiwyg().redo();
|
422
|
+
this.service.wysiwyg().redo();
|
426
423
|
}
|
427
424
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXWysiwygHistoryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
428
425
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: AXWysiwygHistoryComponent, selector: "ax-wysiwyg-history", ngImport: i0, template: "<ax-button class=\"\" (click)=\"undo()\" look=\"blank\">\n <ax-icon class=\"ax-icon ax-icon-undo\"></ax-icon>\n</ax-button>\n\n<ax-button class=\"\" (click)=\"redo()\" look=\"blank\">\n <ax-icon class=\"ax-icon ax-icon-redo\"></ax-icon>\n</ax-button>\n", styles: [""], dependencies: [{ kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type", "responsiveOn", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "responsiveOnChange", "loadingTextChange"] }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
@@ -430,20 +427,17 @@ class AXWysiwygHistoryComponent {
|
|
430
427
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXWysiwygHistoryComponent, decorators: [{
|
431
428
|
type: Component,
|
432
429
|
args: [{ selector: 'ax-wysiwyg-history', encapsulation: ViewEncapsulation.None, template: "<ax-button class=\"\" (click)=\"undo()\" look=\"blank\">\n <ax-icon class=\"ax-icon ax-icon-undo\"></ax-icon>\n</ax-button>\n\n<ax-button class=\"\" (click)=\"redo()\" look=\"blank\">\n <ax-icon class=\"ax-icon ax-icon-redo\"></ax-icon>\n</ax-button>\n" }]
|
433
|
-
}]
|
430
|
+
}] });
|
434
431
|
|
435
432
|
/**
|
436
433
|
* A container component for WYSIWYG (What You See Is What You Get) editor functionality.
|
437
434
|
* @category Components
|
438
435
|
*/
|
439
436
|
class AXWysiwygInsertComponent {
|
440
|
-
/** @ignore */
|
441
437
|
constructor() {
|
442
438
|
/** @ignore */
|
443
439
|
this.service = inject(AXWysiwygService);
|
444
440
|
/** @ignore */
|
445
|
-
this.wysiwyg = signal(null);
|
446
|
-
/** @ignore */
|
447
441
|
this.textBoxOptions = {
|
448
442
|
text: '',
|
449
443
|
placeholder: 'Enter yor url ...',
|
@@ -457,13 +451,10 @@ class AXWysiwygInsertComponent {
|
|
457
451
|
offsetX: 0,
|
458
452
|
offsetY: 0,
|
459
453
|
};
|
460
|
-
afterNextRender(() => {
|
461
|
-
this.wysiwyg.set(this.service.wysiwyg());
|
462
|
-
});
|
463
454
|
}
|
464
455
|
/** @ignore */
|
465
456
|
submitLink() {
|
466
|
-
this.wysiwyg().addImage(this.textBoxOptions.text);
|
457
|
+
this.service.wysiwyg().addImage(this.textBoxOptions.text);
|
467
458
|
}
|
468
459
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXWysiwygInsertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
469
460
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: AXWysiwygInsertComponent, selector: "ax-wysiwyg-insert", ngImport: i0, template: "<ax-button #linkBtn look=\"blank\">\n <ax-icon class=\"ax-icon ax-icon-image\"></ax-icon>\n</ax-button>\n\n<ax-popover\n [openOn]=\"popoverOption.openOn\"\n [closeOn]=\"popoverOption.closeOn\"\n [target]=\"linkBtn\"\n [placement]=\"popoverOption.placement\"\n>\n <div class=\"ax-overlay-pane ax-insert-container\">\n <ax-text-box\n class=\"{{ textBoxOptions.size }}\"\n [(ngModel)]=\"textBoxOptions.text\"\n [placeholder]=\"textBoxOptions.placeholder\"\n >\n <ax-suffix>\n <ax-button (click)=\"submitLink()\" class=\"ax-sm\" color=\"secondary\" text=\"Add\"> </ax-button>\n </ax-suffix>\n </ax-text-box>\n </div>\n</ax-popover>\n", styles: [".ax-insert-container{display:flex;padding:.5rem}\n"], dependencies: [{ kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type", "responsiveOn", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "responsiveOnChange", "loadingTextChange"] }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i2.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-sub-title, ax-placeholder, ax-overlay" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.AXPopoverComponent, selector: "ax-popover", inputs: ["offsetX", "offsetY", "target", "placement", "content", "openOn", "closeOn", "hasBackdrop", "openAfter", "closeAfter", "backdropClass", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }, { kind: "component", type: i5.AXTextBoxComponent, selector: "ax-text-box", inputs: ["disabled", "tabIndex", "readonly", "value", "state", "name", "id", "placeholder", "maxLength", "allowNull", "type", "autoComplete", "look", "mask-options", "class"], outputs: ["onBlur", "onFocus", "valueChange", "stateChange", "onValueChanged", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
@@ -471,7 +462,7 @@ class AXWysiwygInsertComponent {
|
|
471
462
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXWysiwygInsertComponent, decorators: [{
|
472
463
|
type: Component,
|
473
464
|
args: [{ selector: 'ax-wysiwyg-insert', encapsulation: ViewEncapsulation.None, template: "<ax-button #linkBtn look=\"blank\">\n <ax-icon class=\"ax-icon ax-icon-image\"></ax-icon>\n</ax-button>\n\n<ax-popover\n [openOn]=\"popoverOption.openOn\"\n [closeOn]=\"popoverOption.closeOn\"\n [target]=\"linkBtn\"\n [placement]=\"popoverOption.placement\"\n>\n <div class=\"ax-overlay-pane ax-insert-container\">\n <ax-text-box\n class=\"{{ textBoxOptions.size }}\"\n [(ngModel)]=\"textBoxOptions.text\"\n [placeholder]=\"textBoxOptions.placeholder\"\n >\n <ax-suffix>\n <ax-button (click)=\"submitLink()\" class=\"ax-sm\" color=\"secondary\" text=\"Add\"> </ax-button>\n </ax-suffix>\n </ax-text-box>\n </div>\n</ax-popover>\n", styles: [".ax-insert-container{display:flex;padding:.5rem}\n"] }]
|
474
|
-
}]
|
465
|
+
}] });
|
475
466
|
|
476
467
|
/**
|
477
468
|
* A container component for WYSIWYG (What You See Is What You Get) editor functionality.
|
@@ -483,49 +474,44 @@ class AXWysiwygListComponent {
|
|
483
474
|
/** @ignore */
|
484
475
|
this.service = inject(AXWysiwygService);
|
485
476
|
/** @ignore */
|
486
|
-
this.wysiwyg = signal(null);
|
487
|
-
/** @ignore */
|
488
477
|
this.listState = signal('');
|
489
478
|
effect(() => {
|
490
|
-
if (!this.wysiwyg())
|
479
|
+
if (!this.service.wysiwyg())
|
491
480
|
return;
|
492
481
|
switch (this.service.currentSelectedElemList()) {
|
493
482
|
case 'ordered':
|
494
|
-
this.wysiwyg().list('ordered');
|
483
|
+
this.service.wysiwyg().list('ordered');
|
495
484
|
this.listState.set('ordered');
|
496
485
|
break;
|
497
486
|
case 'bullet':
|
498
|
-
this.wysiwyg().list('bullet');
|
487
|
+
this.service.wysiwyg().list('bullet');
|
499
488
|
this.listState.set('bullet');
|
500
489
|
break;
|
501
490
|
default:
|
502
|
-
this.wysiwyg().list('');
|
491
|
+
this.service.wysiwyg().list('');
|
503
492
|
this.listState.set('');
|
504
493
|
}
|
505
494
|
}, { allowSignalWrites: true });
|
506
|
-
afterNextRender(() => {
|
507
|
-
this.wysiwyg.set(this.service.wysiwyg());
|
508
|
-
});
|
509
495
|
}
|
510
496
|
/** @ignore */
|
511
497
|
orderList() {
|
512
498
|
if (!this.listState() || this.listState() === 'bullet') {
|
513
|
-
this.wysiwyg().list('ordered');
|
499
|
+
this.service.wysiwyg().list('ordered');
|
514
500
|
this.listState.set('ordered');
|
515
501
|
}
|
516
502
|
else {
|
517
|
-
this.wysiwyg().list('');
|
503
|
+
this.service.wysiwyg().list('');
|
518
504
|
this.listState.set('');
|
519
505
|
}
|
520
506
|
}
|
521
507
|
/** @ignore */
|
522
508
|
unOrderList() {
|
523
509
|
if (!this.listState() || this.listState() === 'ordered') {
|
524
|
-
this.wysiwyg().list('bullet');
|
510
|
+
this.service.wysiwyg().list('bullet');
|
525
511
|
this.listState.set('bullet');
|
526
512
|
}
|
527
513
|
else {
|
528
|
-
this.wysiwyg().list('');
|
514
|
+
this.service.wysiwyg().list('');
|
529
515
|
this.listState.set('');
|
530
516
|
}
|
531
517
|
}
|