@syncfusion/ej2-richtexteditor 24.1.41-569421 → 24.1.41-581025
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 +0 -176
- package/dist/ej2-richtexteditor.umd.min.js +1 -1
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +7822 -9502
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +5674 -7355
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/package.json +12 -12
- package/src/common/config.d.ts +0 -7
- package/src/common/config.js +0 -11
- package/src/common/constant.d.ts +0 -6
- package/src/common/constant.js +0 -6
- package/src/common/interface.d.ts +0 -12
- package/src/common/types.d.ts +0 -6
- package/src/common/util.d.ts +0 -6
- package/src/common/util.js +20 -61
- package/src/editor-manager/base/constant.d.ts +0 -6
- package/src/editor-manager/base/constant.js +0 -6
- package/src/editor-manager/base/editor-manager.d.ts +0 -5
- package/src/editor-manager/base/editor-manager.js +0 -59
- package/src/editor-manager/base/interface.d.ts +0 -8
- package/src/editor-manager/plugin/dom-node.d.ts +1 -5
- package/src/editor-manager/plugin/dom-node.js +15 -169
- package/src/editor-manager/plugin/format-painter-actions.d.ts +0 -1
- package/src/editor-manager/plugin/format-painter-actions.js +1 -19
- package/src/editor-manager/plugin/formats.d.ts +0 -1
- package/src/editor-manager/plugin/formats.js +3 -38
- package/src/editor-manager/plugin/image.js +16 -12
- package/src/editor-manager/plugin/indents.js +1 -1
- package/src/editor-manager/plugin/inserthtml.d.ts +0 -1
- package/src/editor-manager/plugin/inserthtml.js +18 -78
- package/src/editor-manager/plugin/link.js +3 -8
- package/src/editor-manager/plugin/lists.js +70 -159
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +0 -3
- package/src/editor-manager/plugin/ms-word-clean-up.js +85 -212
- package/src/editor-manager/plugin/nodecutter.js +2 -5
- package/src/editor-manager/plugin/selection-commands.d.ts +0 -2
- package/src/editor-manager/plugin/selection-commands.js +4 -209
- package/src/editor-manager/plugin/table.d.ts +1 -4
- package/src/editor-manager/plugin/table.js +49 -95
- package/src/editor-manager/plugin/toolbar-status.d.ts +2 -2
- package/src/editor-manager/plugin/toolbar-status.js +10 -20
- package/src/editor-manager/plugin/undo.d.ts +0 -1
- package/src/editor-manager/plugin/undo.js +1 -21
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +3 -4
- package/src/rich-text-editor/actions/base-quick-toolbar.js +10 -43
- package/src/rich-text-editor/actions/base-toolbar.js +34 -33
- package/src/rich-text-editor/actions/color-picker.d.ts +0 -1
- package/src/rich-text-editor/actions/color-picker.js +0 -10
- package/src/rich-text-editor/actions/count.js +1 -1
- package/src/rich-text-editor/actions/dropdown-buttons.d.ts +0 -1
- package/src/rich-text-editor/actions/dropdown-buttons.js +4 -8
- package/src/rich-text-editor/actions/emoji-picker.js +4 -4
- package/src/rich-text-editor/actions/enter-key.js +4 -8
- package/src/rich-text-editor/actions/format-painter.js +1 -4
- package/src/rich-text-editor/actions/full-screen.js +2 -3
- package/src/rich-text-editor/actions/html-editor.d.ts +2 -2
- package/src/rich-text-editor/actions/html-editor.js +42 -123
- package/src/rich-text-editor/actions/keyboard.js +1 -3
- package/src/rich-text-editor/actions/markdown-editor.js +1 -3
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +0 -3
- package/src/rich-text-editor/actions/paste-clean-up.js +14 -85
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +0 -8
- package/src/rich-text-editor/actions/quick-toolbar.js +9 -37
- package/src/rich-text-editor/actions/resize.js +1 -2
- package/src/rich-text-editor/actions/toolbar-action.js +1 -1
- package/src/rich-text-editor/actions/toolbar.d.ts +3 -2
- package/src/rich-text-editor/actions/toolbar.js +87 -18
- package/src/rich-text-editor/base/classes.d.ts +5 -0
- package/src/rich-text-editor/base/classes.js +5 -0
- package/src/rich-text-editor/base/constant.d.ts +0 -40
- package/src/rich-text-editor/base/constant.js +0 -209
- package/src/rich-text-editor/base/interface.d.ts +3 -37
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +3 -3
- package/src/rich-text-editor/base/rich-text-editor.d.ts +4 -7
- package/src/rich-text-editor/base/rich-text-editor.js +132 -156
- package/src/rich-text-editor/base/util.js +2 -11
- package/src/rich-text-editor/formatter/formatter.js +4 -16
- package/src/rich-text-editor/models/default-locale.js +26 -30
- package/src/rich-text-editor/models/items.js +2 -2
- 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/audio-module.d.ts +0 -1
- package/src/rich-text-editor/renderer/audio-module.js +4 -22
- package/src/rich-text-editor/renderer/dialog-renderer.d.ts +0 -2
- package/src/rich-text-editor/renderer/dialog-renderer.js +1 -12
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -2
- package/src/rich-text-editor/renderer/image-module.d.ts +1 -9
- package/src/rich-text-editor/renderer/image-module.js +168 -203
- package/src/rich-text-editor/renderer/link-module.js +1 -10
- package/src/rich-text-editor/renderer/table-module.d.ts +1 -8
- package/src/rich-text-editor/renderer/table-module.js +139 -301
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +0 -3
- package/src/rich-text-editor/renderer/toolbar-renderer.js +9 -94
- package/src/rich-text-editor/renderer/video-module.d.ts +0 -3
- package/src/rich-text-editor/renderer/video-module.js +41 -82
- package/src/rich-text-editor/renderer/view-source.d.ts +0 -1
- package/src/rich-text-editor/renderer/view-source.js +4 -12
- package/src/selection/selection.js +0 -3
- package/styles/bootstrap-dark.css +53 -161
- package/styles/bootstrap.css +61 -162
- package/styles/bootstrap4.css +46 -146
- package/styles/bootstrap5-dark.css +46 -151
- package/styles/bootstrap5.css +46 -151
- package/styles/fabric-dark.css +40 -140
- package/styles/fabric.css +41 -141
- package/styles/fluent-dark.css +47 -165
- package/styles/fluent.css +47 -165
- package/styles/highcontrast-light.css +40 -140
- package/styles/highcontrast.css +41 -144
- package/styles/material-dark.css +41 -145
- package/styles/material.css +41 -145
- package/styles/material3-dark.css +50 -156
- package/styles/material3.css +50 -156
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +13 -17
- package/styles/rich-text-editor/_bootstrap-definition.scss +19 -22
- package/styles/rich-text-editor/_bootstrap4-definition.scss +7 -11
- package/styles/rich-text-editor/_bootstrap5-definition.scss +3 -7
- package/styles/rich-text-editor/_fabric-dark-definition.scss +2 -6
- package/styles/rich-text-editor/_fabric-definition.scss +3 -7
- package/styles/rich-text-editor/_fluent-definition.scss +9 -13
- package/styles/rich-text-editor/_fusionnew-definition.scss +3 -7
- package/styles/rich-text-editor/_highcontrast-definition.scss +3 -7
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +2 -6
- package/styles/rich-text-editor/_layout.scss +31 -133
- package/styles/rich-text-editor/_material-dark-definition.scss +2 -6
- package/styles/rich-text-editor/_material-definition.scss +2 -6
- package/styles/rich-text-editor/_material3-definition.scss +12 -16
- package/styles/rich-text-editor/_tailwind-definition.scss +19 -23
- package/styles/rich-text-editor/_theme.scss +23 -112
- package/styles/rich-text-editor/bootstrap-dark.css +53 -161
- package/styles/rich-text-editor/bootstrap.css +61 -162
- package/styles/rich-text-editor/bootstrap4.css +46 -146
- package/styles/rich-text-editor/bootstrap5-dark.css +46 -151
- package/styles/rich-text-editor/bootstrap5.css +46 -151
- package/styles/rich-text-editor/fabric-dark.css +40 -140
- package/styles/rich-text-editor/fabric.css +41 -141
- package/styles/rich-text-editor/fluent-dark.css +47 -165
- package/styles/rich-text-editor/fluent.css +47 -165
- package/styles/rich-text-editor/highcontrast-light.css +40 -140
- package/styles/rich-text-editor/highcontrast.css +41 -144
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +2 -2
- package/styles/rich-text-editor/icons/_bootstrap.scss +2 -2
- package/styles/rich-text-editor/icons/_bootstrap4.scss +2 -2
- package/styles/rich-text-editor/icons/_bootstrap5.scss +2 -2
- package/styles/rich-text-editor/icons/_fabric-dark.scss +2 -2
- package/styles/rich-text-editor/icons/_fabric.scss +2 -2
- package/styles/rich-text-editor/icons/_fluent.scss +2 -2
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +2 -2
- package/styles/rich-text-editor/icons/_highcontrast.scss +2 -2
- package/styles/rich-text-editor/icons/_material-dark.scss +2 -2
- package/styles/rich-text-editor/icons/_material.scss +2 -2
- package/styles/rich-text-editor/icons/_material3.scss +2 -2
- package/styles/rich-text-editor/icons/_tailwind.scss +2 -2
- package/styles/rich-text-editor/material-dark.css +41 -145
- package/styles/rich-text-editor/material.css +41 -145
- package/styles/rich-text-editor/material3-dark.css +50 -156
- package/styles/rich-text-editor/material3.css +50 -156
- package/styles/rich-text-editor/tailwind-dark.css +63 -191
- package/styles/rich-text-editor/tailwind.css +63 -191
- package/styles/tailwind-dark.css +63 -191
- package/styles/tailwind.css +63 -191
- package/.eslintrc.json +0 -260
- package/src/global.d.ts +0 -1
- package/styles/rich-text-editor/_bds-definition.scss +0 -279
- package/styles/rich-text-editor/icons/_bds.scss +0 -348
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addClass, detach, EventHandler, select, Ajax, formatUnit } from '@syncfusion/ej2-base';
|
|
1
|
+
import { addClass, detach, EventHandler, isNullOrUndefined, 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,7 +8,6 @@ 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';
|
|
12
11
|
/**
|
|
13
12
|
* `Image` module is used to handle image actions.
|
|
14
13
|
*/
|
|
@@ -18,6 +17,7 @@ var Image = /** @class */ (function () {
|
|
|
18
17
|
this.isAllowedTypes = true;
|
|
19
18
|
this.pageX = null;
|
|
20
19
|
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 (!isNullOrUndefined(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 (isNullOrUndefined(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 (isNullOrUndefined(e.oldCssClass)) {
|
|
115
115
|
addClass([this.popupObj.element], e.cssClass);
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
@@ -175,6 +175,11 @@ 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 */
|
|
178
183
|
this.parent.formatter.editorManager.observer.on(events.checkUndo, this.undoStack, this);
|
|
179
184
|
this.parent.formatter.saveData();
|
|
180
185
|
};
|
|
@@ -205,15 +210,17 @@ var Image = /** @class */ (function () {
|
|
|
205
210
|
if (this.quickToolObj) {
|
|
206
211
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
207
212
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
if (target.classList.contains('e-rte-topLeft')) {
|
|
214
|
+
this.resizeBtnStat.topLeft = true;
|
|
215
|
+
}
|
|
216
|
+
if (target.classList.contains('e-rte-topRight')) {
|
|
217
|
+
this.resizeBtnStat.topRight = true;
|
|
218
|
+
}
|
|
219
|
+
if (target.classList.contains('e-rte-botLeft')) {
|
|
220
|
+
this.resizeBtnStat.botLeft = true;
|
|
221
|
+
}
|
|
222
|
+
if (target.classList.contains('e-rte-botRight')) {
|
|
223
|
+
this.resizeBtnStat.botRight = true;
|
|
217
224
|
}
|
|
218
225
|
if (Browser.isDevice && this.contentModule.getEditPanel().contains(this.imgResizeDiv) &&
|
|
219
226
|
!this.imgResizeDiv.classList.contains('e-mob-span')) {
|
|
@@ -227,7 +234,6 @@ var Image = /** @class */ (function () {
|
|
|
227
234
|
}
|
|
228
235
|
});
|
|
229
236
|
}
|
|
230
|
-
EventHandler.add(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing, this);
|
|
231
237
|
EventHandler.add(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd, this);
|
|
232
238
|
}
|
|
233
239
|
};
|
|
@@ -279,6 +285,7 @@ var Image = /** @class */ (function () {
|
|
|
279
285
|
this.imgResizePos(e, this.imgResizeDiv);
|
|
280
286
|
this.resizeImgDupPos(e);
|
|
281
287
|
this.contentModule.getEditPanel().appendChild(this.imgResizeDiv);
|
|
288
|
+
EventHandler.add(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing, this);
|
|
282
289
|
};
|
|
283
290
|
Image.prototype.getPointX = function (e) {
|
|
284
291
|
if (e.touches && e.touches.length) {
|
|
@@ -344,80 +351,89 @@ var Image = /** @class */ (function () {
|
|
|
344
351
|
};
|
|
345
352
|
}
|
|
346
353
|
};
|
|
347
|
-
Image.prototype.setAspectRatio = function (img, expectedX, expectedY) {
|
|
348
|
-
if (
|
|
354
|
+
Image.prototype.setAspectRatio = function (img, expectedX, expectedY, e) {
|
|
355
|
+
if (isNullOrUndefined(img.width)) {
|
|
349
356
|
return;
|
|
350
357
|
}
|
|
351
|
-
|
|
352
|
-
var
|
|
353
|
-
|
|
354
|
-
var
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
if (
|
|
358
|
-
if (
|
|
359
|
-
|
|
360
|
-
this.
|
|
358
|
+
// eslint-disable-next-line security/detect-unsafe-regex
|
|
359
|
+
var width = img.style.width !== '' ? img.style.width.match(/^\d+(\.\d*)?%$/g) ? parseFloat(img.style.width) :
|
|
360
|
+
parseInt(img.style.width, 10) : img.width;
|
|
361
|
+
var height = img.style.height !== '' ? parseInt(img.style.height, 10) : img.height;
|
|
362
|
+
if (width > height) {
|
|
363
|
+
img.style.minWidth = this.parent.insertImageSettings.minWidth === 0 ? '20px' : formatUnit(this.parent.insertImageSettings.minWidth);
|
|
364
|
+
if (this.parent.insertImageSettings.resizeByPercent) {
|
|
365
|
+
if (parseInt('' + img.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
|
|
366
|
+
var original = img.offsetWidth + this.mouseX;
|
|
367
|
+
var finalWidthByPerc = (original / img.offsetWidth) * (parseFloat(img.style.width).toString() === 'NaN' ? (img.offsetWidth / (parseFloat(getComputedStyle(this.parent.element).width)) * 100) : parseFloat(img.style.width));
|
|
368
|
+
img.style.width = ((finalWidthByPerc > 3) ? finalWidthByPerc : 3) + '%';
|
|
361
369
|
}
|
|
362
370
|
else {
|
|
363
|
-
this.
|
|
364
|
-
this.setImageHeight(img, expectedY, factor);
|
|
371
|
+
img.style.width = this.pixToPerc((width / height * expectedY), (img.previousElementSibling || img.parentElement)) + '%';
|
|
365
372
|
}
|
|
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';
|
|
366
385
|
}
|
|
367
386
|
else if (img.style.width !== '') {
|
|
368
|
-
|
|
369
|
-
this.
|
|
370
|
-
|
|
387
|
+
var currentWidth = (width / height * expectedY) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
|
|
388
|
+
(width / height * expectedY) : (this.parent.inputElement.getBoundingClientRect().right - 32);
|
|
389
|
+
img.style.width = currentWidth + 'px';
|
|
390
|
+
img.style.height = expectedY + 'px';
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
if (this.parent.iframeSettings.enable) {
|
|
394
|
+
img.setAttribute('width', (img.width + this.mouseX).toString());
|
|
371
395
|
}
|
|
372
396
|
else {
|
|
373
|
-
this.
|
|
397
|
+
var currentWidth = img.offsetWidth === 0 ? img.width + this.mouseX + parseInt(img.style.outlineWidth.split('p')[0], 10) : img.offsetWidth + this.mouseX;
|
|
398
|
+
img.setAttribute('width', (currentWidth).toString());
|
|
374
399
|
}
|
|
375
400
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
401
|
+
}
|
|
402
|
+
else if (height > width) {
|
|
403
|
+
if (this.parent.insertImageSettings.resizeByPercent) {
|
|
404
|
+
if (parseInt('' + img.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
|
|
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) + '%';
|
|
380
410
|
}
|
|
381
411
|
else {
|
|
382
|
-
this.
|
|
412
|
+
img.style.width = this.pixToPerc((expectedX / height * expectedY), (img.previousElementSibling || img.parentElement)) + '%';
|
|
383
413
|
}
|
|
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());
|
|
384
423
|
}
|
|
385
424
|
}
|
|
386
425
|
else {
|
|
387
|
-
this.setImageWidth(img, expectedX, factor);
|
|
388
426
|
if (this.parent.insertImageSettings.resizeByPercent) {
|
|
389
|
-
this.
|
|
427
|
+
img.style.width = this.pixToPerc(expectedX, (img.previousElementSibling || img.parentElement)) + '%';
|
|
428
|
+
img.style.height = null;
|
|
429
|
+
img.removeAttribute('height');
|
|
390
430
|
}
|
|
391
431
|
else {
|
|
392
|
-
|
|
432
|
+
img.style.width = ((expectedX >= 15) ? expectedX : 15) + 'px';
|
|
433
|
+
img.style.height = ((expectedX >= 15) ? expectedX : 15) + 'px';
|
|
393
434
|
}
|
|
394
435
|
}
|
|
395
436
|
};
|
|
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
|
-
};
|
|
421
437
|
Image.prototype.pixToPerc = function (expected, parentEle) {
|
|
422
438
|
return expected / parseFloat(getComputedStyle(parentEle).width) * 100;
|
|
423
439
|
};
|
|
@@ -440,7 +456,7 @@ var Image = /** @class */ (function () {
|
|
|
440
456
|
return;
|
|
441
457
|
}
|
|
442
458
|
_this.imgEle.parentElement.style.cursor = 'pointer';
|
|
443
|
-
_this.setAspectRatio(_this.imgEle, parseInt(width, 10), parseInt(height, 10));
|
|
459
|
+
_this.setAspectRatio(_this.imgEle, parseInt(width, 10), parseInt(height, 10), args);
|
|
444
460
|
_this.resizeImgDupPos(_this.imgEle);
|
|
445
461
|
_this.imgResizePos(_this.imgEle, _this.imgResizeDiv);
|
|
446
462
|
}
|
|
@@ -451,36 +467,34 @@ var Image = /** @class */ (function () {
|
|
|
451
467
|
this.cancelResizeAction();
|
|
452
468
|
return;
|
|
453
469
|
}
|
|
454
|
-
if (this.
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
this.
|
|
475
|
-
|
|
470
|
+
if (this.imgEle.offsetWidth >= this.parent.getInsertImgMaxWidth()) {
|
|
471
|
+
this.imgEle.style.maxHeight = this.imgEle.offsetHeight + 'px';
|
|
472
|
+
}
|
|
473
|
+
else if (isNOU(this.parent.insertImageSettings.maxHeight)) {
|
|
474
|
+
this.imgEle.style.maxHeight = '';
|
|
475
|
+
}
|
|
476
|
+
this.imgEle.style.maxWidth = (closest(this.imgEle, 'ol,ul') != null ? this.parent.getInsertImgMaxWidth() - parseInt((getComputedStyle(closest(this.imgEle, 'ol,ul')).paddingLeft), 0) : this.parent.getInsertImgMaxWidth()) + 'px';
|
|
477
|
+
var pageX = this.getPointX(e);
|
|
478
|
+
var pageY = this.getPointY(e);
|
|
479
|
+
var mouseX = (this.resizeBtnStat.botLeft || this.resizeBtnStat.topLeft) ? -(pageX - this.pageX) : (pageX - this.pageX);
|
|
480
|
+
var mouseY = (this.resizeBtnStat.botLeft || this.resizeBtnStat.topLeft) ? -(pageY - this.pageY) : (pageY - this.pageY);
|
|
481
|
+
var width = parseInt(this.imgDupPos.width, 10) + mouseX;
|
|
482
|
+
var height = parseInt(this.imgDupPos.height, 10) + mouseY;
|
|
483
|
+
this.mouseX = mouseX;
|
|
484
|
+
this.pageX = pageX;
|
|
485
|
+
this.pageY = pageY;
|
|
486
|
+
if (this.resizeBtnStat.botRight) {
|
|
487
|
+
this.imgDupMouseMove(width + 'px', height + 'px', e);
|
|
488
|
+
}
|
|
489
|
+
else if (this.resizeBtnStat.botLeft) {
|
|
490
|
+
this.imgDupMouseMove(width + 'px', height + 'px', e);
|
|
491
|
+
}
|
|
492
|
+
else if (this.resizeBtnStat.topRight) {
|
|
493
|
+
this.imgDupMouseMove(width + 'px', height + 'px', e);
|
|
494
|
+
}
|
|
495
|
+
else if (this.resizeBtnStat.topLeft) {
|
|
476
496
|
this.imgDupMouseMove(width + 'px', height + 'px', e);
|
|
477
497
|
}
|
|
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
498
|
};
|
|
485
499
|
Image.prototype.cancelResizeAction = function () {
|
|
486
500
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
|
|
@@ -491,8 +505,6 @@ var Image = /** @class */ (function () {
|
|
|
491
505
|
this.imgResizeDiv = null;
|
|
492
506
|
this.pageX = null;
|
|
493
507
|
this.pageY = null;
|
|
494
|
-
this.currentResizeHandler = null;
|
|
495
|
-
this.aspectRatio = null;
|
|
496
508
|
}
|
|
497
509
|
};
|
|
498
510
|
Image.prototype.resizeImgDupPos = function (e) {
|
|
@@ -503,8 +515,6 @@ var Image = /** @class */ (function () {
|
|
|
503
515
|
};
|
|
504
516
|
};
|
|
505
517
|
Image.prototype.resizeBtnInit = function () {
|
|
506
|
-
this.aspectRatio = null;
|
|
507
|
-
this.currentResizeHandler = null;
|
|
508
518
|
return this.resizeBtnStat = { botLeft: false, botRight: false, topRight: false, topLeft: false };
|
|
509
519
|
};
|
|
510
520
|
Image.prototype.onToolbarAction = function (args) {
|
|
@@ -577,7 +587,7 @@ var Image = /** @class */ (function () {
|
|
|
577
587
|
});
|
|
578
588
|
if (this.quickToolObj && document.body.contains(this.quickToolObj.imageQTBar.element)) {
|
|
579
589
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
580
|
-
if (!
|
|
590
|
+
if (!isNullOrUndefined(e.selectParent)) {
|
|
581
591
|
removeClass([e.selectParent[0]], 'e-img-focus');
|
|
582
592
|
}
|
|
583
593
|
}
|
|
@@ -617,7 +627,7 @@ var Image = /** @class */ (function () {
|
|
|
617
627
|
this.checkImageDel(range);
|
|
618
628
|
}
|
|
619
629
|
}
|
|
620
|
-
if (!
|
|
630
|
+
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection) &&
|
|
621
631
|
originalEvent.code !== 'KeyK') {
|
|
622
632
|
range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
|
|
623
633
|
selectNodeEle = this.parent.formatter.editorManager.nodeSelection.getNodeCollection(range);
|
|
@@ -634,13 +644,11 @@ var Image = /** @class */ (function () {
|
|
|
634
644
|
}
|
|
635
645
|
}
|
|
636
646
|
if (originalEvent.ctrlKey && (originalEvent.keyCode === 89 || originalEvent.keyCode === 90)) {
|
|
637
|
-
|
|
638
|
-
this.undoStack({ subCommand: (originalEvent.keyCode === 90 ? 'undo' : 'redo') });
|
|
639
|
-
}
|
|
647
|
+
this.undoStack({ subCommand: (originalEvent.keyCode === 90 ? 'undo' : 'redo') });
|
|
640
648
|
}
|
|
641
649
|
if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
|
|
642
650
|
if (selectNodeEle && selectNodeEle[0].nodeName === 'IMG' && selectNodeEle.length < 1) {
|
|
643
|
-
if (!
|
|
651
|
+
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
|
|
644
652
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
645
653
|
}
|
|
646
654
|
originalEvent.preventDefault();
|
|
@@ -662,7 +670,7 @@ var Image = /** @class */ (function () {
|
|
|
662
670
|
}
|
|
663
671
|
switch (originalEvent.action) {
|
|
664
672
|
case 'escape':
|
|
665
|
-
if (!
|
|
673
|
+
if (!isNullOrUndefined(this.dialogObj)) {
|
|
666
674
|
this.dialogObj.close();
|
|
667
675
|
}
|
|
668
676
|
break;
|
|
@@ -710,21 +718,13 @@ var Image = /** @class */ (function () {
|
|
|
710
718
|
}
|
|
711
719
|
break;
|
|
712
720
|
case 'insert-image':
|
|
713
|
-
if (!
|
|
721
|
+
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
|
|
714
722
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
715
723
|
}
|
|
716
724
|
this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
|
|
717
725
|
originalEvent.preventDefault();
|
|
718
726
|
break;
|
|
719
727
|
}
|
|
720
|
-
if (originalEvent.ctrlKey && originalEvent.key === 'a') {
|
|
721
|
-
this.handleSelectAll();
|
|
722
|
-
}
|
|
723
|
-
};
|
|
724
|
-
Image.prototype.handleSelectAll = function () {
|
|
725
|
-
this.cancelResizeAction();
|
|
726
|
-
var imgFocusNodes = this.parent.inputElement.querySelectorAll('.' + classes.CLS_IMG_FOCUS);
|
|
727
|
-
removeClass(imgFocusNodes, classes.CLS_IMG_FOCUS);
|
|
728
728
|
};
|
|
729
729
|
Image.prototype.openDialog = function (isInternal, event, selection, ele, parentEle) {
|
|
730
730
|
var range;
|
|
@@ -868,8 +868,8 @@ var Image = /** @class */ (function () {
|
|
|
868
868
|
};
|
|
869
869
|
Image.prototype.showImageQuickToolbar = function (e) {
|
|
870
870
|
var _this = this;
|
|
871
|
-
if (e.type !== 'Images' ||
|
|
872
|
-
||
|
|
871
|
+
if (e.type !== 'Images' || isNullOrUndefined(this.parent.quickToolbarModule)
|
|
872
|
+
|| isNullOrUndefined(this.parent.quickToolbarModule.imageQTBar) || isNullOrUndefined(e.args)) {
|
|
873
873
|
return;
|
|
874
874
|
}
|
|
875
875
|
this.quickToolObj = this.parent.quickToolbarModule;
|
|
@@ -894,17 +894,15 @@ var Image = /** @class */ (function () {
|
|
|
894
894
|
_this.parent.formatter.editorManager.nodeSelection.Clear(_this.contentModule.getDocument());
|
|
895
895
|
_this.parent.formatter.editorManager.nodeSelection.setSelectionContents(_this.contentModule.getDocument(), target);
|
|
896
896
|
_this.quickToolObj.imageQTBar.showPopup(args.pageX, pageY, target);
|
|
897
|
-
_this.resizeStart(e.args, target);
|
|
898
897
|
}, 400);
|
|
899
898
|
}
|
|
900
899
|
else {
|
|
901
|
-
|
|
902
|
-
this.quickToolObj.imageQTBar.showPopup(coordinates.left, coordinates.top, target, 'Image');
|
|
900
|
+
this.quickToolObj.imageQTBar.showPopup(args.pageX, pageY, target);
|
|
903
901
|
}
|
|
904
902
|
}
|
|
905
903
|
};
|
|
906
904
|
Image.prototype.hideImageQuickToolbar = function () {
|
|
907
|
-
if (!
|
|
905
|
+
if (!isNullOrUndefined(this.contentModule.getEditPanel().querySelector('.e-img-focus'))) {
|
|
908
906
|
removeClass([this.contentModule.getEditPanel().querySelector('.e-img-focus')], 'e-img-focus');
|
|
909
907
|
if (this.quickToolObj && this.quickToolObj.imageQTBar && document.body.contains(this.quickToolObj.imageQTBar.element)) {
|
|
910
908
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
@@ -919,7 +917,7 @@ var Image = /** @class */ (function () {
|
|
|
919
917
|
var args = e.args;
|
|
920
918
|
var showOnRightClick = this.parent.quickToolbarSettings.showOnRightClick;
|
|
921
919
|
if (args.which === 2 || (showOnRightClick && args.which === 1) || (!showOnRightClick && args.which === 3)) {
|
|
922
|
-
if ((showOnRightClick && args.which === 1) && !
|
|
920
|
+
if ((showOnRightClick && args.which === 1) && !isNullOrUndefined(args.target) &&
|
|
923
921
|
args.target.tagName === 'IMG') {
|
|
924
922
|
this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
|
|
925
923
|
this.parent.formatter.editorManager.nodeSelection.setSelectionContents(this.contentModule.getDocument(), args.target);
|
|
@@ -979,7 +977,7 @@ var Image = /** @class */ (function () {
|
|
|
979
977
|
return;
|
|
980
978
|
}
|
|
981
979
|
this.imagDialog(e);
|
|
982
|
-
if (!
|
|
980
|
+
if (!isNullOrUndefined(this.dialogObj)) {
|
|
983
981
|
var linkWrap = this.parent.createElement('div', { className: 'e-img-linkwrap' + this.parent.getCssClass(true) });
|
|
984
982
|
var linkUrl = this.i10n.getConstant('linkurl');
|
|
985
983
|
var content = '<div class="e-rte-field' + this.parent.getCssClass(true) + '">' +
|
|
@@ -1006,7 +1004,7 @@ var Image = /** @class */ (function () {
|
|
|
1006
1004
|
this.checkBoxObj.createElement = this.parent.createElement;
|
|
1007
1005
|
this.checkBoxObj.appendTo(linkTarget);
|
|
1008
1006
|
var target_1 = this.checkBoxObj.checked ? '_blank' : null;
|
|
1009
|
-
var imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('
|
|
1007
|
+
var imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('ImageLinkAriaLabel') : null;
|
|
1010
1008
|
var linkUpdate = this.i10n.getConstant('dialogUpdate');
|
|
1011
1009
|
var linkargs_1 = {
|
|
1012
1010
|
args: e.args,
|
|
@@ -1014,6 +1012,7 @@ var Image = /** @class */ (function () {
|
|
|
1014
1012
|
selectNode: e.selectNode, selectParent: e.selectParent, link: inputLink, target: target_1, ariaLabel: imageLabel
|
|
1015
1013
|
};
|
|
1016
1014
|
this.dialogObj.setProperties({
|
|
1015
|
+
height: 'inherit',
|
|
1017
1016
|
width: '290px',
|
|
1018
1017
|
header: this.parent.localeObj.getConstant('imageInsertLinkHeader'),
|
|
1019
1018
|
content: linkWrap,
|
|
@@ -1031,7 +1030,7 @@ var Image = /** @class */ (function () {
|
|
|
1031
1030
|
if (!isNOU(this.parent.cssClass)) {
|
|
1032
1031
|
this.dialogObj.setProperties({ cssClass: this.parent.cssClass });
|
|
1033
1032
|
}
|
|
1034
|
-
if (!
|
|
1033
|
+
if (!isNullOrUndefined(inputDetails)) {
|
|
1035
1034
|
inputLink.value = inputDetails.url;
|
|
1036
1035
|
// eslint-disable-next-line
|
|
1037
1036
|
(inputDetails.target) ? this.checkBoxObj.checked = true : this.checkBoxObj.checked = false;
|
|
@@ -1048,7 +1047,7 @@ var Image = /** @class */ (function () {
|
|
|
1048
1047
|
}
|
|
1049
1048
|
this.imagDialog(e);
|
|
1050
1049
|
var altText = this.i10n.getConstant('altText');
|
|
1051
|
-
if (!
|
|
1050
|
+
if (!isNullOrUndefined(this.dialogObj)) {
|
|
1052
1051
|
var altWrap = this.parent.createElement('div', { className: 'e-img-altwrap' + this.parent.getCssClass(true) });
|
|
1053
1052
|
var altHeader = this.i10n.getConstant('alternateHeader');
|
|
1054
1053
|
var linkUpdate = this.i10n.getConstant('dialogUpdate');
|
|
@@ -1066,7 +1065,7 @@ var Image = /** @class */ (function () {
|
|
|
1066
1065
|
alt: inputAlt
|
|
1067
1066
|
};
|
|
1068
1067
|
this.dialogObj.setProperties({
|
|
1069
|
-
width: '290px', header: altHeader, content: altWrap,
|
|
1068
|
+
height: 'inherit', width: '290px', header: altHeader, content: altWrap,
|
|
1070
1069
|
buttons: [{
|
|
1071
1070
|
// eslint-disable-next-line
|
|
1072
1071
|
click: function (e) {
|
|
@@ -1086,7 +1085,7 @@ var Image = /** @class */ (function () {
|
|
|
1086
1085
|
}
|
|
1087
1086
|
};
|
|
1088
1087
|
Image.prototype.insertAlt = function (e) {
|
|
1089
|
-
if (!
|
|
1088
|
+
if (!isNullOrUndefined(e.alt)) {
|
|
1090
1089
|
e.selection.restore();
|
|
1091
1090
|
if (this.parent.formatter.getUndoRedoStack().length === 0) {
|
|
1092
1091
|
this.parent.formatter.saveData();
|
|
@@ -1125,14 +1124,14 @@ var Image = /** @class */ (function () {
|
|
|
1125
1124
|
}
|
|
1126
1125
|
if (e.selectNode[0].parentElement.nodeName === 'A') {
|
|
1127
1126
|
proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
|
|
1128
|
-
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('
|
|
1127
|
+
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('ImageLinkAriaLabel') : null, selectNode: e.selectNode,
|
|
1129
1128
|
subCommand: e.args.item.subCommand
|
|
1130
1129
|
});
|
|
1131
1130
|
proxy.dialogObj.hide({ returnValue: true });
|
|
1132
1131
|
return;
|
|
1133
1132
|
}
|
|
1134
1133
|
proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
|
|
1135
|
-
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('
|
|
1134
|
+
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('ImageLinkAriaLabel') : null, selectNode: e.selectNode,
|
|
1136
1135
|
subCommand: e.args.item.subCommand, selection: e.selection
|
|
1137
1136
|
});
|
|
1138
1137
|
var captionEle = closest(e.selectNode[0], '.e-img-caption');
|
|
@@ -1160,29 +1159,7 @@ var Image = /** @class */ (function () {
|
|
|
1160
1159
|
if (this.parent.formatter.getUndoRedoStack().length === 0) {
|
|
1161
1160
|
this.parent.formatter.saveData();
|
|
1162
1161
|
}
|
|
1163
|
-
|
|
1164
|
-
if (e.selection.range.startContainer.nodeName === 'SPAN' &&
|
|
1165
|
-
restoreStartElement.classList.contains('e-img-wrap') &&
|
|
1166
|
-
restoreStartElement.parentElement.classList.contains('e-img-caption')) {
|
|
1167
|
-
restoreStartElement = restoreStartElement.parentElement;
|
|
1168
|
-
if (!isNOU(restoreStartElement.previousSibling)) {
|
|
1169
|
-
var lastNode = restoreStartElement.previousSibling;
|
|
1170
|
-
while (lastNode.nodeName !== '#text' && lastNode.nodeName !== 'BR') {
|
|
1171
|
-
lastNode = lastNode.lastChild;
|
|
1172
|
-
}
|
|
1173
|
-
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.contentModule.getDocument(), lastNode, lastNode.nodeName !== 'BR' ? lastNode.textContent.length : 0);
|
|
1174
|
-
}
|
|
1175
|
-
else if (!isNOU(restoreStartElement.nextSibling)) {
|
|
1176
|
-
var firstNode = restoreStartElement.nextSibling;
|
|
1177
|
-
while (firstNode.nodeName !== '#text' && firstNode.nodeName !== 'BR') {
|
|
1178
|
-
firstNode = firstNode.firstChild;
|
|
1179
|
-
}
|
|
1180
|
-
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.contentModule.getDocument(), firstNode, 0);
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
else {
|
|
1184
|
-
e.selection.restore();
|
|
1185
|
-
}
|
|
1162
|
+
e.selection.restore();
|
|
1186
1163
|
if (this.contentModule.getEditPanel().querySelector('.e-img-resize')) {
|
|
1187
1164
|
this.removeResizeEle();
|
|
1188
1165
|
}
|
|
@@ -1196,7 +1173,7 @@ var Image = /** @class */ (function () {
|
|
|
1196
1173
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
1197
1174
|
}
|
|
1198
1175
|
this.cancelResizeAction();
|
|
1199
|
-
if (
|
|
1176
|
+
if (isNullOrUndefined(keyCode)) {
|
|
1200
1177
|
this.parent.trigger(events.afterImageDelete, args);
|
|
1201
1178
|
}
|
|
1202
1179
|
};
|
|
@@ -1250,7 +1227,7 @@ var Image = /** @class */ (function () {
|
|
|
1250
1227
|
addClass([selectNode], 'e-rte-image');
|
|
1251
1228
|
var subCommand = (e.args.item) ?
|
|
1252
1229
|
e.args.item.subCommand : 'Caption';
|
|
1253
|
-
if (!
|
|
1230
|
+
if (!isNullOrUndefined(closest(selectNode, '.' + classes.CLS_CAPTION))) {
|
|
1254
1231
|
detach(closest(selectNode, '.' + classes.CLS_CAPTION));
|
|
1255
1232
|
if (Browser.isIE) {
|
|
1256
1233
|
this.contentModule.getEditPanel().focus();
|
|
@@ -1309,13 +1286,13 @@ var Image = /** @class */ (function () {
|
|
|
1309
1286
|
return;
|
|
1310
1287
|
}
|
|
1311
1288
|
this.imagDialog(e);
|
|
1312
|
-
if (!
|
|
1289
|
+
if (!isNullOrUndefined(this.dialogObj)) {
|
|
1313
1290
|
var imgSizeHeader = this.i10n.getConstant('imageSizeHeader');
|
|
1314
1291
|
var linkUpdate = this.i10n.getConstant('dialogUpdate');
|
|
1315
1292
|
var dialogContent = this.imgsizeInput(e);
|
|
1316
1293
|
var selectObj_1 = { args: e.args, selfImage: this, selection: e.selection, selectNode: e.selectNode };
|
|
1317
1294
|
this.dialogObj.setProperties({
|
|
1318
|
-
width: '290px', header: imgSizeHeader, content: dialogContent,
|
|
1295
|
+
height: (Browser.isDevice) ? '300px' : 'inherit', width: '290px', header: imgSizeHeader, content: dialogContent,
|
|
1319
1296
|
buttons: [{
|
|
1320
1297
|
// eslint-disable-next-line
|
|
1321
1298
|
click: function (e) {
|
|
@@ -1384,7 +1361,7 @@ var Image = /** @class */ (function () {
|
|
|
1384
1361
|
isModal: Browser.isDevice,
|
|
1385
1362
|
buttons: [{
|
|
1386
1363
|
click: this.insertImageUrl.bind(selectObj),
|
|
1387
|
-
buttonModel: { content: imgInsert, cssClass: 'e-flat e-insertImage' + this.parent.getCssClass(true), isPrimary: true, disabled:
|
|
1364
|
+
buttonModel: { content: imgInsert, cssClass: 'e-flat e-insertImage' + this.parent.getCssClass(true), isPrimary: true, disabled: true }
|
|
1388
1365
|
},
|
|
1389
1366
|
{
|
|
1390
1367
|
click: function (e) {
|
|
@@ -1396,10 +1373,10 @@ var Image = /** @class */ (function () {
|
|
|
1396
1373
|
animationSettings: { effect: 'None' },
|
|
1397
1374
|
close: function (event) {
|
|
1398
1375
|
if (_this.isImgUploaded) {
|
|
1399
|
-
_this.uploadObj.
|
|
1376
|
+
_this.uploadObj.removing();
|
|
1400
1377
|
}
|
|
1401
1378
|
_this.parent.isBlur = false;
|
|
1402
|
-
if (event &&
|
|
1379
|
+
if (event && event.event.returnValue) {
|
|
1403
1380
|
if (_this.parent.editorMode === 'HTML') {
|
|
1404
1381
|
selection.restore();
|
|
1405
1382
|
}
|
|
@@ -1414,7 +1391,7 @@ var Image = /** @class */ (function () {
|
|
|
1414
1391
|
}
|
|
1415
1392
|
};
|
|
1416
1393
|
var dialogContent = this.parent.createElement('div', { className: 'e-img-content' + this.parent.getCssClass(true) });
|
|
1417
|
-
if ((!
|
|
1394
|
+
if ((!isNullOrUndefined(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
|
|
1418
1395
|
|| this.parent.editorMode === 'HTML') {
|
|
1419
1396
|
dialogContent.appendChild(this.imgUpload(e));
|
|
1420
1397
|
}
|
|
@@ -1438,7 +1415,7 @@ var Image = /** @class */ (function () {
|
|
|
1438
1415
|
this.dialogObj = this.dialogRenderObj.render(dialogModel);
|
|
1439
1416
|
this.dialogObj.createElement = this.parent.createElement;
|
|
1440
1417
|
this.dialogObj.appendTo(imgDialog);
|
|
1441
|
-
if (
|
|
1418
|
+
if (isNullOrUndefined(this.dialogObj)) {
|
|
1442
1419
|
return;
|
|
1443
1420
|
}
|
|
1444
1421
|
if (e.selectNode && e.selectNode[0].nodeName === 'IMG' && (e.name === 'insertImage')) {
|
|
@@ -1448,7 +1425,7 @@ var Image = /** @class */ (function () {
|
|
|
1448
1425
|
if (this.quickToolObj) {
|
|
1449
1426
|
if (this.quickToolObj.imageQTBar && document.body.contains(this.quickToolObj.imageQTBar.element)) {
|
|
1450
1427
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
1451
|
-
if (!
|
|
1428
|
+
if (!isNullOrUndefined(e.selectParent)) {
|
|
1452
1429
|
removeClass([e.selectParent[0]], 'e-img-focus');
|
|
1453
1430
|
}
|
|
1454
1431
|
}
|
|
@@ -1464,6 +1441,9 @@ var Image = /** @class */ (function () {
|
|
|
1464
1441
|
Image.prototype.cancelDialog = function (e) {
|
|
1465
1442
|
this.parent.isBlur = false;
|
|
1466
1443
|
this.dialogObj.hide({ returnValue: true });
|
|
1444
|
+
if (this.isImgUploaded) {
|
|
1445
|
+
this.uploadObj.removing();
|
|
1446
|
+
}
|
|
1467
1447
|
};
|
|
1468
1448
|
Image.prototype.onDocumentClick = function (e) {
|
|
1469
1449
|
var target = e.target;
|
|
@@ -1476,7 +1456,7 @@ var Image = /** @class */ (function () {
|
|
|
1476
1456
|
if (target.nodeName !== '#document') {
|
|
1477
1457
|
this.parent.currentTarget = e.target;
|
|
1478
1458
|
}
|
|
1479
|
-
if (!
|
|
1459
|
+
if (!isNullOrUndefined(this.dialogObj) && ((
|
|
1480
1460
|
// eslint-disable-next-line
|
|
1481
1461
|
!closest(target, '[id=' + "'" + this.dialogObj.element.id + "'" + ']') && this.parent.toolbarSettings.enable && this.parent.getToolbarElement() &&
|
|
1482
1462
|
!this.parent.getToolbarElement().contains(e.target)) ||
|
|
@@ -1487,7 +1467,6 @@ var Image = /** @class */ (function () {
|
|
|
1487
1467
|
if (e.offsetX > e.target.clientWidth || e.offsetY > e.target.clientHeight) {
|
|
1488
1468
|
}
|
|
1489
1469
|
else {
|
|
1490
|
-
this.parent.notify(events.documentClickClosedBy, { closedBy: "outside click" });
|
|
1491
1470
|
this.dialogObj.hide({ returnValue: true });
|
|
1492
1471
|
this.parent.isBlur = true;
|
|
1493
1472
|
dispatchEvent(this.parent.element, 'focusout');
|
|
@@ -1516,11 +1495,9 @@ var Image = /** @class */ (function () {
|
|
|
1516
1495
|
for (var i = 0; i < items.length; i++) {
|
|
1517
1496
|
removeClass([items[i]], 'e-img-focus');
|
|
1518
1497
|
removeClass([items[i]], 'e-resize');
|
|
1498
|
+
items[i].style.maxWidth = '';
|
|
1519
1499
|
}
|
|
1520
1500
|
}
|
|
1521
|
-
if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
|
|
1522
|
-
this.dialogObj.hide();
|
|
1523
|
-
}
|
|
1524
1501
|
};
|
|
1525
1502
|
Image.prototype.removeResizeEle = function () {
|
|
1526
1503
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
|
|
@@ -1532,6 +1509,7 @@ var Image = /** @class */ (function () {
|
|
|
1532
1509
|
this.cancelResizeAction();
|
|
1533
1510
|
}
|
|
1534
1511
|
};
|
|
1512
|
+
// eslint-disable-next-line
|
|
1535
1513
|
Image.prototype.imageUrlPopup = function (e) {
|
|
1536
1514
|
var _this = this;
|
|
1537
1515
|
var imgUrl = this.parent.createElement('div', { className: 'imgUrl' + this.parent.getCssClass(true) });
|
|
@@ -1550,10 +1528,6 @@ var Image = /** @class */ (function () {
|
|
|
1550
1528
|
}
|
|
1551
1529
|
}
|
|
1552
1530
|
});
|
|
1553
|
-
if (e.selectNode && e.selectNode[0].nodeName === 'IMG') {
|
|
1554
|
-
var regex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
|
|
1555
|
-
this.inputUrl.value = e.selectNode[0].src.match(regex) ? e.selectNode[0].src : '';
|
|
1556
|
-
}
|
|
1557
1531
|
imgUrl.appendChild(this.inputUrl);
|
|
1558
1532
|
return imgUrl;
|
|
1559
1533
|
};
|
|
@@ -1562,13 +1536,10 @@ var Image = /** @class */ (function () {
|
|
|
1562
1536
|
var proxy = this.selfImage;
|
|
1563
1537
|
proxy.isImgUploaded = false;
|
|
1564
1538
|
var url = proxy.inputUrl.value;
|
|
1565
|
-
if (proxy.parent.editorMode === 'Markdown' && url === '') {
|
|
1566
|
-
url = 'http://';
|
|
1567
|
-
}
|
|
1568
1539
|
if (proxy.parent.formatter.getUndoRedoStack().length === 0) {
|
|
1569
1540
|
proxy.parent.formatter.saveData();
|
|
1570
1541
|
}
|
|
1571
|
-
if (!
|
|
1542
|
+
if (!isNullOrUndefined(proxy.uploadUrl) && proxy.uploadUrl.url !== '') {
|
|
1572
1543
|
proxy.uploadUrl.cssClass = (proxy.parent.insertImageSettings.display === 'inline' ?
|
|
1573
1544
|
classes.CLS_IMGINLINE : classes.CLS_IMGBREAK);
|
|
1574
1545
|
proxy.dialogObj.hide({ returnValue: false });
|
|
@@ -1580,7 +1551,7 @@ var Image = /** @class */ (function () {
|
|
|
1580
1551
|
}
|
|
1581
1552
|
}
|
|
1582
1553
|
else if (url !== '') {
|
|
1583
|
-
if (proxy.parent.editorMode === 'HTML' &&
|
|
1554
|
+
if (proxy.parent.editorMode === 'HTML' && isNullOrUndefined(closest(
|
|
1584
1555
|
// eslint-disable-next-line
|
|
1585
1556
|
this.selection.range.startContainer.parentNode, '[id=' + "'" + proxy.contentModule.getPanel().id + "'" + ']'))) {
|
|
1586
1557
|
proxy.contentModule.getEditPanel().focus();
|
|
@@ -1589,7 +1560,7 @@ var Image = /** @class */ (function () {
|
|
|
1589
1560
|
this.selectParent = proxy.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
|
|
1590
1561
|
}
|
|
1591
1562
|
var regex = /[\w-]+.(jpg|png|jpeg|gif)/g;
|
|
1592
|
-
var matchUrl = (!
|
|
1563
|
+
var matchUrl = (!isNullOrUndefined(url.match(regex)) && proxy.parent.editorMode === 'HTML') ? url.match(regex)[0] : '';
|
|
1593
1564
|
var value = {
|
|
1594
1565
|
cssClass: (proxy.parent.insertImageSettings.display === 'inline' ? classes.CLS_IMGINLINE : classes.CLS_IMGBREAK),
|
|
1595
1566
|
url: url, selection: this.selection, altText: matchUrl,
|
|
@@ -1612,18 +1583,12 @@ var Image = /** @class */ (function () {
|
|
|
1612
1583
|
var imgHeight = this.i10n.getConstant('imageHeight');
|
|
1613
1584
|
var imgWidth = this.i10n.getConstant('imageWidth');
|
|
1614
1585
|
var imgSizeWrap = this.parent.createElement('div', { className: 'e-img-sizewrap' + this.parent.getCssClass(true) });
|
|
1615
|
-
var widthVal =
|
|
1616
|
-
selectNode.style.width !== '') ? selectNode.style.width : !
|
|
1586
|
+
var widthVal = isNullOrUndefined(this.changedWidthValue) && (selectNode.style.width.toString() === 'auto' ||
|
|
1587
|
+
selectNode.style.width !== '') ? selectNode.style.width : !isNullOrUndefined(this.changedWidthValue) ?
|
|
1617
1588
|
this.changedWidthValue : (parseInt(selectNode.getClientRects()[0].width.toString(), 10)).toString();
|
|
1618
|
-
var heightVal =
|
|
1619
|
-
selectNode.style.height !== '') ? selectNode.style.height : !
|
|
1589
|
+
var heightVal = isNullOrUndefined(this.changedHeightValue) && (selectNode.style.height.toString() === 'auto' ||
|
|
1590
|
+
selectNode.style.height !== '') ? selectNode.style.height : !isNullOrUndefined(this.changedHeightValue) ?
|
|
1620
1591
|
this.changedHeightValue : (parseInt(selectNode.getClientRects()[0].height.toString(), 10)).toString();
|
|
1621
|
-
if (selectNode.style.width === '') {
|
|
1622
|
-
widthVal = 'auto';
|
|
1623
|
-
}
|
|
1624
|
-
if (selectNode.style.height === '') {
|
|
1625
|
-
heightVal = 'auto';
|
|
1626
|
-
}
|
|
1627
1592
|
this.changedWidthValue = null;
|
|
1628
1593
|
this.changedHeightValue = null;
|
|
1629
1594
|
var content = '<div class="e-rte-label' + this.parent.getCssClass(true) + '"><label>' + imgWidth +
|
|
@@ -1687,10 +1652,10 @@ var Image = /** @class */ (function () {
|
|
|
1687
1652
|
};
|
|
1688
1653
|
Image.prototype.insertImage = function (e) {
|
|
1689
1654
|
this.imagDialog(e);
|
|
1690
|
-
if (!
|
|
1655
|
+
if (!isNullOrUndefined(this.dialogObj)) {
|
|
1691
1656
|
this.dialogObj.element.style.maxHeight = 'inherit';
|
|
1692
1657
|
var dialogContent = this.dialogObj.element.querySelector('.e-img-content');
|
|
1693
|
-
if (((!
|
|
1658
|
+
if (((!isNullOrUndefined(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
|
|
1694
1659
|
|| this.parent.editorMode === 'HTML')) {
|
|
1695
1660
|
document.getElementById(this.rteID + '_insertImage').focus();
|
|
1696
1661
|
}
|
|
@@ -1706,7 +1671,7 @@ var Image = /** @class */ (function () {
|
|
|
1706
1671
|
// eslint-disable-next-line
|
|
1707
1672
|
var proxy = this;
|
|
1708
1673
|
var iframe = proxy.parent.iframeSettings.enable;
|
|
1709
|
-
if (proxy.parent.editorMode === 'HTML' && (!iframe &&
|
|
1674
|
+
if (proxy.parent.editorMode === 'HTML' && (!iframe && isNullOrUndefined(closest(e.selection.range.startContainer.parentNode, '[id='
|
|
1710
1675
|
// eslint-disable-next-line
|
|
1711
1676
|
+ "'" + this.parent.contentModule.getPanel().id + "'" + ']'))
|
|
1712
1677
|
|| (iframe && !hasClass(e.selection.range.startContainer.parentNode.ownerDocument.querySelector('body'), 'e-lib')))) {
|
|
@@ -1758,8 +1723,8 @@ var Image = /** @class */ (function () {
|
|
|
1758
1723
|
_this.parent.trigger(events.imageSelected, selectArgs, function (selectArgs) {
|
|
1759
1724
|
if (!selectArgs.cancel) {
|
|
1760
1725
|
_this.checkExtension(selectArgs.filesData[0]);
|
|
1761
|
-
altText = selectArgs.filesData[0].name
|
|
1762
|
-
if (_this.parent.editorMode === 'HTML' &&
|
|
1726
|
+
altText = selectArgs.filesData[0].name;
|
|
1727
|
+
if (_this.parent.editorMode === 'HTML' && isNullOrUndefined(_this.parent.insertImageSettings.path)) {
|
|
1763
1728
|
var reader_1 = new FileReader();
|
|
1764
1729
|
// eslint-disable-next-line
|
|
1765
1730
|
reader_1.addEventListener('load', function (e) {
|
|
@@ -1778,8 +1743,8 @@ var Image = /** @class */ (function () {
|
|
|
1778
1743
|
}
|
|
1779
1744
|
};
|
|
1780
1745
|
proxy.inputUrl.setAttribute('disabled', 'true');
|
|
1781
|
-
if (
|
|
1782
|
-
&& !
|
|
1746
|
+
if (isNullOrUndefined(proxy.parent.insertImageSettings.saveUrl) && _this.isAllowedTypes
|
|
1747
|
+
&& !isNullOrUndefined(_this.dialogObj)) {
|
|
1783
1748
|
_this.dialogObj.getButtons(0).element.removeAttribute('disabled');
|
|
1784
1749
|
}
|
|
1785
1750
|
});
|
|
@@ -1798,7 +1763,7 @@ var Image = /** @class */ (function () {
|
|
|
1798
1763
|
},
|
|
1799
1764
|
success: function (e) {
|
|
1800
1765
|
_this.parent.trigger(events.imageUploadSuccess, e, function (e) {
|
|
1801
|
-
if (!
|
|
1766
|
+
if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
|
|
1802
1767
|
var url = _this.parent.insertImageSettings.path + e.file.name;
|
|
1803
1768
|
// eslint-disable-next-line
|
|
1804
1769
|
var value = { url: url, selection: save };
|
|
@@ -1814,7 +1779,7 @@ var Image = /** @class */ (function () {
|
|
|
1814
1779
|
};
|
|
1815
1780
|
proxy.inputUrl.setAttribute('disabled', 'true');
|
|
1816
1781
|
}
|
|
1817
|
-
if (e.operation === 'upload' && !
|
|
1782
|
+
if (e.operation === 'upload' && !isNullOrUndefined(_this.dialogObj)) {
|
|
1818
1783
|
_this.dialogObj.getButtons(0).element.removeAttribute('disabled');
|
|
1819
1784
|
}
|
|
1820
1785
|
});
|
|
@@ -2143,10 +2108,10 @@ var Image = /** @class */ (function () {
|
|
|
2143
2108
|
isUploading = true;
|
|
2144
2109
|
_this.parent.trigger(events.imageUploading, e, function (imageUploadingArgs) {
|
|
2145
2110
|
if (imageUploadingArgs.cancel) {
|
|
2146
|
-
if (!
|
|
2111
|
+
if (!isNullOrUndefined(imageElement)) {
|
|
2147
2112
|
detach(imageElement);
|
|
2148
2113
|
}
|
|
2149
|
-
if (!
|
|
2114
|
+
if (!isNullOrUndefined(_this.popupObj.element)) {
|
|
2150
2115
|
detach(_this.popupObj.element);
|
|
2151
2116
|
}
|
|
2152
2117
|
}
|
|
@@ -2243,7 +2208,7 @@ var Image = /** @class */ (function () {
|
|
|
2243
2208
|
imageElement.classList.add(classes.CLS_IMG_FOCUS);
|
|
2244
2209
|
e.element = imageElement;
|
|
2245
2210
|
this.parent.trigger(events.imageUploadSuccess, e, function (e) {
|
|
2246
|
-
if (!
|
|
2211
|
+
if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
|
|
2247
2212
|
var url = _this.parent.insertImageSettings.path + e.file.name;
|
|
2248
2213
|
imageElement.src = url;
|
|
2249
2214
|
imageElement.setAttribute('alt', e.file.name);
|
|
@@ -2258,7 +2223,7 @@ var Image = /** @class */ (function () {
|
|
|
2258
2223
|
};
|
|
2259
2224
|
Image.prototype.imagePaste = function (args) {
|
|
2260
2225
|
var _this = this;
|
|
2261
|
-
if (args.text.length === 0 && !
|
|
2226
|
+
if (args.text.length === 0 && !isNullOrUndefined(args.file)) {
|
|
2262
2227
|
// eslint-disable-next-line
|
|
2263
2228
|
var proxy_1 = this;
|
|
2264
2229
|
var reader_2 = new FileReader();
|
|
@@ -2267,7 +2232,7 @@ var Image = /** @class */ (function () {
|
|
|
2267
2232
|
reader_2.addEventListener('load', function (e) {
|
|
2268
2233
|
var url = {
|
|
2269
2234
|
cssClass: (proxy_1.parent.insertImageSettings.display === 'inline' ? classes.CLS_IMGINLINE : classes.CLS_IMGBREAK),
|
|
2270
|
-
url: _this.parent.insertImageSettings.saveFormat === 'Base64' || !
|
|
2235
|
+
url: _this.parent.insertImageSettings.saveFormat === 'Base64' || !isNullOrUndefined(args.callBack) ?
|
|
2271
2236
|
reader_2.result : URL.createObjectURL(convertToBlob(reader_2.result)),
|
|
2272
2237
|
width: {
|
|
2273
2238
|
width: proxy_1.parent.insertImageSettings.width, minWidth: proxy_1.parent.insertImageSettings.minWidth,
|
|
@@ -2278,7 +2243,7 @@ var Image = /** @class */ (function () {
|
|
|
2278
2243
|
maxHeight: proxy_1.parent.insertImageSettings.maxHeight
|
|
2279
2244
|
}
|
|
2280
2245
|
};
|
|
2281
|
-
if (!
|
|
2246
|
+
if (!isNullOrUndefined(args.callBack)) {
|
|
2282
2247
|
args.callBack(url);
|
|
2283
2248
|
return;
|
|
2284
2249
|
}
|