@syncfusion/ej2-richtexteditor 24.2.9 → 25.1.37
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/CHANGELOG.md +32 -0
- package/dist/ej2-richtexteditor.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +936 -500
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +921 -490
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/dist/global/ej2-richtexteditor.min.js +2 -2
- package/dist/global/ej2-richtexteditor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +13 -13
- package/src/common/config.d.ts +7 -0
- package/src/common/config.js +11 -0
- package/src/common/interface.d.ts +12 -0
- package/src/common/types.d.ts +6 -0
- package/src/editor-manager/plugin/dom-node.d.ts +5 -1
- package/src/editor-manager/plugin/dom-node.js +163 -13
- package/src/editor-manager/plugin/formats.js +1 -1
- package/src/editor-manager/plugin/image.js +12 -16
- package/src/editor-manager/plugin/inserthtml.d.ts +1 -0
- package/src/editor-manager/plugin/inserthtml.js +31 -0
- package/src/editor-manager/plugin/link.js +1 -1
- package/src/editor-manager/plugin/lists.js +36 -2
- package/src/editor-manager/plugin/ms-word-clean-up.js +67 -59
- package/src/editor-manager/plugin/selection-commands.js +56 -3
- package/src/editor-manager/plugin/table.js +18 -3
- package/src/editor-manager/plugin/toolbar-status.d.ts +2 -2
- package/src/editor-manager/plugin/toolbar-status.js +17 -9
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +3 -3
- package/src/rich-text-editor/actions/base-quick-toolbar.js +41 -10
- package/src/rich-text-editor/actions/base-toolbar.js +24 -30
- package/src/rich-text-editor/actions/dropdown-buttons.js +4 -4
- package/src/rich-text-editor/actions/emoji-picker.js +1 -1
- package/src/rich-text-editor/actions/enter-key.js +2 -1
- package/src/rich-text-editor/actions/full-screen.js +2 -2
- package/src/rich-text-editor/actions/html-editor.d.ts +0 -2
- package/src/rich-text-editor/actions/html-editor.js +8 -26
- package/src/rich-text-editor/actions/markdown-editor.js +3 -1
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
- package/src/rich-text-editor/actions/paste-clean-up.js +23 -0
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +7 -0
- package/src/rich-text-editor/actions/quick-toolbar.js +23 -8
- package/src/rich-text-editor/actions/resize.js +2 -1
- package/src/rich-text-editor/actions/toolbar.d.ts +0 -2
- package/src/rich-text-editor/actions/toolbar.js +13 -85
- package/src/rich-text-editor/base/classes.d.ts +0 -5
- package/src/rich-text-editor/base/classes.js +0 -5
- package/src/rich-text-editor/base/constant.d.ts +5 -0
- package/src/rich-text-editor/base/constant.js +5 -0
- package/src/rich-text-editor/base/interface.d.ts +36 -2
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +2 -2
- package/src/rich-text-editor/base/rich-text-editor.d.ts +4 -3
- package/src/rich-text-editor/base/rich-text-editor.js +83 -62
- package/src/rich-text-editor/base/util.js +8 -2
- package/src/rich-text-editor/models/default-locale.js +15 -12
- package/src/rich-text-editor/models/toolbar-settings-model.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.js +1 -1
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +2 -1
- package/src/rich-text-editor/renderer/image-module.d.ts +8 -1
- package/src/rich-text-editor/renderer/image-module.js +148 -155
- package/src/rich-text-editor/renderer/table-module.d.ts +2 -0
- package/src/rich-text-editor/renderer/table-module.js +71 -8
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +3 -0
- package/src/rich-text-editor/renderer/toolbar-renderer.js +68 -11
- package/src/rich-text-editor/renderer/video-module.js +7 -4
- package/src/rich-text-editor/renderer/view-source.js +7 -4
- package/styles/bootstrap-dark.css +61 -17
- package/styles/bootstrap.css +62 -18
- package/styles/bootstrap4.css +62 -18
- package/styles/bootstrap5-dark.css +68 -17
- package/styles/bootstrap5.css +68 -17
- package/styles/fabric-dark.css +61 -17
- package/styles/fabric.css +62 -18
- package/styles/fluent-dark.css +61 -17
- package/styles/fluent.css +61 -17
- package/styles/highcontrast-light.css +61 -17
- package/styles/highcontrast.css +62 -18
- package/styles/material-dark.css +61 -17
- package/styles/material.css +61 -17
- package/styles/material3-dark.css +63 -19
- package/styles/material3.css +63 -19
- package/styles/rich-text-editor/_bds-definition.scss +279 -0
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +1 -0
- package/styles/rich-text-editor/_bootstrap-definition.scss +1 -1
- package/styles/rich-text-editor/_bootstrap4-definition.scss +3 -2
- package/styles/rich-text-editor/_bootstrap5-definition.scss +1 -0
- package/styles/rich-text-editor/_fabric-dark-definition.scss +1 -0
- package/styles/rich-text-editor/_fabric-definition.scss +2 -1
- package/styles/rich-text-editor/_fluent-definition.scss +1 -0
- package/styles/rich-text-editor/_fusionnew-definition.scss +1 -0
- package/styles/rich-text-editor/_highcontrast-definition.scss +2 -1
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +1 -0
- package/styles/rich-text-editor/_layout.scss +51 -17
- package/styles/rich-text-editor/_material-dark-definition.scss +1 -0
- package/styles/rich-text-editor/_material-definition.scss +1 -0
- package/styles/rich-text-editor/_material3-definition.scss +1 -0
- package/styles/rich-text-editor/_tailwind-definition.scss +4 -3
- package/styles/rich-text-editor/_theme.scss +18 -5
- package/styles/rich-text-editor/bootstrap-dark.css +61 -17
- package/styles/rich-text-editor/bootstrap.css +62 -18
- package/styles/rich-text-editor/bootstrap4.css +62 -18
- package/styles/rich-text-editor/bootstrap5-dark.css +68 -17
- package/styles/rich-text-editor/bootstrap5.css +68 -17
- package/styles/rich-text-editor/fabric-dark.css +61 -17
- package/styles/rich-text-editor/fabric.css +62 -18
- package/styles/rich-text-editor/fluent-dark.css +61 -17
- package/styles/rich-text-editor/fluent.css +61 -17
- package/styles/rich-text-editor/highcontrast-light.css +61 -17
- package/styles/rich-text-editor/highcontrast.css +62 -18
- package/styles/rich-text-editor/icons/_bds.scss +351 -0
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +7 -4
- package/styles/rich-text-editor/icons/_bootstrap.scss +7 -4
- package/styles/rich-text-editor/icons/_bootstrap4.scss +7 -4
- package/styles/rich-text-editor/icons/_bootstrap5.scss +7 -4
- package/styles/rich-text-editor/icons/_fabric-dark.scss +7 -4
- package/styles/rich-text-editor/icons/_fabric.scss +7 -4
- package/styles/rich-text-editor/icons/_fluent.scss +7 -4
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +7 -4
- package/styles/rich-text-editor/icons/_highcontrast.scss +7 -4
- package/styles/rich-text-editor/icons/_material-dark.scss +7 -4
- package/styles/rich-text-editor/icons/_material.scss +7 -4
- package/styles/rich-text-editor/icons/_material3.scss +7 -4
- package/styles/rich-text-editor/icons/_tailwind.scss +7 -4
- package/styles/rich-text-editor/material-dark.css +61 -17
- package/styles/rich-text-editor/material.css +61 -17
- package/styles/rich-text-editor/material3-dark.css +63 -19
- package/styles/rich-text-editor/material3.css +63 -19
- package/styles/rich-text-editor/tailwind-dark.css +65 -25
- package/styles/rich-text-editor/tailwind.css +65 -25
- package/styles/tailwind-dark.css +65 -25
- package/styles/tailwind.css +65 -25
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addClass, detach, EventHandler,
|
|
1
|
+
import { addClass, detach, EventHandler, select, Ajax, formatUnit } from '@syncfusion/ej2-base';
|
|
2
2
|
import { Browser, closest, removeClass, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
|
|
3
3
|
import * as events from '../base/constant';
|
|
4
4
|
import * as classes from '../base/classes';
|
|
@@ -8,6 +8,7 @@ import { Button, CheckBox } from '@syncfusion/ej2-buttons';
|
|
|
8
8
|
import { RenderType } from '../base/enum';
|
|
9
9
|
import { dispatchEvent, parseHtml, hasClass, convertToBlob } from '../base/util';
|
|
10
10
|
import { isIDevice } from '../../common/util';
|
|
11
|
+
import { imageResizeFactor } from '../../common/config';
|
|
11
12
|
/**
|
|
12
13
|
* `Image` module is used to handle image actions.
|
|
13
14
|
*/
|
|
@@ -17,7 +18,6 @@ var Image = /** @class */ (function () {
|
|
|
17
18
|
this.isAllowedTypes = true;
|
|
18
19
|
this.pageX = null;
|
|
19
20
|
this.pageY = null;
|
|
20
|
-
this.mouseX = null;
|
|
21
21
|
this.deletedImg = [];
|
|
22
22
|
this.parent = parent;
|
|
23
23
|
this.rteID = parent.element.id;
|
|
@@ -87,7 +87,7 @@ var Image = /** @class */ (function () {
|
|
|
87
87
|
dropElement.removeEventListener('dragstart', this.dragStart.bind(this), true);
|
|
88
88
|
dropElement.removeEventListener('dragenter', this.dragEnter.bind(this), true);
|
|
89
89
|
dropElement.removeEventListener('dragover', this.dragOver.bind(this), true);
|
|
90
|
-
if (!
|
|
90
|
+
if (!isNOU(this.contentModule)) {
|
|
91
91
|
EventHandler.remove(this.contentModule.getEditPanel(), Browser.touchEndEvent, this.imageClick);
|
|
92
92
|
this.parent.formatter.editorManager.observer.off(events.checkUndo, this.undoStack);
|
|
93
93
|
if (this.parent.insertImageSettings.resize) {
|
|
@@ -100,7 +100,7 @@ var Image = /** @class */ (function () {
|
|
|
100
100
|
};
|
|
101
101
|
Image.prototype.updateCss = function (currentObj, e) {
|
|
102
102
|
if (currentObj && e.cssClass) {
|
|
103
|
-
if (
|
|
103
|
+
if (isNOU(e.oldCssClass)) {
|
|
104
104
|
currentObj.setProperties({ cssClass: (currentObj.cssClass + ' ' + e.cssClass).trim() });
|
|
105
105
|
}
|
|
106
106
|
else {
|
|
@@ -111,7 +111,7 @@ var Image = /** @class */ (function () {
|
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
112
112
|
Image.prototype.setCssClass = function (e) {
|
|
113
113
|
if (this.popupObj && e.cssClass) {
|
|
114
|
-
if (
|
|
114
|
+
if (isNOU(e.oldCssClass)) {
|
|
115
115
|
addClass([this.popupObj.element], e.cssClass);
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
@@ -175,11 +175,6 @@ var Image = /** @class */ (function () {
|
|
|
175
175
|
}
|
|
176
176
|
var args = { event: e, requestType: 'images' };
|
|
177
177
|
this.parent.trigger(events.resizeStop, args);
|
|
178
|
-
/* eslint-disable */
|
|
179
|
-
var pageX = this.getPointX(e);
|
|
180
|
-
var pageY = (this.parent.iframeSettings.enable) ? window.pageYOffset +
|
|
181
|
-
this.parent.element.getBoundingClientRect().top + e.clientY : e.pageY;
|
|
182
|
-
/* eslint-enable */
|
|
183
178
|
this.parent.formatter.editorManager.observer.on(events.checkUndo, this.undoStack, this);
|
|
184
179
|
this.parent.formatter.saveData();
|
|
185
180
|
};
|
|
@@ -210,17 +205,15 @@ var Image = /** @class */ (function () {
|
|
|
210
205
|
if (this.quickToolObj) {
|
|
211
206
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
212
207
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
if (target.classList.contains('e-rte-botRight')) {
|
|
223
|
-
this.resizeBtnStat.botRight = true;
|
|
208
|
+
var handlers = ['topLeft', 'topRight', 'botLeft', 'botRight'];
|
|
209
|
+
for (var i = 0; i < handlers.length; i++) {
|
|
210
|
+
var handler = handlers[i];
|
|
211
|
+
if (target.classList.contains('e-rte-' + handler)) {
|
|
212
|
+
this.resizeBtnStat[handler] = true;
|
|
213
|
+
this.currentResizeHandler = handler;
|
|
214
|
+
this.aspectRatio = this.findAspectRatio(this.imgEle);
|
|
215
|
+
break; // Exit the loop once a match is found
|
|
216
|
+
}
|
|
224
217
|
}
|
|
225
218
|
if (Browser.isDevice && this.contentModule.getEditPanel().contains(this.imgResizeDiv) &&
|
|
226
219
|
!this.imgResizeDiv.classList.contains('e-mob-span')) {
|
|
@@ -351,89 +344,80 @@ var Image = /** @class */ (function () {
|
|
|
351
344
|
};
|
|
352
345
|
}
|
|
353
346
|
};
|
|
354
|
-
Image.prototype.setAspectRatio = function (img, expectedX, expectedY
|
|
355
|
-
if (
|
|
347
|
+
Image.prototype.setAspectRatio = function (img, expectedX, expectedY) {
|
|
348
|
+
if (isNOU(img.width)) {
|
|
356
349
|
return;
|
|
357
350
|
}
|
|
358
|
-
|
|
359
|
-
var
|
|
360
|
-
|
|
361
|
-
var
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
if (
|
|
365
|
-
if (
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
img.style.width = ((finalWidthByPerc > 3) ? finalWidthByPerc : 3) + '%';
|
|
351
|
+
var width = img.width;
|
|
352
|
+
var height = img.height;
|
|
353
|
+
var sameHeightWidth = (width === height);
|
|
354
|
+
var factor = this.parent.insertImageSettings.resizeByPercent ? '%' : 'px';
|
|
355
|
+
var emptyStyleDimension = (img.style.width === '' && img.style.height === '');
|
|
356
|
+
if (!sameHeightWidth && !emptyStyleDimension) {
|
|
357
|
+
if (img.style.width !== '' && img.style.height !== '') {
|
|
358
|
+
if (this.parent.insertImageSettings.resizeByPercent) {
|
|
359
|
+
this.setImageWidth(img, expectedX, factor);
|
|
360
|
+
this.removeImageHeight(img);
|
|
369
361
|
}
|
|
370
362
|
else {
|
|
371
|
-
|
|
363
|
+
this.setImageWidth(img, expectedX, factor);
|
|
364
|
+
this.setImageHeight(img, expectedY, factor);
|
|
372
365
|
}
|
|
373
|
-
img.style.height = null;
|
|
374
|
-
img.removeAttribute('height');
|
|
375
|
-
}
|
|
376
|
-
else if (img.style.width === '' && img.style.height !== '') {
|
|
377
|
-
img.style.height = expectedY + 'px';
|
|
378
|
-
}
|
|
379
|
-
else if (img.style.width !== '' && img.style.height === '') {
|
|
380
|
-
var currentWidth = ((width / height * expectedY) + width / height) <
|
|
381
|
-
(this.parent.inputElement.getBoundingClientRect().right - 32) ?
|
|
382
|
-
((width / height * expectedY) + width / height) : (this.parent.inputElement.getBoundingClientRect().right - 32);
|
|
383
|
-
img.style.width = currentWidth.toString() + 'px';
|
|
384
|
-
img.style.height = expectedY + 'px';
|
|
385
366
|
}
|
|
386
367
|
else if (img.style.width !== '') {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
img.style.height = expectedY + 'px';
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
if (this.parent.iframeSettings.enable) {
|
|
394
|
-
img.setAttribute('width', (img.width + this.mouseX).toString());
|
|
368
|
+
if (this.parent.insertImageSettings.resizeByPercent) {
|
|
369
|
+
this.setImageWidth(img, expectedX, factor);
|
|
370
|
+
this.removeImageHeight(img);
|
|
395
371
|
}
|
|
396
372
|
else {
|
|
397
|
-
|
|
398
|
-
img.setAttribute('width', (currentWidth).toString());
|
|
373
|
+
this.setImageWidth(img, expectedX, factor);
|
|
399
374
|
}
|
|
400
375
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
var original = img.offsetWidth + this.mouseX;
|
|
406
|
-
var finalWidthByPerc = (original / img.offsetWidth) * (parseFloat(img.style.width).toString() === 'NaN' ?
|
|
407
|
-
(img.offsetWidth / (parseFloat(getComputedStyle(this.parent.element).width)) * 100) :
|
|
408
|
-
parseFloat(img.style.width));
|
|
409
|
-
img.style.width = ((finalWidthByPerc > 3) ? finalWidthByPerc : 3) + '%';
|
|
376
|
+
else if (img.style.height !== '') {
|
|
377
|
+
if (this.parent.insertImageSettings.resizeByPercent) {
|
|
378
|
+
this.setImageWidth(img, expectedX, factor);
|
|
379
|
+
this.removeImageHeight(img);
|
|
410
380
|
}
|
|
411
381
|
else {
|
|
412
|
-
|
|
382
|
+
this.setImageHeight(img, expectedY, factor);
|
|
413
383
|
}
|
|
414
|
-
img.style.height = null;
|
|
415
|
-
img.removeAttribute('height');
|
|
416
|
-
}
|
|
417
|
-
else if (img.style.width !== '') {
|
|
418
|
-
img.style.width = expectedX + 'px';
|
|
419
|
-
img.style.height = (height / width * expectedX) + 'px';
|
|
420
|
-
}
|
|
421
|
-
else {
|
|
422
|
-
img.setAttribute('width', this.resizeBtnStat.botRight ? (this.getPointX(e.event) - img.getBoundingClientRect().left).toString() : expectedX.toString());
|
|
423
384
|
}
|
|
424
385
|
}
|
|
425
386
|
else {
|
|
387
|
+
this.setImageWidth(img, expectedX, factor);
|
|
426
388
|
if (this.parent.insertImageSettings.resizeByPercent) {
|
|
427
|
-
|
|
428
|
-
img.style.height = null;
|
|
429
|
-
img.removeAttribute('height');
|
|
389
|
+
this.removeImageHeight(img);
|
|
430
390
|
}
|
|
431
391
|
else {
|
|
432
|
-
|
|
433
|
-
img.style.height = ((expectedX >= 15) ? expectedX : 15) + 'px';
|
|
392
|
+
this.setImageHeight(img, expectedY, factor);
|
|
434
393
|
}
|
|
435
394
|
}
|
|
436
395
|
};
|
|
396
|
+
Image.prototype.setImageWidth = function (img, value, suffix) {
|
|
397
|
+
img.style.width = this.getImageDimension(value, img) + suffix;
|
|
398
|
+
if (!this.parent.insertImageSettings.resizeByPercent) {
|
|
399
|
+
img.setAttribute('width', value.toString());
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
Image.prototype.setImageHeight = function (img, value, suffix) {
|
|
403
|
+
img.style.height = this.getImageDimension(value, img) + suffix;
|
|
404
|
+
if (!this.parent.insertImageSettings.resizeByPercent) {
|
|
405
|
+
img.setAttribute('height', value.toString());
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
Image.prototype.removeImageHeight = function (img) {
|
|
409
|
+
img.style.height = '';
|
|
410
|
+
img.removeAttribute('height');
|
|
411
|
+
};
|
|
412
|
+
Image.prototype.getImageDimension = function (value, img) {
|
|
413
|
+
if (this.parent.insertImageSettings.resizeByPercent) {
|
|
414
|
+
var rootElem = img.parentElement || img.previousElementSibling;
|
|
415
|
+
return this.pixToPerc(value, rootElem);
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
return value;
|
|
419
|
+
}
|
|
420
|
+
};
|
|
437
421
|
Image.prototype.pixToPerc = function (expected, parentEle) {
|
|
438
422
|
return expected / parseFloat(getComputedStyle(parentEle).width) * 100;
|
|
439
423
|
};
|
|
@@ -456,7 +440,7 @@ var Image = /** @class */ (function () {
|
|
|
456
440
|
return;
|
|
457
441
|
}
|
|
458
442
|
_this.imgEle.parentElement.style.cursor = 'pointer';
|
|
459
|
-
_this.setAspectRatio(_this.imgEle, parseInt(width, 10), parseInt(height, 10)
|
|
443
|
+
_this.setAspectRatio(_this.imgEle, parseInt(width, 10), parseInt(height, 10));
|
|
460
444
|
_this.resizeImgDupPos(_this.imgEle);
|
|
461
445
|
_this.imgResizePos(_this.imgEle, _this.imgResizeDiv);
|
|
462
446
|
}
|
|
@@ -467,35 +451,37 @@ var Image = /** @class */ (function () {
|
|
|
467
451
|
this.cancelResizeAction();
|
|
468
452
|
return;
|
|
469
453
|
}
|
|
470
|
-
if (this.
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
this.
|
|
491
|
-
|
|
492
|
-
else if (this.resizeBtnStat.topRight) {
|
|
493
|
-
this.imgDupMouseMove(width + 'px', height + 'px', e);
|
|
494
|
-
}
|
|
495
|
-
else if (this.resizeBtnStat.topLeft) {
|
|
454
|
+
if (this.resizeBtnStat.botRight || this.resizeBtnStat.botLeft || this.resizeBtnStat.topRight || this.resizeBtnStat.topLeft) {
|
|
455
|
+
var pageX = this.getPointX(e);
|
|
456
|
+
var pageY = this.getPointY(e);
|
|
457
|
+
var resizeFactor = this.getResizeFactor(this.currentResizeHandler);
|
|
458
|
+
var diffX = (pageX - this.pageX);
|
|
459
|
+
var diffY = (pageY - this.pageY);
|
|
460
|
+
var currentWidth = this.imgEle.clientWidth;
|
|
461
|
+
var currentHeight = this.imgEle.clientHeight;
|
|
462
|
+
var width = diffX * resizeFactor[0] + currentWidth;
|
|
463
|
+
var height = diffY * resizeFactor[1] + currentHeight;
|
|
464
|
+
width = (width < 16) ? 16 : width;
|
|
465
|
+
height = (height < 16) ? 16 : height;
|
|
466
|
+
if (Math.abs(diffX) > Math.abs(diffY)) {
|
|
467
|
+
height = Math.round(width / this.aspectRatio);
|
|
468
|
+
width = Math.round(height * this.aspectRatio);
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
width = Math.round(height * this.aspectRatio);
|
|
472
|
+
height = Math.round(width / this.aspectRatio);
|
|
473
|
+
}
|
|
474
|
+
this.pageX = pageX;
|
|
475
|
+
this.pageY = pageY;
|
|
496
476
|
this.imgDupMouseMove(width + 'px', height + 'px', e);
|
|
497
477
|
}
|
|
498
478
|
};
|
|
479
|
+
Image.prototype.getResizeFactor = function (value) {
|
|
480
|
+
return imageResizeFactor[value];
|
|
481
|
+
};
|
|
482
|
+
Image.prototype.findAspectRatio = function (image) {
|
|
483
|
+
return image.clientWidth / image.clientHeight;
|
|
484
|
+
};
|
|
499
485
|
Image.prototype.cancelResizeAction = function () {
|
|
500
486
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
|
|
501
487
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd);
|
|
@@ -505,6 +491,8 @@ var Image = /** @class */ (function () {
|
|
|
505
491
|
this.imgResizeDiv = null;
|
|
506
492
|
this.pageX = null;
|
|
507
493
|
this.pageY = null;
|
|
494
|
+
this.currentResizeHandler = null;
|
|
495
|
+
this.aspectRatio = null;
|
|
508
496
|
}
|
|
509
497
|
};
|
|
510
498
|
Image.prototype.resizeImgDupPos = function (e) {
|
|
@@ -515,6 +503,8 @@ var Image = /** @class */ (function () {
|
|
|
515
503
|
};
|
|
516
504
|
};
|
|
517
505
|
Image.prototype.resizeBtnInit = function () {
|
|
506
|
+
this.aspectRatio = null;
|
|
507
|
+
this.currentResizeHandler = null;
|
|
518
508
|
return this.resizeBtnStat = { botLeft: false, botRight: false, topRight: false, topLeft: false };
|
|
519
509
|
};
|
|
520
510
|
Image.prototype.onToolbarAction = function (args) {
|
|
@@ -587,7 +577,7 @@ var Image = /** @class */ (function () {
|
|
|
587
577
|
});
|
|
588
578
|
if (this.quickToolObj && document.body.contains(this.quickToolObj.imageQTBar.element)) {
|
|
589
579
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
590
|
-
if (!
|
|
580
|
+
if (!isNOU(e.selectParent)) {
|
|
591
581
|
removeClass([e.selectParent[0]], 'e-img-focus');
|
|
592
582
|
}
|
|
593
583
|
}
|
|
@@ -627,7 +617,7 @@ var Image = /** @class */ (function () {
|
|
|
627
617
|
this.checkImageDel(range);
|
|
628
618
|
}
|
|
629
619
|
}
|
|
630
|
-
if (!
|
|
620
|
+
if (!isNOU(this.parent.formatter.editorManager.nodeSelection) &&
|
|
631
621
|
originalEvent.code !== 'KeyK') {
|
|
632
622
|
range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
|
|
633
623
|
selectNodeEle = this.parent.formatter.editorManager.nodeSelection.getNodeCollection(range);
|
|
@@ -650,7 +640,7 @@ var Image = /** @class */ (function () {
|
|
|
650
640
|
}
|
|
651
641
|
if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
|
|
652
642
|
if (selectNodeEle && selectNodeEle[0].nodeName === 'IMG' && selectNodeEle.length < 1) {
|
|
653
|
-
if (!
|
|
643
|
+
if (!isNOU(this.parent.formatter.editorManager.nodeSelection)) {
|
|
654
644
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
655
645
|
}
|
|
656
646
|
originalEvent.preventDefault();
|
|
@@ -672,7 +662,7 @@ var Image = /** @class */ (function () {
|
|
|
672
662
|
}
|
|
673
663
|
switch (originalEvent.action) {
|
|
674
664
|
case 'escape':
|
|
675
|
-
if (!
|
|
665
|
+
if (!isNOU(this.dialogObj)) {
|
|
676
666
|
this.dialogObj.close();
|
|
677
667
|
}
|
|
678
668
|
break;
|
|
@@ -720,7 +710,7 @@ var Image = /** @class */ (function () {
|
|
|
720
710
|
}
|
|
721
711
|
break;
|
|
722
712
|
case 'insert-image':
|
|
723
|
-
if (!
|
|
713
|
+
if (!isNOU(this.parent.formatter.editorManager.nodeSelection)) {
|
|
724
714
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
725
715
|
}
|
|
726
716
|
this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
|
|
@@ -878,8 +868,8 @@ var Image = /** @class */ (function () {
|
|
|
878
868
|
};
|
|
879
869
|
Image.prototype.showImageQuickToolbar = function (e) {
|
|
880
870
|
var _this = this;
|
|
881
|
-
if (e.type !== 'Images' ||
|
|
882
|
-
||
|
|
871
|
+
if (e.type !== 'Images' || isNOU(this.parent.quickToolbarModule)
|
|
872
|
+
|| isNOU(this.parent.quickToolbarModule.imageQTBar) || isNOU(e.args)) {
|
|
883
873
|
return;
|
|
884
874
|
}
|
|
885
875
|
this.quickToolObj = this.parent.quickToolbarModule;
|
|
@@ -914,7 +904,7 @@ var Image = /** @class */ (function () {
|
|
|
914
904
|
}
|
|
915
905
|
};
|
|
916
906
|
Image.prototype.hideImageQuickToolbar = function () {
|
|
917
|
-
if (!
|
|
907
|
+
if (!isNOU(this.contentModule.getEditPanel().querySelector('.e-img-focus'))) {
|
|
918
908
|
removeClass([this.contentModule.getEditPanel().querySelector('.e-img-focus')], 'e-img-focus');
|
|
919
909
|
if (this.quickToolObj && this.quickToolObj.imageQTBar && document.body.contains(this.quickToolObj.imageQTBar.element)) {
|
|
920
910
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
@@ -929,7 +919,7 @@ var Image = /** @class */ (function () {
|
|
|
929
919
|
var args = e.args;
|
|
930
920
|
var showOnRightClick = this.parent.quickToolbarSettings.showOnRightClick;
|
|
931
921
|
if (args.which === 2 || (showOnRightClick && args.which === 1) || (!showOnRightClick && args.which === 3)) {
|
|
932
|
-
if ((showOnRightClick && args.which === 1) && !
|
|
922
|
+
if ((showOnRightClick && args.which === 1) && !isNOU(args.target) &&
|
|
933
923
|
args.target.tagName === 'IMG') {
|
|
934
924
|
this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
|
|
935
925
|
this.parent.formatter.editorManager.nodeSelection.setSelectionContents(this.contentModule.getDocument(), args.target);
|
|
@@ -989,7 +979,7 @@ var Image = /** @class */ (function () {
|
|
|
989
979
|
return;
|
|
990
980
|
}
|
|
991
981
|
this.imagDialog(e);
|
|
992
|
-
if (!
|
|
982
|
+
if (!isNOU(this.dialogObj)) {
|
|
993
983
|
var linkWrap = this.parent.createElement('div', { className: 'e-img-linkwrap' + this.parent.getCssClass(true) });
|
|
994
984
|
var linkUrl = this.i10n.getConstant('linkurl');
|
|
995
985
|
var content = '<div class="e-rte-field' + this.parent.getCssClass(true) + '">' +
|
|
@@ -1024,7 +1014,6 @@ var Image = /** @class */ (function () {
|
|
|
1024
1014
|
selectNode: e.selectNode, selectParent: e.selectParent, link: inputLink, target: target_1, ariaLabel: imageLabel
|
|
1025
1015
|
};
|
|
1026
1016
|
this.dialogObj.setProperties({
|
|
1027
|
-
height: 'inherit',
|
|
1028
1017
|
width: '290px',
|
|
1029
1018
|
header: this.parent.localeObj.getConstant('imageInsertLinkHeader'),
|
|
1030
1019
|
content: linkWrap,
|
|
@@ -1042,7 +1031,7 @@ var Image = /** @class */ (function () {
|
|
|
1042
1031
|
if (!isNOU(this.parent.cssClass)) {
|
|
1043
1032
|
this.dialogObj.setProperties({ cssClass: this.parent.cssClass });
|
|
1044
1033
|
}
|
|
1045
|
-
if (!
|
|
1034
|
+
if (!isNOU(inputDetails)) {
|
|
1046
1035
|
inputLink.value = inputDetails.url;
|
|
1047
1036
|
// eslint-disable-next-line
|
|
1048
1037
|
(inputDetails.target) ? this.checkBoxObj.checked = true : this.checkBoxObj.checked = false;
|
|
@@ -1059,7 +1048,7 @@ var Image = /** @class */ (function () {
|
|
|
1059
1048
|
}
|
|
1060
1049
|
this.imagDialog(e);
|
|
1061
1050
|
var altText = this.i10n.getConstant('altText');
|
|
1062
|
-
if (!
|
|
1051
|
+
if (!isNOU(this.dialogObj)) {
|
|
1063
1052
|
var altWrap = this.parent.createElement('div', { className: 'e-img-altwrap' + this.parent.getCssClass(true) });
|
|
1064
1053
|
var altHeader = this.i10n.getConstant('alternateHeader');
|
|
1065
1054
|
var linkUpdate = this.i10n.getConstant('dialogUpdate');
|
|
@@ -1077,7 +1066,7 @@ var Image = /** @class */ (function () {
|
|
|
1077
1066
|
alt: inputAlt
|
|
1078
1067
|
};
|
|
1079
1068
|
this.dialogObj.setProperties({
|
|
1080
|
-
|
|
1069
|
+
width: '290px', header: altHeader, content: altWrap,
|
|
1081
1070
|
buttons: [{
|
|
1082
1071
|
// eslint-disable-next-line
|
|
1083
1072
|
click: function (e) {
|
|
@@ -1097,7 +1086,7 @@ var Image = /** @class */ (function () {
|
|
|
1097
1086
|
}
|
|
1098
1087
|
};
|
|
1099
1088
|
Image.prototype.insertAlt = function (e) {
|
|
1100
|
-
if (!
|
|
1089
|
+
if (!isNOU(e.alt)) {
|
|
1101
1090
|
e.selection.restore();
|
|
1102
1091
|
if (this.parent.formatter.getUndoRedoStack().length === 0) {
|
|
1103
1092
|
this.parent.formatter.saveData();
|
|
@@ -1207,7 +1196,7 @@ var Image = /** @class */ (function () {
|
|
|
1207
1196
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
1208
1197
|
}
|
|
1209
1198
|
this.cancelResizeAction();
|
|
1210
|
-
if (
|
|
1199
|
+
if (isNOU(keyCode)) {
|
|
1211
1200
|
this.parent.trigger(events.afterImageDelete, args);
|
|
1212
1201
|
}
|
|
1213
1202
|
};
|
|
@@ -1261,7 +1250,7 @@ var Image = /** @class */ (function () {
|
|
|
1261
1250
|
addClass([selectNode], 'e-rte-image');
|
|
1262
1251
|
var subCommand = (e.args.item) ?
|
|
1263
1252
|
e.args.item.subCommand : 'Caption';
|
|
1264
|
-
if (!
|
|
1253
|
+
if (!isNOU(closest(selectNode, '.' + classes.CLS_CAPTION))) {
|
|
1265
1254
|
detach(closest(selectNode, '.' + classes.CLS_CAPTION));
|
|
1266
1255
|
if (Browser.isIE) {
|
|
1267
1256
|
this.contentModule.getEditPanel().focus();
|
|
@@ -1320,13 +1309,13 @@ var Image = /** @class */ (function () {
|
|
|
1320
1309
|
return;
|
|
1321
1310
|
}
|
|
1322
1311
|
this.imagDialog(e);
|
|
1323
|
-
if (!
|
|
1312
|
+
if (!isNOU(this.dialogObj)) {
|
|
1324
1313
|
var imgSizeHeader = this.i10n.getConstant('imageSizeHeader');
|
|
1325
1314
|
var linkUpdate = this.i10n.getConstant('dialogUpdate');
|
|
1326
1315
|
var dialogContent = this.imgsizeInput(e);
|
|
1327
1316
|
var selectObj_1 = { args: e.args, selfImage: this, selection: e.selection, selectNode: e.selectNode };
|
|
1328
1317
|
this.dialogObj.setProperties({
|
|
1329
|
-
|
|
1318
|
+
width: '290px', header: imgSizeHeader, content: dialogContent,
|
|
1330
1319
|
buttons: [{
|
|
1331
1320
|
// eslint-disable-next-line
|
|
1332
1321
|
click: function (e) {
|
|
@@ -1425,7 +1414,7 @@ var Image = /** @class */ (function () {
|
|
|
1425
1414
|
}
|
|
1426
1415
|
};
|
|
1427
1416
|
var dialogContent = this.parent.createElement('div', { className: 'e-img-content' + this.parent.getCssClass(true) });
|
|
1428
|
-
if ((!
|
|
1417
|
+
if ((!isNOU(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
|
|
1429
1418
|
|| this.parent.editorMode === 'HTML') {
|
|
1430
1419
|
dialogContent.appendChild(this.imgUpload(e));
|
|
1431
1420
|
}
|
|
@@ -1449,7 +1438,7 @@ var Image = /** @class */ (function () {
|
|
|
1449
1438
|
this.dialogObj = this.dialogRenderObj.render(dialogModel);
|
|
1450
1439
|
this.dialogObj.createElement = this.parent.createElement;
|
|
1451
1440
|
this.dialogObj.appendTo(imgDialog);
|
|
1452
|
-
if (
|
|
1441
|
+
if (isNOU(this.dialogObj)) {
|
|
1453
1442
|
return;
|
|
1454
1443
|
}
|
|
1455
1444
|
if (e.selectNode && e.selectNode[0].nodeName === 'IMG' && (e.name === 'insertImage')) {
|
|
@@ -1459,7 +1448,7 @@ var Image = /** @class */ (function () {
|
|
|
1459
1448
|
if (this.quickToolObj) {
|
|
1460
1449
|
if (this.quickToolObj.imageQTBar && document.body.contains(this.quickToolObj.imageQTBar.element)) {
|
|
1461
1450
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
1462
|
-
if (!
|
|
1451
|
+
if (!isNOU(e.selectParent)) {
|
|
1463
1452
|
removeClass([e.selectParent[0]], 'e-img-focus');
|
|
1464
1453
|
}
|
|
1465
1454
|
}
|
|
@@ -1487,7 +1476,7 @@ var Image = /** @class */ (function () {
|
|
|
1487
1476
|
if (target.nodeName !== '#document') {
|
|
1488
1477
|
this.parent.currentTarget = e.target;
|
|
1489
1478
|
}
|
|
1490
|
-
if (!
|
|
1479
|
+
if (!isNOU(this.dialogObj) && ((
|
|
1491
1480
|
// eslint-disable-next-line
|
|
1492
1481
|
!closest(target, '[id=' + "'" + this.dialogObj.element.id + "'" + ']') && this.parent.toolbarSettings.enable && this.parent.getToolbarElement() &&
|
|
1493
1482
|
!this.parent.getToolbarElement().contains(e.target)) ||
|
|
@@ -1527,7 +1516,6 @@ var Image = /** @class */ (function () {
|
|
|
1527
1516
|
for (var i = 0; i < items.length; i++) {
|
|
1528
1517
|
removeClass([items[i]], 'e-img-focus');
|
|
1529
1518
|
removeClass([items[i]], 'e-resize');
|
|
1530
|
-
items[i].style.maxWidth = '';
|
|
1531
1519
|
}
|
|
1532
1520
|
}
|
|
1533
1521
|
};
|
|
@@ -1541,7 +1529,6 @@ var Image = /** @class */ (function () {
|
|
|
1541
1529
|
this.cancelResizeAction();
|
|
1542
1530
|
}
|
|
1543
1531
|
};
|
|
1544
|
-
// eslint-disable-next-line
|
|
1545
1532
|
Image.prototype.imageUrlPopup = function (e) {
|
|
1546
1533
|
var _this = this;
|
|
1547
1534
|
var imgUrl = this.parent.createElement('div', { className: 'imgUrl' + this.parent.getCssClass(true) });
|
|
@@ -1578,7 +1565,7 @@ var Image = /** @class */ (function () {
|
|
|
1578
1565
|
if (proxy.parent.formatter.getUndoRedoStack().length === 0) {
|
|
1579
1566
|
proxy.parent.formatter.saveData();
|
|
1580
1567
|
}
|
|
1581
|
-
if (!
|
|
1568
|
+
if (!isNOU(proxy.uploadUrl) && proxy.uploadUrl.url !== '') {
|
|
1582
1569
|
proxy.uploadUrl.cssClass = (proxy.parent.insertImageSettings.display === 'inline' ?
|
|
1583
1570
|
classes.CLS_IMGINLINE : classes.CLS_IMGBREAK);
|
|
1584
1571
|
proxy.dialogObj.hide({ returnValue: false });
|
|
@@ -1590,7 +1577,7 @@ var Image = /** @class */ (function () {
|
|
|
1590
1577
|
}
|
|
1591
1578
|
}
|
|
1592
1579
|
else if (url !== '') {
|
|
1593
|
-
if (proxy.parent.editorMode === 'HTML' &&
|
|
1580
|
+
if (proxy.parent.editorMode === 'HTML' && isNOU(closest(
|
|
1594
1581
|
// eslint-disable-next-line
|
|
1595
1582
|
this.selection.range.startContainer.parentNode, '[id=' + "'" + proxy.contentModule.getPanel().id + "'" + ']'))) {
|
|
1596
1583
|
proxy.contentModule.getEditPanel().focus();
|
|
@@ -1599,7 +1586,7 @@ var Image = /** @class */ (function () {
|
|
|
1599
1586
|
this.selectParent = proxy.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
|
|
1600
1587
|
}
|
|
1601
1588
|
var regex = /[\w-]+.(jpg|png|jpeg|gif)/g;
|
|
1602
|
-
var matchUrl = (!
|
|
1589
|
+
var matchUrl = (!isNOU(url.match(regex)) && proxy.parent.editorMode === 'HTML') ? url.match(regex)[0] : '';
|
|
1603
1590
|
var value = {
|
|
1604
1591
|
cssClass: (proxy.parent.insertImageSettings.display === 'inline' ? classes.CLS_IMGINLINE : classes.CLS_IMGBREAK),
|
|
1605
1592
|
url: url, selection: this.selection, altText: matchUrl,
|
|
@@ -1622,12 +1609,18 @@ var Image = /** @class */ (function () {
|
|
|
1622
1609
|
var imgHeight = this.i10n.getConstant('imageHeight');
|
|
1623
1610
|
var imgWidth = this.i10n.getConstant('imageWidth');
|
|
1624
1611
|
var imgSizeWrap = this.parent.createElement('div', { className: 'e-img-sizewrap' + this.parent.getCssClass(true) });
|
|
1625
|
-
var widthVal =
|
|
1626
|
-
selectNode.style.width !== '') ? selectNode.style.width : !
|
|
1612
|
+
var widthVal = isNOU(this.changedWidthValue) && (selectNode.style.width.toString() === 'auto' ||
|
|
1613
|
+
selectNode.style.width !== '') ? selectNode.style.width : !isNOU(this.changedWidthValue) ?
|
|
1627
1614
|
this.changedWidthValue : (parseInt(selectNode.getClientRects()[0].width.toString(), 10)).toString();
|
|
1628
|
-
var heightVal =
|
|
1629
|
-
selectNode.style.height !== '') ? selectNode.style.height : !
|
|
1615
|
+
var heightVal = isNOU(this.changedHeightValue) && (selectNode.style.height.toString() === 'auto' ||
|
|
1616
|
+
selectNode.style.height !== '') ? selectNode.style.height : !isNOU(this.changedHeightValue) ?
|
|
1630
1617
|
this.changedHeightValue : (parseInt(selectNode.getClientRects()[0].height.toString(), 10)).toString();
|
|
1618
|
+
if (selectNode.style.width === '') {
|
|
1619
|
+
widthVal = 'auto';
|
|
1620
|
+
}
|
|
1621
|
+
if (selectNode.style.height === '') {
|
|
1622
|
+
heightVal = 'auto';
|
|
1623
|
+
}
|
|
1631
1624
|
this.changedWidthValue = null;
|
|
1632
1625
|
this.changedHeightValue = null;
|
|
1633
1626
|
var content = '<div class="e-rte-label' + this.parent.getCssClass(true) + '"><label>' + imgWidth +
|
|
@@ -1691,10 +1684,10 @@ var Image = /** @class */ (function () {
|
|
|
1691
1684
|
};
|
|
1692
1685
|
Image.prototype.insertImage = function (e) {
|
|
1693
1686
|
this.imagDialog(e);
|
|
1694
|
-
if (!
|
|
1687
|
+
if (!isNOU(this.dialogObj)) {
|
|
1695
1688
|
this.dialogObj.element.style.maxHeight = 'inherit';
|
|
1696
1689
|
var dialogContent = this.dialogObj.element.querySelector('.e-img-content');
|
|
1697
|
-
if (((!
|
|
1690
|
+
if (((!isNOU(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
|
|
1698
1691
|
|| this.parent.editorMode === 'HTML')) {
|
|
1699
1692
|
document.getElementById(this.rteID + '_insertImage').focus();
|
|
1700
1693
|
}
|
|
@@ -1710,7 +1703,7 @@ var Image = /** @class */ (function () {
|
|
|
1710
1703
|
// eslint-disable-next-line
|
|
1711
1704
|
var proxy = this;
|
|
1712
1705
|
var iframe = proxy.parent.iframeSettings.enable;
|
|
1713
|
-
if (proxy.parent.editorMode === 'HTML' && (!iframe &&
|
|
1706
|
+
if (proxy.parent.editorMode === 'HTML' && (!iframe && isNOU(closest(e.selection.range.startContainer.parentNode, '[id='
|
|
1714
1707
|
// eslint-disable-next-line
|
|
1715
1708
|
+ "'" + this.parent.contentModule.getPanel().id + "'" + ']'))
|
|
1716
1709
|
|| (iframe && !hasClass(e.selection.range.startContainer.parentNode.ownerDocument.querySelector('body'), 'e-lib')))) {
|
|
@@ -1762,8 +1755,8 @@ var Image = /** @class */ (function () {
|
|
|
1762
1755
|
_this.parent.trigger(events.imageSelected, selectArgs, function (selectArgs) {
|
|
1763
1756
|
if (!selectArgs.cancel) {
|
|
1764
1757
|
_this.checkExtension(selectArgs.filesData[0]);
|
|
1765
|
-
altText = selectArgs.filesData[0].name;
|
|
1766
|
-
if (_this.parent.editorMode === 'HTML' &&
|
|
1758
|
+
altText = selectArgs.filesData[0].name.replace(/\.[a-zA-Z0-9]+$/, '');
|
|
1759
|
+
if (_this.parent.editorMode === 'HTML' && isNOU(_this.parent.insertImageSettings.path)) {
|
|
1767
1760
|
var reader_1 = new FileReader();
|
|
1768
1761
|
// eslint-disable-next-line
|
|
1769
1762
|
reader_1.addEventListener('load', function (e) {
|
|
@@ -1782,8 +1775,8 @@ var Image = /** @class */ (function () {
|
|
|
1782
1775
|
}
|
|
1783
1776
|
};
|
|
1784
1777
|
proxy.inputUrl.setAttribute('disabled', 'true');
|
|
1785
|
-
if (
|
|
1786
|
-
&& !
|
|
1778
|
+
if (isNOU(proxy.parent.insertImageSettings.saveUrl) && _this.isAllowedTypes
|
|
1779
|
+
&& !isNOU(_this.dialogObj)) {
|
|
1787
1780
|
_this.dialogObj.getButtons(0).element.removeAttribute('disabled');
|
|
1788
1781
|
}
|
|
1789
1782
|
});
|
|
@@ -1802,7 +1795,7 @@ var Image = /** @class */ (function () {
|
|
|
1802
1795
|
},
|
|
1803
1796
|
success: function (e) {
|
|
1804
1797
|
_this.parent.trigger(events.imageUploadSuccess, e, function (e) {
|
|
1805
|
-
if (!
|
|
1798
|
+
if (!isNOU(_this.parent.insertImageSettings.path)) {
|
|
1806
1799
|
var url = _this.parent.insertImageSettings.path + e.file.name;
|
|
1807
1800
|
// eslint-disable-next-line
|
|
1808
1801
|
var value = { url: url, selection: save };
|
|
@@ -1818,7 +1811,7 @@ var Image = /** @class */ (function () {
|
|
|
1818
1811
|
};
|
|
1819
1812
|
proxy.inputUrl.setAttribute('disabled', 'true');
|
|
1820
1813
|
}
|
|
1821
|
-
if (e.operation === 'upload' && !
|
|
1814
|
+
if (e.operation === 'upload' && !isNOU(_this.dialogObj)) {
|
|
1822
1815
|
_this.dialogObj.getButtons(0).element.removeAttribute('disabled');
|
|
1823
1816
|
}
|
|
1824
1817
|
});
|
|
@@ -2147,10 +2140,10 @@ var Image = /** @class */ (function () {
|
|
|
2147
2140
|
isUploading = true;
|
|
2148
2141
|
_this.parent.trigger(events.imageUploading, e, function (imageUploadingArgs) {
|
|
2149
2142
|
if (imageUploadingArgs.cancel) {
|
|
2150
|
-
if (!
|
|
2143
|
+
if (!isNOU(imageElement)) {
|
|
2151
2144
|
detach(imageElement);
|
|
2152
2145
|
}
|
|
2153
|
-
if (!
|
|
2146
|
+
if (!isNOU(_this.popupObj.element)) {
|
|
2154
2147
|
detach(_this.popupObj.element);
|
|
2155
2148
|
}
|
|
2156
2149
|
}
|
|
@@ -2247,7 +2240,7 @@ var Image = /** @class */ (function () {
|
|
|
2247
2240
|
imageElement.classList.add(classes.CLS_IMG_FOCUS);
|
|
2248
2241
|
e.element = imageElement;
|
|
2249
2242
|
this.parent.trigger(events.imageUploadSuccess, e, function (e) {
|
|
2250
|
-
if (!
|
|
2243
|
+
if (!isNOU(_this.parent.insertImageSettings.path)) {
|
|
2251
2244
|
var url = _this.parent.insertImageSettings.path + e.file.name;
|
|
2252
2245
|
imageElement.src = url;
|
|
2253
2246
|
imageElement.setAttribute('alt', e.file.name);
|
|
@@ -2262,7 +2255,7 @@ var Image = /** @class */ (function () {
|
|
|
2262
2255
|
};
|
|
2263
2256
|
Image.prototype.imagePaste = function (args) {
|
|
2264
2257
|
var _this = this;
|
|
2265
|
-
if (args.text.length === 0 && !
|
|
2258
|
+
if (args.text.length === 0 && !isNOU(args.file)) {
|
|
2266
2259
|
// eslint-disable-next-line
|
|
2267
2260
|
var proxy_1 = this;
|
|
2268
2261
|
var reader_2 = new FileReader();
|
|
@@ -2271,7 +2264,7 @@ var Image = /** @class */ (function () {
|
|
|
2271
2264
|
reader_2.addEventListener('load', function (e) {
|
|
2272
2265
|
var url = {
|
|
2273
2266
|
cssClass: (proxy_1.parent.insertImageSettings.display === 'inline' ? classes.CLS_IMGINLINE : classes.CLS_IMGBREAK),
|
|
2274
|
-
url: _this.parent.insertImageSettings.saveFormat === 'Base64' || !
|
|
2267
|
+
url: _this.parent.insertImageSettings.saveFormat === 'Base64' || !isNOU(args.callBack) ?
|
|
2275
2268
|
reader_2.result : URL.createObjectURL(convertToBlob(reader_2.result)),
|
|
2276
2269
|
width: {
|
|
2277
2270
|
width: proxy_1.parent.insertImageSettings.width, minWidth: proxy_1.parent.insertImageSettings.minWidth,
|
|
@@ -2282,7 +2275,7 @@ var Image = /** @class */ (function () {
|
|
|
2282
2275
|
maxHeight: proxy_1.parent.insertImageSettings.maxHeight
|
|
2283
2276
|
}
|
|
2284
2277
|
};
|
|
2285
|
-
if (!
|
|
2278
|
+
if (!isNOU(args.callBack)) {
|
|
2286
2279
|
args.callBack(url);
|
|
2287
2280
|
return;
|
|
2288
2281
|
}
|