@progress/kendo-angular-editor 4.0.1-dev.202205191407 → 4.1.0-dev.202205251353

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.
@@ -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
- * '4'
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
@@ -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 + 'px', applyToWord: attrs.applyToWord }),
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 })),
@@ -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: 1652969231,
12
+ publishDate: 1653486755,
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: 8 },
42
- { text: '10px', size: 10 },
43
- { text: '12px', size: 12 },
44
- { text: '14px', size: 14 },
45
- { text: '18px', size: 18 },
46
- { text: '24px', size: 24 },
47
- { text: '36px', size: 36 }
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
- this._data = sizes || this._data;
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 = (getUniqueStyleValues(style.selected, 'font-size').match(/\d+/g) || [null])[0];
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 === parseInt(ev, 10)));
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: 1652969231,
38
+ publishDate: 1653486755,
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 + 'px', applyToWord: attrs.applyToWord }),
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 })),
@@ -4521,21 +4521,31 @@ class EditorFontSizeComponent extends ToolBarToolComponent {
4521
4521
  */
4522
4522
  this.valueChange = new EventEmitter();
4523
4523
  this._data = [
4524
- { text: '8px', size: 8 },
4525
- { text: '10px', size: 10 },
4526
- { text: '12px', size: 12 },
4527
- { text: '14px', size: 14 },
4528
- { text: '18px', size: 18 },
4529
- { text: '24px', size: 24 },
4530
- { text: '36px', size: 36 }
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' }
4531
4531
  ];
4532
4532
  this.editor = providerService.editor;
4533
4533
  }
4534
4534
  /**
4535
4535
  * Overrides the default font size list.
4536
+ * Numeric values are treated as pixels.
4536
4537
  */
4537
4538
  set data(sizes) {
4538
- this._data = sizes || this._data;
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;
4539
4549
  }
4540
4550
  get data() {
4541
4551
  return this._data;
@@ -4556,7 +4566,7 @@ class EditorFontSizeComponent extends ToolBarToolComponent {
4556
4566
  this.subs = this.editor.stateChange.subscribe(({ style }) => {
4557
4567
  // remove units(px, em, rem...)
4558
4568
  // string#match returns array
4559
- this.value = (getUniqueStyleValues(style.selected, 'font-size').match(/\d+/g) || [null])[0];
4569
+ this.value = getUniqueStyleValues(style.selected, 'font-size') || null;
4560
4570
  this.disabled = style.disabled;
4561
4571
  });
4562
4572
  }
@@ -4567,7 +4577,7 @@ class EditorFontSizeComponent extends ToolBarToolComponent {
4567
4577
  if (isPresent(ev)) {
4568
4578
  this.editor.exec('fontSize', ev);
4569
4579
  this.editor.view.focus();
4570
- this.valueChange.emit(this.data.find(d => d.size === parseInt(ev, 10)));
4580
+ this.valueChange.emit(this.data.find(d => d.size === ev));
4571
4581
  }
4572
4582
  }
4573
4583
  ngOnDestroy() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-angular-editor",
3
- "version": "4.0.1-dev.202205191407",
3
+ "version": "4.1.0-dev.202205251353",
4
4
  "description": "Kendo UI Editor for Angular",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -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[];