@progress/kendo-angular-editor 2.4.0-dev.202110211018 → 2.4.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.
Files changed (33) hide show
  1. package/dist/cdn/js/kendo-angular-editor.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/editor.component.js +58 -5
  4. package/dist/es/package-metadata.js +1 -1
  5. package/dist/es/tools/colorpicker/editor-colorpicker.component.js +3 -1
  6. package/dist/es/tools/fontfamily/editor-fontfamily.component.js +3 -1
  7. package/dist/es/tools/fontsize/editor-fontsize.component.js +3 -1
  8. package/dist/es/tools/format/editor-format.component.js +3 -1
  9. package/dist/es/tools/shared/editor-command-base.js +3 -1
  10. package/dist/es/tools/tables/editor-insert-table-button.component.js +5 -3
  11. package/dist/es2015/common/resizable-options.interface.d.ts +8 -8
  12. package/dist/es2015/editor.component.d.ts +3 -0
  13. package/dist/es2015/editor.component.js +57 -5
  14. package/dist/es2015/index.metadata.json +1 -1
  15. package/dist/es2015/package-metadata.js +1 -1
  16. package/dist/es2015/tools/colorpicker/editor-colorpicker.component.js +3 -1
  17. package/dist/es2015/tools/fontfamily/editor-fontfamily.component.js +3 -1
  18. package/dist/es2015/tools/fontsize/editor-fontsize.component.js +3 -1
  19. package/dist/es2015/tools/format/editor-format.component.js +3 -1
  20. package/dist/es2015/tools/shared/editor-command-base.js +3 -1
  21. package/dist/es2015/tools/tables/editor-insert-table-button.component.js +5 -3
  22. package/dist/fesm2015/index.js +78 -14
  23. package/dist/fesm5/index.js +79 -14
  24. package/dist/npm/editor.component.js +58 -5
  25. package/dist/npm/package-metadata.js +1 -1
  26. package/dist/npm/tools/colorpicker/editor-colorpicker.component.js +3 -1
  27. package/dist/npm/tools/fontfamily/editor-fontfamily.component.js +3 -1
  28. package/dist/npm/tools/fontsize/editor-fontsize.component.js +3 -1
  29. package/dist/npm/tools/format/editor-format.component.js +3 -1
  30. package/dist/npm/tools/shared/editor-command-base.js +3 -1
  31. package/dist/npm/tools/tables/editor-insert-table-button.component.js +5 -3
  32. package/dist/systemjs/kendo-angular-editor.js +1 -1
  33. package/package.json +5 -5
