@progress/kendo-angular-editor 2.4.1-dev.202110221203 → 2.4.1-dev.202110261541

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.
@@ -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
@@ -577,6 +583,9 @@ var EditorComponent = /** @class */ (function () {
577
583
  if (this.subs) {
578
584
  this.subs.unsubscribe();
579
585
  }
586
+ if (this._styleObserver) {
587
+ this._styleObserver.disconnect();
588
+ }
580
589
  };
581
590
  /**
582
591
  * @hidden
@@ -757,6 +766,48 @@ var EditorComponent = /** @class */ (function () {
757
766
  .pipe(filter(function (event) { return !_this.viewMountElement.contains(event.relatedTarget); }))
758
767
  .subscribe(function () { return _this.onTouchedCallback(); }));
759
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
+ };
760
811
  var EditorComponent_1;
761
812
  tslib_1.__decorate([
762
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: 1634903968,
12
+ publishDate: 1635262687,
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
  };
@@ -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
@@ -494,6 +500,9 @@ let EditorComponent = EditorComponent_1 = class EditorComponent {
494
500
  if (this.subs) {
495
501
  this.subs.unsubscribe();
496
502
  }
503
+ if (this._styleObserver) {
504
+ this._styleObserver.disconnect();
505
+ }
497
506
  }
498
507
  /**
499
508
  * @hidden
@@ -673,6 +682,47 @@ let EditorComponent = EditorComponent_1 = class EditorComponent {
673
682
  .pipe(filter((event) => !this.viewMountElement.contains(event.relatedTarget)))
674
683
  .subscribe(() => this.onTouchedCallback()));
675
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
+ }
676
726
  };
677
727
  tslib_1.__decorate([
678
728
  Input(),