@progress/kendo-angular-editor 2.4.0-dev.202110181309 → 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.
- package/dist/cdn/js/kendo-angular-editor.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/editor.component.js +69 -6
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/tools/colorpicker/editor-colorpicker.component.js +3 -1
- package/dist/es/tools/fontfamily/editor-fontfamily.component.js +3 -1
- package/dist/es/tools/fontsize/editor-fontsize.component.js +3 -1
- package/dist/es/tools/format/editor-format.component.js +3 -1
- package/dist/es/tools/shared/editor-command-base.js +3 -1
- package/dist/es/tools/tables/editor-insert-table-button.component.js +5 -3
- package/dist/es2015/common/resizable-options.interface.d.ts +8 -8
- package/dist/es2015/editor.component.d.ts +7 -0
- package/dist/es2015/editor.component.js +64 -6
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/tools/colorpicker/editor-colorpicker.component.js +3 -1
- package/dist/es2015/tools/fontfamily/editor-fontfamily.component.js +3 -1
- package/dist/es2015/tools/fontsize/editor-fontsize.component.js +3 -1
- package/dist/es2015/tools/format/editor-format.component.js +3 -1
- package/dist/es2015/tools/shared/editor-command-base.js +3 -1
- package/dist/es2015/tools/tables/editor-insert-table-button.component.js +5 -3
- package/dist/fesm2015/index.js +84 -14
- package/dist/fesm5/index.js +89 -14
- package/dist/npm/editor.component.js +68 -5
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/tools/colorpicker/editor-colorpicker.component.js +3 -1
- package/dist/npm/tools/fontfamily/editor-fontfamily.component.js +3 -1
- package/dist/npm/tools/fontsize/editor-fontsize.component.js +3 -1
- package/dist/npm/tools/format/editor-format.component.js +3 -1
- package/dist/npm/tools/shared/editor-command-base.js +3 -1
- package/dist/npm/tools/tables/editor-insert-table-button.component.js +5 -3
- package/dist/systemjs/kendo-angular-editor.js +1 -1
- package/package.json +5 -5
|
@@ -10,7 +10,7 @@ import { map, filter, auditTime, take } from 'rxjs/operators';
|
|
|
10
10
|
import { ToolBarComponent } from '@progress/kendo-angular-toolbar';
|
|
11
11
|
import { DialogService } from '@progress/kendo-angular-dialog';
|
|
12
12
|
import { isDocumentAvailable, KendoInput } from '@progress/kendo-angular-common';
|
|
13
|
-
import { buildKeymap, buildListKeymap, hasSameMarkup, getHtml, pasteCleanup, sanitize, removeComments, sanitizeClassAttr, sanitizeStyleAttr, removeAttribute, placeholder, EditorView, EditorState, baseKeymap, keymap, history, parseContent, Plugin, PluginKey, TextSelection, Schema, gapCursor } from '@progress/kendo-editor-common';
|
|
13
|
+
import { buildKeymap, buildListKeymap, hasSameMarkup, getHtml, pasteCleanup, sanitize, removeComments, sanitizeClassAttr, sanitizeStyleAttr, removeAttribute, placeholder, EditorView, EditorState, baseKeymap, keymap, history, parseContent, Plugin, PluginKey, TextSelection, Schema, gapCursor, getSelectionText } from '@progress/kendo-editor-common';
|
|
14
14
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
15
15
|
import { packageMetadata } from './package-metadata';
|
|
16
16
|
import { schema } from './config/schema';
|
|
@@ -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
|
|
@@ -391,6 +391,16 @@ var EditorComponent = /** @class */ (function () {
|
|
|
391
391
|
enumerable: true,
|
|
392
392
|
configurable: true
|
|
393
393
|
});
|
|
394
|
+
Object.defineProperty(EditorComponent.prototype, "selectionText", {
|
|
395
|
+
/**
|
|
396
|
+
* Returns the text which the current Editor selection contains ([see example]({% slug selection_editor %}#toc-retrieve-the-selected-text)).
|
|
397
|
+
*/
|
|
398
|
+
get: function () {
|
|
399
|
+
return this._view && this._view.state ? getSelectionText(this._view.state) : '';
|
|
400
|
+
},
|
|
401
|
+
enumerable: true,
|
|
402
|
+
configurable: true
|
|
403
|
+
});
|
|
394
404
|
EditorComponent.prototype.ngOnInit = function () {
|
|
395
405
|
var _this = this;
|
|
396
406
|
this.subs.add(this.localization.changes.subscribe(function (_a) {
|
|
@@ -403,12 +413,18 @@ var EditorComponent = /** @class */ (function () {
|
|
|
403
413
|
if (!this.iframe) {
|
|
404
414
|
this.contentAreaLoaded.next();
|
|
405
415
|
}
|
|
416
|
+
if (this.resizable) {
|
|
417
|
+
this.normalizeSize();
|
|
418
|
+
}
|
|
406
419
|
};
|
|
407
420
|
EditorComponent.prototype.ngOnChanges = function (changes) {
|
|
408
421
|
var _this = this;
|
|
409
422
|
if (changes.iframe && !changes.iframe.isFirstChange()) {
|
|
410
423
|
this.ngZone.onStable.pipe(take(1)).subscribe(function () { return _this.initialize(); });
|
|
411
424
|
}
|
|
425
|
+
if (changes.resizable && !changes.resizable.isFirstChange()) {
|
|
426
|
+
this.normalizeSize();
|
|
427
|
+
}
|
|
412
428
|
};
|
|
413
429
|
/**
|
|
414
430
|
* @hidden
|
|
@@ -564,7 +580,12 @@ var EditorComponent = /** @class */ (function () {
|
|
|
564
580
|
return getHtml(this._view.state);
|
|
565
581
|
};
|
|
566
582
|
EditorComponent.prototype.ngOnDestroy = function () {
|
|
567
|
-
this.subs
|
|
583
|
+
if (this.subs) {
|
|
584
|
+
this.subs.unsubscribe();
|
|
585
|
+
}
|
|
586
|
+
if (this._styleObserver) {
|
|
587
|
+
this._styleObserver.disconnect();
|
|
588
|
+
}
|
|
568
589
|
};
|
|
569
590
|
/**
|
|
570
591
|
* @hidden
|
|
@@ -745,6 +766,48 @@ var EditorComponent = /** @class */ (function () {
|
|
|
745
766
|
.pipe(filter(function (event) { return !_this.viewMountElement.contains(event.relatedTarget); }))
|
|
746
767
|
.subscribe(function () { return _this.onTouchedCallback(); }));
|
|
747
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
|
+
};
|
|
748
811
|
var EditorComponent_1;
|
|
749
812
|
tslib_1.__decorate([
|
|
750
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:
|
|
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
|
};
|
|
@@ -95,7 +95,9 @@ var EditorFontFamilyComponent = /** @class */ (function (_super) {
|
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
EditorFontFamilyComponent.prototype.ngOnDestroy = function () {
|
|
98
|
-
this.subs
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
*
|
|
10
|
+
* Specifies the minimum width of the resizable Editor in pixels.
|
|
11
11
|
*/
|
|
12
|
-
minWidth?:
|
|
12
|
+
minWidth?: number;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Specifies the minimum height of the resizable Editor in pixels.
|
|
15
15
|
*/
|
|
16
|
-
minHeight?:
|
|
16
|
+
minHeight?: number;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Specifies the maximum width of the resizable Editor in pixels.
|
|
19
19
|
*/
|
|
20
|
-
maxWidth?:
|
|
20
|
+
maxWidth?: number;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Specifies the maximum height of the resizable Editor in pixels.
|
|
23
23
|
*/
|
|
24
|
-
maxHeight?:
|
|
24
|
+
maxHeight?: number;
|
|
25
25
|
}
|
|
@@ -129,6 +129,10 @@ export declare class EditorComponent implements AfterViewInit, ControlValueAcces
|
|
|
129
129
|
* that manages the DOM structure that represents an editable document.
|
|
130
130
|
*/
|
|
131
131
|
readonly view: EditorView;
|
|
132
|
+
/**
|
|
133
|
+
* Returns the text which the current Editor selection contains ([see example]({% slug selection_editor %}#toc-retrieve-the-selected-text)).
|
|
134
|
+
*/
|
|
135
|
+
readonly selectionText: string;
|
|
132
136
|
/**
|
|
133
137
|
* @hidden
|
|
134
138
|
*/
|
|
@@ -154,6 +158,7 @@ export declare class EditorComponent implements AfterViewInit, ControlValueAcces
|
|
|
154
158
|
private _schema;
|
|
155
159
|
private _plugins;
|
|
156
160
|
private _placeholder;
|
|
161
|
+
private _styleObserver;
|
|
157
162
|
private afterViewInit;
|
|
158
163
|
private contentAreaLoaded;
|
|
159
164
|
constructor(dialogService: DialogService, localization: LocalizationService, cdr: ChangeDetectorRef, ngZone: NgZone, element: ElementRef);
|
|
@@ -267,6 +272,8 @@ export declare class EditorComponent implements AfterViewInit, ControlValueAcces
|
|
|
267
272
|
*/
|
|
268
273
|
isEmpty(): boolean;
|
|
269
274
|
private initialize;
|
|
275
|
+
private normalizeSize;
|
|
276
|
+
private normalizeProperties;
|
|
270
277
|
private onChangeCallback;
|
|
271
278
|
private onTouchedCallback;
|
|
272
279
|
}
|
|
@@ -11,7 +11,7 @@ import { map, filter, auditTime, take } from 'rxjs/operators';
|
|
|
11
11
|
import { ToolBarComponent } from '@progress/kendo-angular-toolbar';
|
|
12
12
|
import { DialogService } from '@progress/kendo-angular-dialog';
|
|
13
13
|
import { isDocumentAvailable, KendoInput } from '@progress/kendo-angular-common';
|
|
14
|
-
import { buildKeymap, buildListKeymap, hasSameMarkup, getHtml, pasteCleanup, sanitize, removeComments, sanitizeClassAttr, sanitizeStyleAttr, removeAttribute, placeholder, EditorView, EditorState, baseKeymap, keymap, history, parseContent, Plugin, PluginKey, TextSelection, Schema, gapCursor } from '@progress/kendo-editor-common';
|
|
14
|
+
import { buildKeymap, buildListKeymap, hasSameMarkup, getHtml, pasteCleanup, sanitize, removeComments, sanitizeClassAttr, sanitizeStyleAttr, removeAttribute, placeholder, EditorView, EditorState, baseKeymap, keymap, history, parseContent, Plugin, PluginKey, TextSelection, Schema, gapCursor, getSelectionText } from '@progress/kendo-editor-common';
|
|
15
15
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
16
16
|
import { packageMetadata } from './package-metadata';
|
|
17
17
|
import { schema } from './config/schema';
|
|
@@ -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;
|
|
@@ -315,6 +315,12 @@ let EditorComponent = EditorComponent_1 = class EditorComponent {
|
|
|
315
315
|
get view() {
|
|
316
316
|
return this._view;
|
|
317
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Returns the text which the current Editor selection contains ([see example]({% slug selection_editor %}#toc-retrieve-the-selected-text)).
|
|
320
|
+
*/
|
|
321
|
+
get selectionText() {
|
|
322
|
+
return this._view && this._view.state ? getSelectionText(this._view.state) : '';
|
|
323
|
+
}
|
|
318
324
|
ngOnInit() {
|
|
319
325
|
this.subs.add(this.localization.changes.subscribe(({ rtl }) => {
|
|
320
326
|
this.direction = rtl ? 'rtl' : 'ltr';
|
|
@@ -325,11 +331,17 @@ let EditorComponent = EditorComponent_1 = class EditorComponent {
|
|
|
325
331
|
if (!this.iframe) {
|
|
326
332
|
this.contentAreaLoaded.next();
|
|
327
333
|
}
|
|
334
|
+
if (this.resizable) {
|
|
335
|
+
this.normalizeSize();
|
|
336
|
+
}
|
|
328
337
|
}
|
|
329
338
|
ngOnChanges(changes) {
|
|
330
339
|
if (changes.iframe && !changes.iframe.isFirstChange()) {
|
|
331
340
|
this.ngZone.onStable.pipe(take(1)).subscribe(() => this.initialize());
|
|
332
341
|
}
|
|
342
|
+
if (changes.resizable && !changes.resizable.isFirstChange()) {
|
|
343
|
+
this.normalizeSize();
|
|
344
|
+
}
|
|
333
345
|
}
|
|
334
346
|
/**
|
|
335
347
|
* @hidden
|
|
@@ -485,7 +497,12 @@ let EditorComponent = EditorComponent_1 = class EditorComponent {
|
|
|
485
497
|
return getHtml(this._view.state);
|
|
486
498
|
}
|
|
487
499
|
ngOnDestroy() {
|
|
488
|
-
this.subs
|
|
500
|
+
if (this.subs) {
|
|
501
|
+
this.subs.unsubscribe();
|
|
502
|
+
}
|
|
503
|
+
if (this._styleObserver) {
|
|
504
|
+
this._styleObserver.disconnect();
|
|
505
|
+
}
|
|
489
506
|
}
|
|
490
507
|
/**
|
|
491
508
|
* @hidden
|
|
@@ -665,6 +682,47 @@ let EditorComponent = EditorComponent_1 = class EditorComponent {
|
|
|
665
682
|
.pipe(filter((event) => !this.viewMountElement.contains(event.relatedTarget)))
|
|
666
683
|
.subscribe(() => this.onTouchedCallback()));
|
|
667
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
|
+
}
|
|
668
726
|
};
|
|
669
727
|
tslib_1.__decorate([
|
|
670
728
|
Input(),
|