@@ -344,7 +344,7 @@ var EditorComponent = /** @class */ (function () {
344
344
  Object.defineProperty(EditorComponent.prototype, "minWidth", {
345
345
  get: function () {
346
346
  var resizableOptions = this.resizable;
347
- return resizableOptions.minWidth;
347
+ return resizableOptions.minWidth ? resizableOptions.minWidth + 'px' : undefined;
348
348
  },
349
349
  enumerable: true,
350
350
  configurable: true
@@ -352,7 +352,7 @@ var EditorComponent = /** @class */ (function () {
352
352
  Object.defineProperty(EditorComponent.prototype, "maxWidth", {
353
353
  get: function () {
354
354
  var resizableOptions = this.resizable;
355
- return resizableOptions.maxWidth;
355
+ return resizableOptions.maxWidth ? resizableOptions.maxWidth + 'px' : undefined;
356
356
  },
357
357
  enumerable: true,
358
358
  configurable: true
@@ -360,7 +360,7 @@ var EditorComponent = /** @class */ (function () {
360
360
  Object.defineProperty(EditorComponent.prototype, "minHeight", {
361
361
  get: function () {
362
362
  var resizableOptions = this.resizable;
363
- return resizableOptions.minHeight;
363
+ return resizableOptions.minHeight ? resizableOptions.minHeight + 'px' : undefined;
364
364
  },
365
365
  enumerable: true,
366
366
  configurable: true
@@ -368,7 +368,7 @@ var EditorComponent = /** @class */ (function () {
368
368
  Object.defineProperty(EditorComponent.prototype, "maxHeight", {
369
369
  get: function () {
370
370
  var resizableOptions = this.resizable;
371
- return resizableOptions.maxHeight;
371
+ return resizableOptions.maxHeight ? resizableOptions.maxHeight + 'px' : undefined;
372
372
  },
373
373
  enumerable: true,
374
374
  configurable: true
@@ -413,12 +413,18 @@ var EditorComponent = /** @class */ (function () {
413
413
  if (!this.iframe) {
414
414
  this.contentAreaLoaded.next();
415
415
  }
416
+ if (this.resizable) {
417
+ this.normalizeSize();
418
+ }
416
419
  };
417
420
  EditorComponent.prototype.ngOnChanges = function (changes) {
418
421
  var _this = this;
419
422
  if (changes.iframe && !changes.iframe.isFirstChange()) {
420
423
  this.ngZone.onStable.pipe(take(1)).subscribe(function () { return _this.initialize(); });
421
424
  }
425
+ if (changes.resizable && !changes.resizable.isFirstChange()) {
426
+ this.normalizeSize();
427
+ }
422
428
  };
423
429
  /**
424
430
  * @hidden
@@ -574,7 +580,12 @@ var EditorComponent = /** @class */ (function () {
574
580
  return getHtml(this._view.state);
575
581
  };
576
582
  EditorComponent.prototype.ngOnDestroy = function () {
577
- this.subs.unsubscribe();
583
+ if (this.subs) {
584
+ this.subs.unsubscribe();
585
+ }
586
+ if (this._styleObserver) {
587
+ this._styleObserver.disconnect();
588
+ }
578
589
  };
579
590
  /**
580
591
  * @hidden
@@ -755,6 +766,48 @@ var EditorComponent = /** @class */ (function () {
755
766
  .pipe(filter(function (event) { return !_this.viewMountElement.contains(event.relatedTarget); }))
756
767
  .subscribe(function () { return _this.onTouchedCallback(); }));
757
768
  };
769
+ EditorComponent.prototype.normalizeSize = function () {
770
+ var _this = this;
771
+ if (typeof this.resizable === 'object' && !this._styleObserver) {
772
+ var element_1 = this.element.nativeElement;
773
+ this._styleObserver = new MutationObserver(function () {
774
+ _this.ngZone.runOutsideAngular(function () { return _this.normalizeProperties(element_1); });
775
+ });
776
+ this._styleObserver.observe(element_1, { attributeFilter: ['style'] });
777
+ }
778
+ };
779
+ EditorComponent.prototype.normalizeProperties = function (element) {
780
+ var props = Object.keys(this.resizable);
781
+ var pixelWidth = parseInt(element.style.width, 10);
782
+ var pixelHeight = parseInt(element.style.height, 10);
783
+ var resizable = this.resizable;
784
+ props.forEach(function (prop) {
785
+ var isMinProp = prop.startsWith('min');
786
+ var isMaxProp = !isMinProp;
787
+ var isWidthProp = prop.endsWith('Width');
788
+ var isHeightProp = !isWidthProp;
789
+ if (isMinProp && isWidthProp) {
790
+ if (pixelWidth < resizable.minWidth) {
791
+ element.style.width = resizable.minWidth + 'px';
792
+ }
793
+ }
794
+ else if (isMinProp && isHeightProp) {
795
+ if (pixelHeight < resizable.minHeight) {
796
+ element.style.height = resizable.minHeight + 'px';
797
+ }
798
+ }
799
+ else if (isMaxProp && isWidthProp) {
800
+ if (pixelWidth > resizable.maxWidth) {
801
+ element.style.width = resizable.maxWidth + 'px';
802
+ }
803
+ }
804
+ else {
805
+ if (pixelHeight > resizable.maxHeight) {
806
+ element.style.height = resizable.maxHeight + 'px';
807
+ }
808
+ }
809
+ });
810
+ };
758
811
  var EditorComponent_1;
759
812
  tslib_1.__decorate([
760
813
  Input(),
@@ -9,7 +9,7 @@ export var packageMetadata = {
9
9
  name: '@progress/kendo-angular-editor',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1634811283,
12
+ publishDate: 1635407911,
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
  };
@@ -58,7 +58,9 @@ var EditorColorPickerComponent = /** @class */ (function (_super) {
58
58
  });
59
59
  };
60
60
  EditorColorPickerComponent.prototype.ngOnDestroy = function () {
61
- this.subs.unsubscribe();
61
+ if (this.subs) {
62
+ this.subs.unsubscribe();
63
+ }
62
64
  };
63
65
  /**
64
66
  * @hidden
@@ -95,7 +95,9 @@ var EditorFontFamilyComponent = /** @class */ (function (_super) {
95
95
  }
96
96
  };
97
97
  EditorFontFamilyComponent.prototype.ngOnDestroy = function () {
98
- this.subs.unsubscribe();
98
+ if (this.subs) {
99
+ this.subs.unsubscribe();
100
+ }
99
101
  };
100
102
  Object.defineProperty(EditorFontFamilyComponent.prototype, "outerWidth", {
101
103
  get: function () {
@@ -90,7 +90,9 @@ var EditorFontSizeComponent = /** @class */ (function (_super) {
90
90
  }
91
91
  };
92
92
  EditorFontSizeComponent.prototype.ngOnDestroy = function () {
93
- this.subs.unsubscribe();
93
+ if (this.subs) {
94
+ this.subs.unsubscribe();
95
+ }
94
96
  };
95
97
  Object.defineProperty(EditorFontSizeComponent.prototype, "outerWidth", {
96
98
  get: function () {
@@ -90,7 +90,9 @@ var EditorFormatComponent = /** @class */ (function (_super) {
90
90
  }
91
91
  };
92
92
  EditorFormatComponent.prototype.ngOnDestroy = function () {
93
- this.subs.unsubscribe();
93
+ if (this.subs) {
94
+ this.subs.unsubscribe();
95
+ }
94
96
  };
95
97
  Object.defineProperty(EditorFormatComponent.prototype, "outerWidth", {
96
98
  get: function () {
@@ -32,7 +32,9 @@ var EditorCommandBase = /** @class */ (function () {
32
32
  });
33
33
  };
34
34
  EditorCommandBase.prototype.ngOnDestroy = function () {
35
- this.subs.unsubscribe();
35
+ if (this.subs) {
36
+ this.subs.unsubscribe();
37
+ }
36
38
  };
37
39
  // tslint:disable-next-line
38
40
  EditorCommandBase.prototype.clickHandler = function () { };
@@ -39,9 +39,9 @@ var EditorInsertTableButtonComponent = /** @class */ (function (_super) {
39
39
  var insertTable = _a.insertTable;
40
40
  _this.disabled = insertTable.disabled;
41
41
  });
42
- _this.subs = _this.buttonBlurred.pipe(concatMap(function () { return interval(200).pipe(take(1), takeUntil(_this.cellClicked)); })).subscribe(function () {
42
+ _this.subs.add(_this.buttonBlurred.pipe(concatMap(function () { return interval(200).pipe(take(1), takeUntil(_this.cellClicked)); })).subscribe(function () {
43
43
  _this.toggle(false);
44
- });
44
+ }));
45
45
  return _this;
46
46
  }
47
47
  EditorInsertTableButtonComponent_1 = EditorInsertTableButtonComponent;
@@ -50,7 +50,9 @@ var EditorInsertTableButtonComponent = /** @class */ (function (_super) {
50
50
  };
51
51
  EditorInsertTableButtonComponent.prototype.ngOnDestroy = function () {
52
52
  this.destroyPopup();
53
- this.subs.unsubscribe();
53
+ if (this.subs) {
54
+ this.subs.unsubscribe();
55
+ }
54
56
  };
55
57
  Object.defineProperty(EditorInsertTableButtonComponent.prototype, "outerWidth", {
56
58
  get: function () {
@@ -7,19 +7,19 @@
7
7
  */
8
8
  export interface EditorResizableOptions {
9
9
  /**
10
- * The value of the [CSS `min-width` property](https://developer.mozilla.org/en-US/docs/Web/CSS/min-width) that will be applied to the Editor wrapper element.
10
+ * Specifies the minimum width of the resizable Editor in pixels.
11
11
  */
12
- minWidth?: string;
12
+ minWidth?: number;
13
13
  /**
14
- * The value of the [CSS `min-height` property](https://developer.mozilla.org/en-US/docs/Web/CSS/min-height) that will be applied to the Editor wrapper element.
14
+ * Specifies the minimum height of the resizable Editor in pixels.
15
15
  */
16
- minHeight?: string;
16
+ minHeight?: number;
17
17
  /**
18
- * The value of the [CSS `max-width` property](https://developer.mozilla.org/en-US/docs/Web/CSS/max-width) that will be applied to the Editor wrapper element.
18
+ * Specifies the maximum width of the resizable Editor in pixels.
19
19
  */
20
- maxWidth?: string;
20
+ maxWidth?: number;
21
21
  /**
22
- * The value of the [CSS `max-height` property](https://developer.mozilla.org/en-US/docs/Web/CSS/max-height) that will be applied to the Editor wrapper element.
22
+ * Specifies the maximum height of the resizable Editor in pixels.
23
23
  */
24
- maxHeight?: string;
24
+ maxHeight?: number;
25
25
  }
@@ -158,6 +158,7 @@ export declare class EditorComponent implements AfterViewInit, ControlValueAcces
158
158
  private _schema;
159
159
  private _plugins;
160
160
  private _placeholder;
161
+ private _styleObserver;
161
162
  private afterViewInit;
162
163
  private contentAreaLoaded;
163
164
  constructor(dialogService: DialogService, localization: LocalizationService, cdr: ChangeDetectorRef, ngZone: NgZone, element: ElementRef);
@@ -271,6 +272,8 @@ export declare class EditorComponent implements AfterViewInit, ControlValueAcces
271
272
  */
272
273
  isEmpty(): boolean;
273
274
  private initialize;
275
+ private normalizeSize;
276
+ private normalizeProperties;
274
277
  private onChangeCallback;
275
278
  private onTouchedCallback;
276
279
  }
@@ -291,19 +291,19 @@ let EditorComponent = EditorComponent_1 = class EditorComponent {
291
291
  }
292
292
  get minWidth() {
293
293
  const resizableOptions = this.resizable;
294
- return resizableOptions.minWidth;
294
+ return resizableOptions.minWidth ? resizableOptions.minWidth + 'px' : undefined;
295
295
  }
296
296
  get maxWidth() {
297
297
  const resizableOptions = this.resizable;
298
- return resizableOptions.maxWidth;
298
+ return resizableOptions.maxWidth ? resizableOptions.maxWidth + 'px' : undefined;
299
299
  }
300
300
  get minHeight() {
301
301
  const resizableOptions = this.resizable;
302
- return resizableOptions.minHeight;
302
+ return resizableOptions.minHeight ? resizableOptions.minHeight + 'px' : undefined;
303
303
  }
304
304
  get maxHeight() {
305
305
  const resizableOptions = this.resizable;
306
- return resizableOptions.maxHeight;
306
+ return resizableOptions.maxHeight ? resizableOptions.maxHeight + 'px' : undefined;
307
307
  }
308
308
  get toolbar() {
309
309
  return this.defaultToolbarComponent || this.userToolBarComponent;
@@ -331,11 +331,17 @@ let EditorComponent = EditorComponent_1 = class EditorComponent {
331
331
  if (!this.iframe) {
332
332
  this.contentAreaLoaded.next();
333
333
  }
334
+ if (this.resizable) {
335
+ this.normalizeSize();
336
+ }
334
337
  }
335
338
  ngOnChanges(changes) {
336
339
  if (changes.iframe && !changes.iframe.isFirstChange()) {
337
340
  this.ngZone.onStable.pipe(take(1)).subscribe(() => this.initialize());
338
341
  }
342
+ if (changes.resizable && !changes.resizable.isFirstChange()) {
343
+ this.normalizeSize();
344
+ }
339
345
  }
340
346
  /**
341
347
  * @hidden
@@ -491,7 +497,12 @@ let EditorComponent = EditorComponent_1 = class EditorComponent {
491
497
  return getHtml(this._view.state);
492
498
  }
493
499
  ngOnDestroy() {
494
- this.subs.unsubscribe();
500
+ if (this.subs) {
501
+ this.subs.unsubscribe();
502
+ }
503
+ if (this._styleObserver) {
504
+ this._styleObserver.disconnect();
505
+ }
495
506
  }
496
507
  /**
497
508
  * @hidden
@@ -671,6 +682,47 @@ let EditorComponent = EditorComponent_1 = class EditorComponent {
671
682
  .pipe(filter((event) => !this.viewMountElement.contains(event.relatedTarget)))
672
683
  .subscribe(() => this.onTouchedCallback()));
673
684
  }
685
+ normalizeSize() {
686
+ if (typeof this.resizable === 'object' && !this._styleObserver) {
687
+ const element = this.element.nativeElement;
688
+ this._styleObserver = new MutationObserver(() => {
689
+ this.ngZone.runOutsideAngular(() => this.normalizeProperties(element));
690
+ });
691
+ this._styleObserver.observe(element, { attributeFilter: ['style'] });
692
+ }
693
+ }
694
+ normalizeProperties(element) {
695
+ const props = Object.keys(this.resizable);
696
+ const pixelWidth = parseInt(element.style.width, 10);
697
+ const pixelHeight = parseInt(element.style.height, 10);
698
+ const resizable = this.resizable;
699
+ props.forEach(prop => {
700
+ const isMinProp = prop.startsWith('min');
701
+ const isMaxProp = !isMinProp;
702
+ const isWidthProp = prop.endsWith('Width');
703
+ const isHeightProp = !isWidthProp;
704
+ if (isMinProp && isWidthProp) {
705
+ if (pixelWidth < resizable.minWidth) {
706
+ element.style.width = resizable.minWidth + 'px';
707
+ }
708
+ }
709
+ else if (isMinProp && isHeightProp) {
710
+ if (pixelHeight < resizable.minHeight) {
711
+ element.style.height = resizable.minHeight + 'px';
712
+ }
713
+ }
714
+ else if (isMaxProp && isWidthProp) {
715
+ if (pixelWidth > resizable.maxWidth) {
716
+ element.style.width = resizable.maxWidth + 'px';
717
+ }
718
+ }
719
+ else {
720
+ if (pixelHeight > resizable.maxHeight) {
721
+ element.style.height = resizable.maxHeight + 'px';
722
+ }
723
+ }
724
+ });
725
+ }
674
726
  };
675
727
  tslib_1.__decorate([
676
728
  Input(),