@progress/kendo-angular-editor 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/kendo-angular-editor.umd.js +1 -1
- package/common/font-size-item.interface.d.ts +2 -2
- package/editor.component.d.ts +1 -0
- package/esm2015/config/commands.js +1 -1
- package/esm2015/editor.component.js +18 -9
- package/esm2015/package-metadata.js +1 -1
- package/esm2015/tools/fontsize/editor-fontsize.component.js +20 -10
- package/fesm2015/kendo-angular-editor.js +40 -21
- package/main.d.ts +1 -1
- package/package.json +1 -1
- package/tools/fontsize/editor-fontsize.component.d.ts +1 -0
|
@@ -10,10 +10,10 @@ export interface FontSizeItem {
|
|
|
10
10
|
* The value of the [`font-size`](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size) CSS property.
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts-no-run
|
|
13
|
-
* '
|
|
13
|
+
* '4px'
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
|
-
size: number;
|
|
16
|
+
size: number | string;
|
|
17
17
|
/**
|
|
18
18
|
* The text for the font size that will be displayed in the drop-down list.
|
|
19
19
|
* @example
|
package/editor.component.d.ts
CHANGED
|
@@ -134,6 +134,7 @@ export declare class EditorComponent implements AfterViewInit, ControlValueAcces
|
|
|
134
134
|
*/
|
|
135
135
|
stateChange: BehaviorSubject<any>;
|
|
136
136
|
get toolbar(): ToolBarComponent;
|
|
137
|
+
get toolbarElement(): ElementRef;
|
|
137
138
|
/**
|
|
138
139
|
* Returns the ProseMirror [EditorView](https://prosemirror.net/docs/ref/#view.EditorView) object
|
|
139
140
|
* that manages the DOM structure that represents an editable document.
|
|
@@ -12,7 +12,7 @@ const inlineCommand = {
|
|
|
12
12
|
cleanFormatting: (options) => cleanFormatting(options),
|
|
13
13
|
createLink: attrs => expandToWordWrap(applyLink, { mark: 'link', attrs: attrs.value, applyToWord: attrs.applyToWord }),
|
|
14
14
|
fontFamily: attrs => expandToWordWrap(applyInlineStyle, { style: 'font-family', value: attrs.value, applyToWord: attrs.applyToWord }),
|
|
15
|
-
fontSize: attrs => expandToWordWrap(applyInlineStyle, { style: 'font-size', value: attrs.value
|
|
15
|
+
fontSize: attrs => expandToWordWrap(applyInlineStyle, { style: 'font-size', value: attrs.value, applyToWord: attrs.applyToWord }),
|
|
16
16
|
insertFile: attrs => expandToWordWrap(applyLink, { mark: 'link', attrs: attrs, applyToWord: attrs.applyToWord }),
|
|
17
17
|
insertText: text => insertText(text),
|
|
18
18
|
italic: (applyToWord) => expandToWordWrap(toggleInlineFormat, Object.assign(Object.assign({}, italic), { applyToWord })),
|
|
@@ -201,7 +201,7 @@ export class EditorComponent {
|
|
|
201
201
|
this.onChangeCallback = (value) => {
|
|
202
202
|
this.changeValue(value);
|
|
203
203
|
};
|
|
204
|
-
this.onTouchedCallback = (_) => { };
|
|
204
|
+
this.onTouchedCallback = (_) => { };
|
|
205
205
|
this.onPaste = (_view, nativeEvent) => {
|
|
206
206
|
this._pasteEvent = nativeEvent;
|
|
207
207
|
return false;
|
|
@@ -382,6 +382,9 @@ export class EditorComponent {
|
|
|
382
382
|
get toolbar() {
|
|
383
383
|
return this.defaultToolbarComponent || this.userToolBarComponent;
|
|
384
384
|
}
|
|
385
|
+
get toolbarElement() {
|
|
386
|
+
return this.defaultToolbar || this.userToolBarElement;
|
|
387
|
+
}
|
|
385
388
|
/**
|
|
386
389
|
* Returns the ProseMirror [EditorView](https://prosemirror.net/docs/ref/#view.EditorView) object
|
|
387
390
|
* that manages the DOM structure that represents an editable document.
|
|
@@ -402,6 +405,7 @@ export class EditorComponent {
|
|
|
402
405
|
this.subs.add(this.toolsService.needsCheck.subscribe(() => this.cdr.markForCheck()));
|
|
403
406
|
}
|
|
404
407
|
ngAfterViewInit() {
|
|
408
|
+
var _a;
|
|
405
409
|
this.afterViewInit.next();
|
|
406
410
|
if (!this.iframe) {
|
|
407
411
|
this.contentAreaLoaded.next();
|
|
@@ -409,6 +413,13 @@ export class EditorComponent {
|
|
|
409
413
|
if (this.resizable) {
|
|
410
414
|
this.normalizeSize();
|
|
411
415
|
}
|
|
416
|
+
// address edge cases for responsive toolbar tools
|
|
417
|
+
// calculations - https://github.com/telerik/kendo-angular/issues/3661
|
|
418
|
+
if ((_a = this.toolbar) === null || _a === void 0 ? void 0 : _a.resizable) {
|
|
419
|
+
this.ngZone.runOutsideAngular(() => {
|
|
420
|
+
setTimeout(() => this.toolbar.onResize(), 70);
|
|
421
|
+
});
|
|
422
|
+
}
|
|
412
423
|
}
|
|
413
424
|
ngOnChanges(changes) {
|
|
414
425
|
if (changes.value && this.view) {
|
|
@@ -741,7 +752,7 @@ export class EditorComponent {
|
|
|
741
752
|
}));
|
|
742
753
|
this.subs.add(fromEvent(this.viewMountElement, 'keyup')
|
|
743
754
|
.pipe(map((e) => e.keyCode), filter((code) => code === 121), // F10
|
|
744
|
-
map(() => this.
|
|
755
|
+
map(() => this.toolbarElement))
|
|
745
756
|
.subscribe((toolbar) => toolbar.nativeElement.focus()));
|
|
746
757
|
this.subs.add(fromEvent(this.viewMountElement, 'blur')
|
|
747
758
|
.pipe(filter((event) => !this.viewMountElement.contains(event.relatedTarget)))
|
|
@@ -820,7 +831,7 @@ EditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
|
|
|
820
831
|
provide: KendoInput,
|
|
821
832
|
useExisting: forwardRef(() => EditorComponent)
|
|
822
833
|
}
|
|
823
|
-
], queries: [{ propertyName: "userToolBarComponent", first: true, predicate: ToolBarComponent, descendants: true }, { propertyName: "userToolBarElement", first: true, predicate: ToolBarComponent, descendants: true, read: ElementRef }], viewQueries: [{ propertyName: "dialogContainer", first: true, predicate: ["dialogsContainer"], descendants: true, read: ViewContainerRef
|
|
834
|
+
], queries: [{ propertyName: "userToolBarComponent", first: true, predicate: ToolBarComponent, descendants: true }, { propertyName: "userToolBarElement", first: true, predicate: ToolBarComponent, descendants: true, read: ElementRef }], viewQueries: [{ propertyName: "dialogContainer", first: true, predicate: ["dialogsContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "container", first: true, predicate: ["content"], descendants: true, read: ViewContainerRef }, { propertyName: "defaultToolbar", first: true, predicate: ["defaultToolbar"], descendants: true, read: ElementRef }, { propertyName: "defaultToolbarComponent", first: true, predicate: ["defaultToolbar"], descendants: true, read: ToolBarComponent }], usesOnChanges: true, ngImport: i0, template: `
|
|
824
835
|
<ng-container
|
|
825
836
|
kendoEditorLocalizedMessages
|
|
826
837
|
i18n-alignCenter="kendo.editor.alignCenter|The title of the tool that aligns text in the center."
|
|
@@ -931,7 +942,6 @@ EditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
|
|
|
931
942
|
deleteTable="Delete table"
|
|
932
943
|
>
|
|
933
944
|
</ng-container>
|
|
934
|
-
|
|
935
945
|
<ng-content select="kendo-toolbar"></ng-content>
|
|
936
946
|
<kendo-toolbar [overflow]="true" [tabindex]="readonly ? -1 : 0" *ngIf="!userToolBarElement" #defaultToolbar>
|
|
937
947
|
<kendo-toolbar-buttongroup>
|
|
@@ -1104,7 +1114,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1104
1114
|
deleteTable="Delete table"
|
|
1105
1115
|
>
|
|
1106
1116
|
</ng-container>
|
|
1107
|
-
|
|
1108
1117
|
<ng-content select="kendo-toolbar"></ng-content>
|
|
1109
1118
|
<kendo-toolbar [overflow]="true" [tabindex]="readonly ? -1 : 0" *ngIf="!userToolBarElement" #defaultToolbar>
|
|
1110
1119
|
<kendo-toolbar-buttongroup>
|
|
@@ -1225,16 +1234,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1225
1234
|
args: ['style.maxHeight']
|
|
1226
1235
|
}], userToolBarComponent: [{
|
|
1227
1236
|
type: ContentChild,
|
|
1228
|
-
args: [ToolBarComponent
|
|
1237
|
+
args: [ToolBarComponent]
|
|
1229
1238
|
}], userToolBarElement: [{
|
|
1230
1239
|
type: ContentChild,
|
|
1231
|
-
args: [ToolBarComponent, { read: ElementRef
|
|
1240
|
+
args: [ToolBarComponent, { read: ElementRef }]
|
|
1232
1241
|
}], dialogContainer: [{
|
|
1233
1242
|
type: ViewChild,
|
|
1234
|
-
args: ['dialogsContainer', { read: ViewContainerRef
|
|
1243
|
+
args: ['dialogsContainer', { read: ViewContainerRef }]
|
|
1235
1244
|
}], container: [{
|
|
1236
1245
|
type: ViewChild,
|
|
1237
|
-
args: ['content', { read: ViewContainerRef
|
|
1246
|
+
args: ['content', { read: ViewContainerRef }]
|
|
1238
1247
|
}], defaultToolbar: [{
|
|
1239
1248
|
type: ViewChild,
|
|
1240
1249
|
args: ['defaultToolbar', { read: ElementRef, static: false }]
|
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-editor',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1653579355,
|
|
13
13
|
version: '',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
15
15
|
};
|
|
@@ -38,21 +38,31 @@ export class EditorFontSizeComponent extends ToolBarToolComponent {
|
|
|
38
38
|
*/
|
|
39
39
|
this.valueChange = new EventEmitter();
|
|
40
40
|
this._data = [
|
|
41
|
-
{ text: '8px', size:
|
|
42
|
-
{ text: '10px', size:
|
|
43
|
-
{ text: '12px', size:
|
|
44
|
-
{ text: '14px', size:
|
|
45
|
-
{ text: '18px', size:
|
|
46
|
-
{ text: '24px', size:
|
|
47
|
-
{ text: '36px', size:
|
|
41
|
+
{ text: '8px', size: '8px' },
|
|
42
|
+
{ text: '10px', size: '10px' },
|
|
43
|
+
{ text: '12px', size: '12px' },
|
|
44
|
+
{ text: '14px', size: '14px' },
|
|
45
|
+
{ text: '18px', size: '18px' },
|
|
46
|
+
{ text: '24px', size: '24px' },
|
|
47
|
+
{ text: '36px', size: '36px' }
|
|
48
48
|
];
|
|
49
49
|
this.editor = providerService.editor;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Overrides the default font size list.
|
|
53
|
+
* Numeric values are treated as pixels.
|
|
53
54
|
*/
|
|
54
55
|
set data(sizes) {
|
|
55
|
-
|
|
56
|
+
let normalizedSizes;
|
|
57
|
+
if (sizes) {
|
|
58
|
+
normalizedSizes = sizes.map(s => {
|
|
59
|
+
if (typeof s.size === 'number') {
|
|
60
|
+
return Object.assign(Object.assign({}, s), { size: `${s.size}px` });
|
|
61
|
+
}
|
|
62
|
+
return s;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
this._data = normalizedSizes || this._data;
|
|
56
66
|
}
|
|
57
67
|
get data() {
|
|
58
68
|
return this._data;
|
|
@@ -73,7 +83,7 @@ export class EditorFontSizeComponent extends ToolBarToolComponent {
|
|
|
73
83
|
this.subs = this.editor.stateChange.subscribe(({ style }) => {
|
|
74
84
|
// remove units(px, em, rem...)
|
|
75
85
|
// string#match returns array
|
|
76
|
-
this.value =
|
|
86
|
+
this.value = getUniqueStyleValues(style.selected, 'font-size') || null;
|
|
77
87
|
this.disabled = style.disabled;
|
|
78
88
|
});
|
|
79
89
|
}
|
|
@@ -84,7 +94,7 @@ export class EditorFontSizeComponent extends ToolBarToolComponent {
|
|
|
84
94
|
if (isPresent(ev)) {
|
|
85
95
|
this.editor.exec('fontSize', ev);
|
|
86
96
|
this.editor.view.focus();
|
|
87
|
-
this.valueChange.emit(this.data.find(d => d.size ===
|
|
97
|
+
this.valueChange.emit(this.data.find(d => d.size === ev));
|
|
88
98
|
}
|
|
89
99
|
}
|
|
90
100
|
ngOnDestroy() {
|
|
@@ -35,7 +35,7 @@ const packageMetadata = {
|
|
|
35
35
|
name: '@progress/kendo-angular-editor',
|
|
36
36
|
productName: 'Kendo UI for Angular',
|
|
37
37
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
38
|
-
publishDate:
|
|
38
|
+
publishDate: 1653579355,
|
|
39
39
|
version: '',
|
|
40
40
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
41
41
|
};
|
|
@@ -179,7 +179,7 @@ const inlineCommand = {
|
|
|
179
179
|
cleanFormatting: (options) => cleanFormatting(options),
|
|
180
180
|
createLink: attrs => expandToWordWrap(applyLink, { mark: 'link', attrs: attrs.value, applyToWord: attrs.applyToWord }),
|
|
181
181
|
fontFamily: attrs => expandToWordWrap(applyInlineStyle, { style: 'font-family', value: attrs.value, applyToWord: attrs.applyToWord }),
|
|
182
|
-
fontSize: attrs => expandToWordWrap(applyInlineStyle, { style: 'font-size', value: attrs.value
|
|
182
|
+
fontSize: attrs => expandToWordWrap(applyInlineStyle, { style: 'font-size', value: attrs.value, applyToWord: attrs.applyToWord }),
|
|
183
183
|
insertFile: attrs => expandToWordWrap(applyLink, { mark: 'link', attrs: attrs, applyToWord: attrs.applyToWord }),
|
|
184
184
|
insertText: text => insertText(text),
|
|
185
185
|
italic: (applyToWord) => expandToWordWrap(toggleInlineFormat, Object.assign(Object.assign({}, italic), { applyToWord })),
|
|
@@ -2823,7 +2823,7 @@ class EditorComponent {
|
|
|
2823
2823
|
this.onChangeCallback = (value) => {
|
|
2824
2824
|
this.changeValue(value);
|
|
2825
2825
|
};
|
|
2826
|
-
this.onTouchedCallback = (_) => { };
|
|
2826
|
+
this.onTouchedCallback = (_) => { };
|
|
2827
2827
|
this.onPaste = (_view, nativeEvent) => {
|
|
2828
2828
|
this._pasteEvent = nativeEvent;
|
|
2829
2829
|
return false;
|
|
@@ -3004,6 +3004,9 @@ class EditorComponent {
|
|
|
3004
3004
|
get toolbar() {
|
|
3005
3005
|
return this.defaultToolbarComponent || this.userToolBarComponent;
|
|
3006
3006
|
}
|
|
3007
|
+
get toolbarElement() {
|
|
3008
|
+
return this.defaultToolbar || this.userToolBarElement;
|
|
3009
|
+
}
|
|
3007
3010
|
/**
|
|
3008
3011
|
* Returns the ProseMirror [EditorView](https://prosemirror.net/docs/ref/#view.EditorView) object
|
|
3009
3012
|
* that manages the DOM structure that represents an editable document.
|
|
@@ -3024,6 +3027,7 @@ class EditorComponent {
|
|
|
3024
3027
|
this.subs.add(this.toolsService.needsCheck.subscribe(() => this.cdr.markForCheck()));
|
|
3025
3028
|
}
|
|
3026
3029
|
ngAfterViewInit() {
|
|
3030
|
+
var _a;
|
|
3027
3031
|
this.afterViewInit.next();
|
|
3028
3032
|
if (!this.iframe) {
|
|
3029
3033
|
this.contentAreaLoaded.next();
|
|
@@ -3031,6 +3035,13 @@ class EditorComponent {
|
|
|
3031
3035
|
if (this.resizable) {
|
|
3032
3036
|
this.normalizeSize();
|
|
3033
3037
|
}
|
|
3038
|
+
// address edge cases for responsive toolbar tools
|
|
3039
|
+
// calculations - https://github.com/telerik/kendo-angular/issues/3661
|
|
3040
|
+
if ((_a = this.toolbar) === null || _a === void 0 ? void 0 : _a.resizable) {
|
|
3041
|
+
this.ngZone.runOutsideAngular(() => {
|
|
3042
|
+
setTimeout(() => this.toolbar.onResize(), 70);
|
|
3043
|
+
});
|
|
3044
|
+
}
|
|
3034
3045
|
}
|
|
3035
3046
|
ngOnChanges(changes) {
|
|
3036
3047
|
if (changes.value && this.view) {
|
|
@@ -3363,7 +3374,7 @@ class EditorComponent {
|
|
|
3363
3374
|
}));
|
|
3364
3375
|
this.subs.add(fromEvent(this.viewMountElement, 'keyup')
|
|
3365
3376
|
.pipe(map((e) => e.keyCode), filter$1((code) => code === 121), // F10
|
|
3366
|
-
map(() => this.
|
|
3377
|
+
map(() => this.toolbarElement))
|
|
3367
3378
|
.subscribe((toolbar) => toolbar.nativeElement.focus()));
|
|
3368
3379
|
this.subs.add(fromEvent(this.viewMountElement, 'blur')
|
|
3369
3380
|
.pipe(filter$1((event) => !this.viewMountElement.contains(event.relatedTarget)))
|
|
@@ -3442,7 +3453,7 @@ EditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
|
|
|
3442
3453
|
provide: KendoInput,
|
|
3443
3454
|
useExisting: forwardRef(() => EditorComponent)
|
|
3444
3455
|
}
|
|
3445
|
-
], queries: [{ propertyName: "userToolBarComponent", first: true, predicate: ToolBarComponent, descendants: true }, { propertyName: "userToolBarElement", first: true, predicate: ToolBarComponent, descendants: true, read: ElementRef }], viewQueries: [{ propertyName: "dialogContainer", first: true, predicate: ["dialogsContainer"], descendants: true, read: ViewContainerRef
|
|
3456
|
+
], queries: [{ propertyName: "userToolBarComponent", first: true, predicate: ToolBarComponent, descendants: true }, { propertyName: "userToolBarElement", first: true, predicate: ToolBarComponent, descendants: true, read: ElementRef }], viewQueries: [{ propertyName: "dialogContainer", first: true, predicate: ["dialogsContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "container", first: true, predicate: ["content"], descendants: true, read: ViewContainerRef }, { propertyName: "defaultToolbar", first: true, predicate: ["defaultToolbar"], descendants: true, read: ElementRef }, { propertyName: "defaultToolbarComponent", first: true, predicate: ["defaultToolbar"], descendants: true, read: ToolBarComponent }], usesOnChanges: true, ngImport: i0, template: `
|
|
3446
3457
|
<ng-container
|
|
3447
3458
|
kendoEditorLocalizedMessages
|
|
3448
3459
|
i18n-alignCenter="kendo.editor.alignCenter|The title of the tool that aligns text in the center."
|
|
@@ -3553,7 +3564,6 @@ EditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
|
|
|
3553
3564
|
deleteTable="Delete table"
|
|
3554
3565
|
>
|
|
3555
3566
|
</ng-container>
|
|
3556
|
-
|
|
3557
3567
|
<ng-content select="kendo-toolbar"></ng-content>
|
|
3558
3568
|
<kendo-toolbar [overflow]="true" [tabindex]="readonly ? -1 : 0" *ngIf="!userToolBarElement" #defaultToolbar>
|
|
3559
3569
|
<kendo-toolbar-buttongroup>
|
|
@@ -3726,7 +3736,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
3726
3736
|
deleteTable="Delete table"
|
|
3727
3737
|
>
|
|
3728
3738
|
</ng-container>
|
|
3729
|
-
|
|
3730
3739
|
<ng-content select="kendo-toolbar"></ng-content>
|
|
3731
3740
|
<kendo-toolbar [overflow]="true" [tabindex]="readonly ? -1 : 0" *ngIf="!userToolBarElement" #defaultToolbar>
|
|
3732
3741
|
<kendo-toolbar-buttongroup>
|
|
@@ -3847,16 +3856,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
3847
3856
|
args: ['style.maxHeight']
|
|
3848
3857
|
}], userToolBarComponent: [{
|
|
3849
3858
|
type: ContentChild,
|
|
3850
|
-
args: [ToolBarComponent
|
|
3859
|
+
args: [ToolBarComponent]
|
|
3851
3860
|
}], userToolBarElement: [{
|
|
3852
3861
|
type: ContentChild,
|
|
3853
|
-
args: [ToolBarComponent, { read: ElementRef
|
|
3862
|
+
args: [ToolBarComponent, { read: ElementRef }]
|
|
3854
3863
|
}], dialogContainer: [{
|
|
3855
3864
|
type: ViewChild,
|
|
3856
|
-
args: ['dialogsContainer', { read: ViewContainerRef
|
|
3865
|
+
args: ['dialogsContainer', { read: ViewContainerRef }]
|
|
3857
3866
|
}], container: [{
|
|
3858
3867
|
type: ViewChild,
|
|
3859
|
-
args: ['content', { read: ViewContainerRef
|
|
3868
|
+
args: ['content', { read: ViewContainerRef }]
|
|
3860
3869
|
}], defaultToolbar: [{
|
|
3861
3870
|
type: ViewChild,
|
|
3862
3871
|
args: ['defaultToolbar', { read: ElementRef, static: false }]
|
|
@@ -4512,21 +4521,31 @@ class EditorFontSizeComponent extends ToolBarToolComponent {
|
|
|
4512
4521
|
*/
|
|
4513
4522
|
this.valueChange = new EventEmitter();
|
|
4514
4523
|
this._data = [
|
|
4515
|
-
{ text: '8px', size:
|
|
4516
|
-
{ text: '10px', size:
|
|
4517
|
-
{ text: '12px', size:
|
|
4518
|
-
{ text: '14px', size:
|
|
4519
|
-
{ text: '18px', size:
|
|
4520
|
-
{ text: '24px', size:
|
|
4521
|
-
{ text: '36px', size:
|
|
4524
|
+
{ text: '8px', size: '8px' },
|
|
4525
|
+
{ text: '10px', size: '10px' },
|
|
4526
|
+
{ text: '12px', size: '12px' },
|
|
4527
|
+
{ text: '14px', size: '14px' },
|
|
4528
|
+
{ text: '18px', size: '18px' },
|
|
4529
|
+
{ text: '24px', size: '24px' },
|
|
4530
|
+
{ text: '36px', size: '36px' }
|
|
4522
4531
|
];
|
|
4523
4532
|
this.editor = providerService.editor;
|
|
4524
4533
|
}
|
|
4525
4534
|
/**
|
|
4526
4535
|
* Overrides the default font size list.
|
|
4536
|
+
* Numeric values are treated as pixels.
|
|
4527
4537
|
*/
|
|
4528
4538
|
set data(sizes) {
|
|
4529
|
-
|
|
4539
|
+
let normalizedSizes;
|
|
4540
|
+
if (sizes) {
|
|
4541
|
+
normalizedSizes = sizes.map(s => {
|
|
4542
|
+
if (typeof s.size === 'number') {
|
|
4543
|
+
return Object.assign(Object.assign({}, s), { size: `${s.size}px` });
|
|
4544
|
+
}
|
|
4545
|
+
return s;
|
|
4546
|
+
});
|
|
4547
|
+
}
|
|
4548
|
+
this._data = normalizedSizes || this._data;
|
|
4530
4549
|
}
|
|
4531
4550
|
get data() {
|
|
4532
4551
|
return this._data;
|
|
@@ -4547,7 +4566,7 @@ class EditorFontSizeComponent extends ToolBarToolComponent {
|
|
|
4547
4566
|
this.subs = this.editor.stateChange.subscribe(({ style }) => {
|
|
4548
4567
|
// remove units(px, em, rem...)
|
|
4549
4568
|
// string#match returns array
|
|
4550
|
-
this.value =
|
|
4569
|
+
this.value = getUniqueStyleValues(style.selected, 'font-size') || null;
|
|
4551
4570
|
this.disabled = style.disabled;
|
|
4552
4571
|
});
|
|
4553
4572
|
}
|
|
@@ -4558,7 +4577,7 @@ class EditorFontSizeComponent extends ToolBarToolComponent {
|
|
|
4558
4577
|
if (isPresent(ev)) {
|
|
4559
4578
|
this.editor.exec('fontSize', ev);
|
|
4560
4579
|
this.editor.view.focus();
|
|
4561
|
-
this.valueChange.emit(this.data.find(d => d.size ===
|
|
4580
|
+
this.valueChange.emit(this.data.find(d => d.size === ev));
|
|
4562
4581
|
}
|
|
4563
4582
|
}
|
|
4564
4583
|
ngOnDestroy() {
|
package/main.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export { EditorComponent } from './editor.component';
|
|
6
6
|
export { EditorModule } from './editor.module';
|
|
7
7
|
export { schema, Schema } from './config/schema';
|
|
8
|
-
export { EditorState, Plugin, PluginKey, Transaction, EditorView, Decoration, DecorationSet, NodeType, Node, MarkType, Mark, InputRule, inputRules, wrappingInputRule, textblockTypeInputRule, keymap, baseKeymap, history, dropCursor, gapCursor, tableNodes } from '@progress/kendo-editor-common';
|
|
8
|
+
export { EditorState, Plugin, PluginKey, Transaction, EditorView, Decoration, DecorationSet, NodeType, Node, MarkType, Mark, InputRule, inputRules, wrappingInputRule, textblockTypeInputRule, keymap, baseKeymap, history, dropCursor, gapCursor, tableNodes, NodeSpec, MarkSpec } from '@progress/kendo-editor-common';
|
|
9
9
|
export { getSelectionText } from './util';
|
|
10
10
|
export { PluginsFn } from './common/plugins-function';
|
|
11
11
|
export { ApplyToWordOptions } from './common/apply-to-word-options';
|
package/package.json
CHANGED
|
@@ -32,6 +32,7 @@ export declare class EditorFontSizeComponent extends ToolBarToolComponent {
|
|
|
32
32
|
tabindex: number;
|
|
33
33
|
/**
|
|
34
34
|
* Overrides the default font size list.
|
|
35
|
+
* Numeric values are treated as pixels.
|
|
35
36
|
*/
|
|
36
37
|
set data(sizes: FontSizeItem[]);
|
|
37
38
|
get data(): FontSizeItem[];
|