@syncfusion/ej2-richtexteditor 23.2.7-52849 → 24.1.41-569421
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/.eslintrc.json +260 -0
- package/CHANGELOG.md +203 -1
- 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 +9873 -7941
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +9967 -8034
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/package.json +13 -13
- package/src/common/config.d.ts +7 -0
- package/src/common/config.js +12 -1
- package/src/common/constant.d.ts +6 -0
- package/src/common/constant.js +6 -0
- package/src/common/interface.d.ts +12 -0
- package/src/common/types.d.ts +6 -0
- package/src/common/util.d.ts +6 -0
- package/src/common/util.js +61 -20
- package/src/editor-manager/base/constant.d.ts +6 -0
- package/src/editor-manager/base/constant.js +6 -0
- package/src/editor-manager/base/editor-manager.d.ts +5 -0
- package/src/editor-manager/base/editor-manager.js +59 -0
- package/src/editor-manager/base/interface.d.ts +8 -0
- package/src/editor-manager/plugin/audio.js +13 -3
- package/src/editor-manager/plugin/dom-node.d.ts +5 -1
- package/src/editor-manager/plugin/dom-node.js +169 -28
- package/src/editor-manager/plugin/format-painter-actions.d.ts +1 -0
- package/src/editor-manager/plugin/format-painter-actions.js +19 -1
- package/src/editor-manager/plugin/formats.d.ts +1 -0
- package/src/editor-manager/plugin/formats.js +38 -3
- package/src/editor-manager/plugin/image.js +38 -15
- package/src/editor-manager/plugin/indents.js +1 -1
- package/src/editor-manager/plugin/inserthtml.d.ts +1 -0
- package/src/editor-manager/plugin/inserthtml.js +83 -20
- package/src/editor-manager/plugin/link.js +8 -3
- package/src/editor-manager/plugin/lists.js +159 -70
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +3 -0
- package/src/editor-manager/plugin/ms-word-clean-up.js +215 -85
- package/src/editor-manager/plugin/nodecutter.js +5 -2
- package/src/editor-manager/plugin/selection-commands.d.ts +2 -0
- package/src/editor-manager/plugin/selection-commands.js +248 -4
- package/src/editor-manager/plugin/table.d.ts +4 -1
- package/src/editor-manager/plugin/table.js +95 -49
- package/src/editor-manager/plugin/toolbar-status.d.ts +2 -2
- package/src/editor-manager/plugin/toolbar-status.js +20 -10
- package/src/editor-manager/plugin/undo.d.ts +1 -0
- package/src/editor-manager/plugin/undo.js +21 -1
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +4 -3
- package/src/rich-text-editor/actions/base-quick-toolbar.js +61 -14
- package/src/rich-text-editor/actions/base-toolbar.js +33 -34
- package/src/rich-text-editor/actions/color-picker.d.ts +1 -0
- package/src/rich-text-editor/actions/color-picker.js +13 -3
- package/src/rich-text-editor/actions/count.js +1 -1
- package/src/rich-text-editor/actions/dropdown-buttons.d.ts +1 -0
- package/src/rich-text-editor/actions/dropdown-buttons.js +11 -5
- package/src/rich-text-editor/actions/emoji-picker.js +16 -7
- package/src/rich-text-editor/actions/enter-key.js +10 -5
- package/src/rich-text-editor/actions/file-manager.js +1 -1
- package/src/rich-text-editor/actions/format-painter.js +5 -2
- package/src/rich-text-editor/actions/full-screen.js +5 -4
- package/src/rich-text-editor/actions/html-editor.d.ts +2 -0
- package/src/rich-text-editor/actions/html-editor.js +124 -17
- package/src/rich-text-editor/actions/keyboard.js +3 -1
- package/src/rich-text-editor/actions/markdown-editor.js +3 -1
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +5 -0
- package/src/rich-text-editor/actions/paste-clean-up.js +156 -28
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +8 -0
- package/src/rich-text-editor/actions/quick-toolbar.js +59 -12
- package/src/rich-text-editor/actions/resize.js +2 -1
- package/src/rich-text-editor/actions/toolbar-action.js +1 -1
- package/src/rich-text-editor/actions/toolbar.d.ts +3 -3
- package/src/rich-text-editor/actions/toolbar.js +35 -96
- package/src/rich-text-editor/base/classes.d.ts +5 -5
- package/src/rich-text-editor/base/classes.js +5 -5
- package/src/rich-text-editor/base/constant.d.ts +46 -1
- package/src/rich-text-editor/base/constant.js +215 -1
- package/src/rich-text-editor/base/interface.d.ts +47 -3
- 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 +16 -4
- package/src/rich-text-editor/base/rich-text-editor.js +184 -97
- package/src/rich-text-editor/base/util.js +22 -4
- package/src/rich-text-editor/formatter/formatter.js +16 -4
- package/src/rich-text-editor/models/default-locale.js +31 -25
- package/src/rich-text-editor/models/items.js +3 -3
- 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 +1 -0
- package/src/rich-text-editor/renderer/audio-module.js +22 -4
- package/src/rich-text-editor/renderer/dialog-renderer.d.ts +2 -0
- package/src/rich-text-editor/renderer/dialog-renderer.js +22 -2
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +2 -1
- package/src/rich-text-editor/renderer/image-module.d.ts +9 -1
- package/src/rich-text-editor/renderer/image-module.js +248 -213
- package/src/rich-text-editor/renderer/link-module.js +53 -24
- package/src/rich-text-editor/renderer/table-module.d.ts +10 -1
- package/src/rich-text-editor/renderer/table-module.js +343 -168
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +3 -6
- package/src/rich-text-editor/renderer/toolbar-renderer.js +106 -101
- package/src/rich-text-editor/renderer/video-module.d.ts +3 -0
- package/src/rich-text-editor/renderer/video-module.js +82 -41
- package/src/rich-text-editor/renderer/view-source.d.ts +1 -0
- package/src/rich-text-editor/renderer/view-source.js +15 -5
- package/src/selection/selection.js +3 -0
- package/styles/bootstrap-dark.css +353 -103
- package/styles/bootstrap.css +357 -112
- package/styles/bootstrap4.css +338 -96
- package/styles/bootstrap5-dark.css +344 -97
- package/styles/bootstrap5.css +344 -97
- package/styles/fabric-dark.css +332 -90
- package/styles/fabric.css +333 -91
- package/styles/fluent-dark.css +360 -98
- package/styles/fluent.css +360 -98
- package/styles/highcontrast-light.css +332 -90
- package/styles/highcontrast.css +336 -91
- package/styles/material-dark.css +339 -92
- package/styles/material.css +339 -92
- package/styles/material3-dark.css +348 -100
- package/styles/material3.css +348 -100
- package/styles/rich-text-editor/_bds-definition.scss +279 -0
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +17 -13
- package/styles/rich-text-editor/_bootstrap-definition.scss +22 -19
- package/styles/rich-text-editor/_bootstrap4-definition.scss +11 -7
- package/styles/rich-text-editor/_bootstrap5-definition.scss +8 -4
- package/styles/rich-text-editor/_fabric-dark-definition.scss +6 -2
- package/styles/rich-text-editor/_fabric-definition.scss +7 -3
- package/styles/rich-text-editor/_fluent-definition.scss +14 -10
- package/styles/rich-text-editor/_fusionnew-definition.scss +7 -3
- package/styles/rich-text-editor/_highcontrast-definition.scss +7 -3
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +6 -2
- package/styles/rich-text-editor/_layout.scss +211 -34
- package/styles/rich-text-editor/_material-dark-definition.scss +6 -2
- package/styles/rich-text-editor/_material-definition.scss +6 -2
- package/styles/rich-text-editor/_material3-definition.scss +16 -12
- package/styles/rich-text-editor/_tailwind-definition.scss +23 -19
- package/styles/rich-text-editor/_theme.scss +113 -24
- package/styles/rich-text-editor/bootstrap-dark.css +353 -103
- package/styles/rich-text-editor/bootstrap.css +357 -112
- package/styles/rich-text-editor/bootstrap4.css +338 -96
- package/styles/rich-text-editor/bootstrap5-dark.css +344 -97
- package/styles/rich-text-editor/bootstrap5.css +344 -97
- package/styles/rich-text-editor/fabric-dark.css +332 -90
- package/styles/rich-text-editor/fabric.css +333 -91
- package/styles/rich-text-editor/fluent-dark.css +360 -98
- package/styles/rich-text-editor/fluent.css +360 -98
- package/styles/rich-text-editor/highcontrast-light.css +332 -90
- package/styles/rich-text-editor/highcontrast.css +336 -91
- package/styles/rich-text-editor/icons/_bds.scss +348 -0
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +4 -4
- package/styles/rich-text-editor/icons/_bootstrap.scss +4 -4
- package/styles/rich-text-editor/icons/_bootstrap4.scss +4 -4
- package/styles/rich-text-editor/icons/_bootstrap5.scss +4 -4
- package/styles/rich-text-editor/icons/_fabric-dark.scss +4 -4
- package/styles/rich-text-editor/icons/_fabric.scss +4 -4
- package/styles/rich-text-editor/icons/_fluent.scss +4 -4
- package/styles/rich-text-editor/icons/_fusionnew.scss +3 -3
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +4 -4
- package/styles/rich-text-editor/icons/_highcontrast.scss +4 -4
- package/styles/rich-text-editor/icons/_material-dark.scss +4 -4
- package/styles/rich-text-editor/icons/_material.scss +4 -4
- package/styles/rich-text-editor/icons/_material3.scss +4 -4
- package/styles/rich-text-editor/icons/_tailwind.scss +4 -4
- package/styles/rich-text-editor/material-dark.css +339 -92
- package/styles/rich-text-editor/material.css +339 -92
- package/styles/rich-text-editor/material3-dark.css +348 -100
- package/styles/rich-text-editor/material3.css +348 -100
- package/styles/rich-text-editor/tailwind-dark.css +383 -113
- package/styles/rich-text-editor/tailwind.css +383 -113
- package/styles/tailwind-dark.css +383 -113
- package/styles/tailwind.css +383 -113
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
|
@@ -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')) {
|
|
@@ -234,6 +227,7 @@ var Image = /** @class */ (function () {
|
|
|
234
227
|
}
|
|
235
228
|
});
|
|
236
229
|
}
|
|
230
|
+
EventHandler.add(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing, this);
|
|
237
231
|
EventHandler.add(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd, this);
|
|
238
232
|
}
|
|
239
233
|
};
|
|
@@ -265,18 +259,18 @@ var Image = /** @class */ (function () {
|
|
|
265
259
|
this.resizeBtnInit();
|
|
266
260
|
this.imgEle = e;
|
|
267
261
|
addClass([this.imgEle], 'e-resize');
|
|
268
|
-
this.imgResizeDiv = this.parent.createElement('span', { className: 'e-img-resize' +
|
|
262
|
+
this.imgResizeDiv = this.parent.createElement('span', { className: 'e-img-resize' + this.parent.getCssClass(true), id: this.rteID + '_imgResize' });
|
|
269
263
|
this.imgResizeDiv.appendChild(this.parent.createElement('span', {
|
|
270
|
-
className: 'e-rte-imageboxmark e-rte-topLeft' +
|
|
264
|
+
className: 'e-rte-imageboxmark e-rte-topLeft' + this.parent.getCssClass(true), styles: 'cursor: nwse-resize'
|
|
271
265
|
}));
|
|
272
266
|
this.imgResizeDiv.appendChild(this.parent.createElement('span', {
|
|
273
|
-
className: 'e-rte-imageboxmark e-rte-topRight' +
|
|
267
|
+
className: 'e-rte-imageboxmark e-rte-topRight' + this.parent.getCssClass(true), styles: 'cursor: nesw-resize'
|
|
274
268
|
}));
|
|
275
269
|
this.imgResizeDiv.appendChild(this.parent.createElement('span', {
|
|
276
|
-
className: 'e-rte-imageboxmark e-rte-botLeft' +
|
|
270
|
+
className: 'e-rte-imageboxmark e-rte-botLeft' + this.parent.getCssClass(true), styles: 'cursor: nesw-resize'
|
|
277
271
|
}));
|
|
278
272
|
this.imgResizeDiv.appendChild(this.parent.createElement('span', {
|
|
279
|
-
className: 'e-rte-imageboxmark e-rte-botRight' +
|
|
273
|
+
className: 'e-rte-imageboxmark e-rte-botRight' + this.parent.getCssClass(true), styles: 'cursor: nwse-resize'
|
|
280
274
|
}));
|
|
281
275
|
if (Browser.isDevice) {
|
|
282
276
|
addClass([this.imgResizeDiv], 'e-mob-rte');
|
|
@@ -285,7 +279,6 @@ var Image = /** @class */ (function () {
|
|
|
285
279
|
this.imgResizePos(e, this.imgResizeDiv);
|
|
286
280
|
this.resizeImgDupPos(e);
|
|
287
281
|
this.contentModule.getEditPanel().appendChild(this.imgResizeDiv);
|
|
288
|
-
EventHandler.add(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing, this);
|
|
289
282
|
};
|
|
290
283
|
Image.prototype.getPointX = function (e) {
|
|
291
284
|
if (e.touches && e.touches.length) {
|
|
@@ -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
|
-
img
|
|
433
|
-
img.style.height = expectedX + '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,10 +440,9 @@ 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
|
-
_this.parent.setContentHeight('', false);
|
|
463
446
|
}
|
|
464
447
|
});
|
|
465
448
|
};
|
|
@@ -468,35 +451,37 @@ var Image = /** @class */ (function () {
|
|
|
468
451
|
this.cancelResizeAction();
|
|
469
452
|
return;
|
|
470
453
|
}
|
|
471
|
-
if (this.
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
this.
|
|
492
|
-
|
|
493
|
-
else if (this.resizeBtnStat.topRight) {
|
|
494
|
-
this.imgDupMouseMove(width + 'px', height + 'px', e);
|
|
495
|
-
}
|
|
496
|
-
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;
|
|
497
476
|
this.imgDupMouseMove(width + 'px', height + 'px', e);
|
|
498
477
|
}
|
|
499
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
|
+
};
|
|
500
485
|
Image.prototype.cancelResizeAction = function () {
|
|
501
486
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
|
|
502
487
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd);
|
|
@@ -506,6 +491,8 @@ var Image = /** @class */ (function () {
|
|
|
506
491
|
this.imgResizeDiv = null;
|
|
507
492
|
this.pageX = null;
|
|
508
493
|
this.pageY = null;
|
|
494
|
+
this.currentResizeHandler = null;
|
|
495
|
+
this.aspectRatio = null;
|
|
509
496
|
}
|
|
510
497
|
};
|
|
511
498
|
Image.prototype.resizeImgDupPos = function (e) {
|
|
@@ -516,6 +503,8 @@ var Image = /** @class */ (function () {
|
|
|
516
503
|
};
|
|
517
504
|
};
|
|
518
505
|
Image.prototype.resizeBtnInit = function () {
|
|
506
|
+
this.aspectRatio = null;
|
|
507
|
+
this.currentResizeHandler = null;
|
|
519
508
|
return this.resizeBtnStat = { botLeft: false, botRight: false, topRight: false, topLeft: false };
|
|
520
509
|
};
|
|
521
510
|
Image.prototype.onToolbarAction = function (args) {
|
|
@@ -588,7 +577,7 @@ var Image = /** @class */ (function () {
|
|
|
588
577
|
});
|
|
589
578
|
if (this.quickToolObj && document.body.contains(this.quickToolObj.imageQTBar.element)) {
|
|
590
579
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
591
|
-
if (!
|
|
580
|
+
if (!isNOU(e.selectParent)) {
|
|
592
581
|
removeClass([e.selectParent[0]], 'e-img-focus');
|
|
593
582
|
}
|
|
594
583
|
}
|
|
@@ -628,7 +617,7 @@ var Image = /** @class */ (function () {
|
|
|
628
617
|
this.checkImageDel(range);
|
|
629
618
|
}
|
|
630
619
|
}
|
|
631
|
-
if (!
|
|
620
|
+
if (!isNOU(this.parent.formatter.editorManager.nodeSelection) &&
|
|
632
621
|
originalEvent.code !== 'KeyK') {
|
|
633
622
|
range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
|
|
634
623
|
selectNodeEle = this.parent.formatter.editorManager.nodeSelection.getNodeCollection(range);
|
|
@@ -645,11 +634,13 @@ var Image = /** @class */ (function () {
|
|
|
645
634
|
}
|
|
646
635
|
}
|
|
647
636
|
if (originalEvent.ctrlKey && (originalEvent.keyCode === 89 || originalEvent.keyCode === 90)) {
|
|
648
|
-
|
|
637
|
+
if (this.parent.editorMode !== 'Markdown') {
|
|
638
|
+
this.undoStack({ subCommand: (originalEvent.keyCode === 90 ? 'undo' : 'redo') });
|
|
639
|
+
}
|
|
649
640
|
}
|
|
650
641
|
if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
|
|
651
642
|
if (selectNodeEle && selectNodeEle[0].nodeName === 'IMG' && selectNodeEle.length < 1) {
|
|
652
|
-
if (!
|
|
643
|
+
if (!isNOU(this.parent.formatter.editorManager.nodeSelection)) {
|
|
653
644
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
654
645
|
}
|
|
655
646
|
originalEvent.preventDefault();
|
|
@@ -671,7 +662,7 @@ var Image = /** @class */ (function () {
|
|
|
671
662
|
}
|
|
672
663
|
switch (originalEvent.action) {
|
|
673
664
|
case 'escape':
|
|
674
|
-
if (!
|
|
665
|
+
if (!isNOU(this.dialogObj)) {
|
|
675
666
|
this.dialogObj.close();
|
|
676
667
|
}
|
|
677
668
|
break;
|
|
@@ -719,13 +710,21 @@ var Image = /** @class */ (function () {
|
|
|
719
710
|
}
|
|
720
711
|
break;
|
|
721
712
|
case 'insert-image':
|
|
722
|
-
if (!
|
|
713
|
+
if (!isNOU(this.parent.formatter.editorManager.nodeSelection)) {
|
|
723
714
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
724
715
|
}
|
|
725
716
|
this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
|
|
726
717
|
originalEvent.preventDefault();
|
|
727
718
|
break;
|
|
728
719
|
}
|
|
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);
|
|
729
728
|
};
|
|
730
729
|
Image.prototype.openDialog = function (isInternal, event, selection, ele, parentEle) {
|
|
731
730
|
var range;
|
|
@@ -771,7 +770,7 @@ var Image = /** @class */ (function () {
|
|
|
771
770
|
};
|
|
772
771
|
Image.prototype.showDialog = function () {
|
|
773
772
|
this.openDialog(false);
|
|
774
|
-
this.setCssClass({ cssClass: this.parent.
|
|
773
|
+
this.setCssClass({ cssClass: this.parent.getCssClass() });
|
|
775
774
|
};
|
|
776
775
|
Image.prototype.closeDialog = function () {
|
|
777
776
|
if (this.dialogObj) {
|
|
@@ -869,8 +868,8 @@ var Image = /** @class */ (function () {
|
|
|
869
868
|
};
|
|
870
869
|
Image.prototype.showImageQuickToolbar = function (e) {
|
|
871
870
|
var _this = this;
|
|
872
|
-
if (e.type !== 'Images' ||
|
|
873
|
-
||
|
|
871
|
+
if (e.type !== 'Images' || isNOU(this.parent.quickToolbarModule)
|
|
872
|
+
|| isNOU(this.parent.quickToolbarModule.imageQTBar) || isNOU(e.args)) {
|
|
874
873
|
return;
|
|
875
874
|
}
|
|
876
875
|
this.quickToolObj = this.parent.quickToolbarModule;
|
|
@@ -895,15 +894,17 @@ var Image = /** @class */ (function () {
|
|
|
895
894
|
_this.parent.formatter.editorManager.nodeSelection.Clear(_this.contentModule.getDocument());
|
|
896
895
|
_this.parent.formatter.editorManager.nodeSelection.setSelectionContents(_this.contentModule.getDocument(), target);
|
|
897
896
|
_this.quickToolObj.imageQTBar.showPopup(args.pageX, pageY, target);
|
|
897
|
+
_this.resizeStart(e.args, target);
|
|
898
898
|
}, 400);
|
|
899
899
|
}
|
|
900
900
|
else {
|
|
901
|
-
|
|
901
|
+
var coordinates = target.getBoundingClientRect();
|
|
902
|
+
this.quickToolObj.imageQTBar.showPopup(coordinates.left, coordinates.top, target, 'Image');
|
|
902
903
|
}
|
|
903
904
|
}
|
|
904
905
|
};
|
|
905
906
|
Image.prototype.hideImageQuickToolbar = function () {
|
|
906
|
-
if (!
|
|
907
|
+
if (!isNOU(this.contentModule.getEditPanel().querySelector('.e-img-focus'))) {
|
|
907
908
|
removeClass([this.contentModule.getEditPanel().querySelector('.e-img-focus')], 'e-img-focus');
|
|
908
909
|
if (this.quickToolObj && this.quickToolObj.imageQTBar && document.body.contains(this.quickToolObj.imageQTBar.element)) {
|
|
909
910
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
@@ -918,7 +919,7 @@ var Image = /** @class */ (function () {
|
|
|
918
919
|
var args = e.args;
|
|
919
920
|
var showOnRightClick = this.parent.quickToolbarSettings.showOnRightClick;
|
|
920
921
|
if (args.which === 2 || (showOnRightClick && args.which === 1) || (!showOnRightClick && args.which === 3)) {
|
|
921
|
-
if ((showOnRightClick && args.which === 1) && !
|
|
922
|
+
if ((showOnRightClick && args.which === 1) && !isNOU(args.target) &&
|
|
922
923
|
args.target.tagName === 'IMG') {
|
|
923
924
|
this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
|
|
924
925
|
this.parent.formatter.editorManager.nodeSelection.setSelectionContents(this.contentModule.getDocument(), args.target);
|
|
@@ -978,20 +979,20 @@ var Image = /** @class */ (function () {
|
|
|
978
979
|
return;
|
|
979
980
|
}
|
|
980
981
|
this.imagDialog(e);
|
|
981
|
-
if (!
|
|
982
|
-
var linkWrap = this.parent.createElement('div', { className: 'e-img-linkwrap' +
|
|
982
|
+
if (!isNOU(this.dialogObj)) {
|
|
983
|
+
var linkWrap = this.parent.createElement('div', { className: 'e-img-linkwrap' + this.parent.getCssClass(true) });
|
|
983
984
|
var linkUrl = this.i10n.getConstant('linkurl');
|
|
984
|
-
var content = '<div class="e-rte-field' +
|
|
985
|
-
'<input type="text" data-role ="none" class="e-input e-img-link' +
|
|
985
|
+
var content = '<div class="e-rte-field' + this.parent.getCssClass(true) + '">' +
|
|
986
|
+
'<input type="text" data-role ="none" class="e-input e-img-link' + this.parent.getCssClass(true) + '" spellcheck="false" placeholder="' + linkUrl + '"/></div>' +
|
|
986
987
|
'<div class="e-rte-label"></div>' + '<div class="e-rte-field">' +
|
|
987
|
-
'<input type="checkbox" class="e-rte-linkTarget' +
|
|
988
|
+
'<input type="checkbox" class="e-rte-linkTarget' + this.parent.getCssClass(true) + '" data-role ="none"></div>';
|
|
988
989
|
var contentElem = parseHtml(content);
|
|
989
990
|
linkWrap.appendChild(contentElem);
|
|
990
991
|
var linkTarget = linkWrap.querySelector('.e-rte-linkTarget');
|
|
991
992
|
var inputLink = linkWrap.querySelector('.e-img-link');
|
|
992
993
|
var linkOpenLabel = this.i10n.getConstant('linkOpenInNewWindow');
|
|
993
994
|
this.checkBoxObj = new CheckBox({
|
|
994
|
-
label: linkOpenLabel, checked: true, enableRtl: this.parent.enableRtl, cssClass: this.parent.
|
|
995
|
+
label: linkOpenLabel, checked: true, enableRtl: this.parent.enableRtl, cssClass: this.parent.getCssClass(),
|
|
995
996
|
change: function (e) {
|
|
996
997
|
if (e.checked) {
|
|
997
998
|
target_1 = '_blank';
|
|
@@ -1005,14 +1006,14 @@ var Image = /** @class */ (function () {
|
|
|
1005
1006
|
this.checkBoxObj.createElement = this.parent.createElement;
|
|
1006
1007
|
this.checkBoxObj.appendTo(linkTarget);
|
|
1007
1008
|
var target_1 = this.checkBoxObj.checked ? '_blank' : null;
|
|
1009
|
+
var imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null;
|
|
1008
1010
|
var linkUpdate = this.i10n.getConstant('dialogUpdate');
|
|
1009
1011
|
var linkargs_1 = {
|
|
1010
1012
|
args: e.args,
|
|
1011
1013
|
selfImage: this, selection: e.selection,
|
|
1012
|
-
selectNode: e.selectNode, selectParent: e.selectParent, link: inputLink, target: target_1
|
|
1014
|
+
selectNode: e.selectNode, selectParent: e.selectParent, link: inputLink, target: target_1, ariaLabel: imageLabel
|
|
1013
1015
|
};
|
|
1014
1016
|
this.dialogObj.setProperties({
|
|
1015
|
-
height: 'inherit',
|
|
1016
1017
|
width: '290px',
|
|
1017
1018
|
header: this.parent.localeObj.getConstant('imageInsertLinkHeader'),
|
|
1018
1019
|
content: linkWrap,
|
|
@@ -1022,7 +1023,7 @@ var Image = /** @class */ (function () {
|
|
|
1022
1023
|
_this.insertlink(linkargs_1);
|
|
1023
1024
|
},
|
|
1024
1025
|
buttonModel: {
|
|
1025
|
-
content: linkUpdate, cssClass: 'e-flat e-update-link' +
|
|
1026
|
+
content: linkUpdate, cssClass: 'e-flat e-update-link' + this.parent.getCssClass(true), isPrimary: true
|
|
1026
1027
|
}
|
|
1027
1028
|
}],
|
|
1028
1029
|
cssClass: this.dialogObj.cssClass + ' e-rte-img-link-dialog'
|
|
@@ -1030,7 +1031,7 @@ var Image = /** @class */ (function () {
|
|
|
1030
1031
|
if (!isNOU(this.parent.cssClass)) {
|
|
1031
1032
|
this.dialogObj.setProperties({ cssClass: this.parent.cssClass });
|
|
1032
1033
|
}
|
|
1033
|
-
if (!
|
|
1034
|
+
if (!isNOU(inputDetails)) {
|
|
1034
1035
|
inputLink.value = inputDetails.url;
|
|
1035
1036
|
// eslint-disable-next-line
|
|
1036
1037
|
(inputDetails.target) ? this.checkBoxObj.checked = true : this.checkBoxObj.checked = false;
|
|
@@ -1047,14 +1048,14 @@ var Image = /** @class */ (function () {
|
|
|
1047
1048
|
}
|
|
1048
1049
|
this.imagDialog(e);
|
|
1049
1050
|
var altText = this.i10n.getConstant('altText');
|
|
1050
|
-
if (!
|
|
1051
|
-
var altWrap = this.parent.createElement('div', { className: 'e-img-altwrap' +
|
|
1051
|
+
if (!isNOU(this.dialogObj)) {
|
|
1052
|
+
var altWrap = this.parent.createElement('div', { className: 'e-img-altwrap' + this.parent.getCssClass(true) });
|
|
1052
1053
|
var altHeader = this.i10n.getConstant('alternateHeader');
|
|
1053
1054
|
var linkUpdate = this.i10n.getConstant('dialogUpdate');
|
|
1054
1055
|
var getAlt = (e.selectNode[0].getAttribute('alt') === null) ? '' :
|
|
1055
1056
|
e.selectNode[0].getAttribute('alt');
|
|
1056
|
-
var content = '<div class="e-rte-field' +
|
|
1057
|
-
'<input type="text" spellcheck="false" class="e-input e-img-alt' +
|
|
1057
|
+
var content = '<div class="e-rte-field' + this.parent.getCssClass(true) + '">' +
|
|
1058
|
+
'<input type="text" spellcheck="false" class="e-input e-img-alt' + this.parent.getCssClass(true) + '" placeholder="' + altText + '"/>' +
|
|
1058
1059
|
'</div>';
|
|
1059
1060
|
var contentElem = parseHtml(content);
|
|
1060
1061
|
contentElem.querySelector('input').setAttribute('value', getAlt);
|
|
@@ -1065,14 +1066,14 @@ var Image = /** @class */ (function () {
|
|
|
1065
1066
|
alt: inputAlt
|
|
1066
1067
|
};
|
|
1067
1068
|
this.dialogObj.setProperties({
|
|
1068
|
-
|
|
1069
|
+
width: '290px', header: altHeader, content: altWrap,
|
|
1069
1070
|
buttons: [{
|
|
1070
1071
|
// eslint-disable-next-line
|
|
1071
1072
|
click: function (e) {
|
|
1072
1073
|
_this.insertAlt(altArgs_1);
|
|
1073
1074
|
},
|
|
1074
1075
|
buttonModel: {
|
|
1075
|
-
content: linkUpdate, cssClass: 'e-flat e-update-alt' +
|
|
1076
|
+
content: linkUpdate, cssClass: 'e-flat e-update-alt' + this.parent.getCssClass(true), isPrimary: true
|
|
1076
1077
|
}
|
|
1077
1078
|
}],
|
|
1078
1079
|
cssClass: this.dialogObj.cssClass + ' e-rte-img-alt-dialog'
|
|
@@ -1085,7 +1086,7 @@ var Image = /** @class */ (function () {
|
|
|
1085
1086
|
}
|
|
1086
1087
|
};
|
|
1087
1088
|
Image.prototype.insertAlt = function (e) {
|
|
1088
|
-
if (!
|
|
1089
|
+
if (!isNOU(e.alt)) {
|
|
1089
1090
|
e.selection.restore();
|
|
1090
1091
|
if (this.parent.formatter.getUndoRedoStack().length === 0) {
|
|
1091
1092
|
this.parent.formatter.saveData();
|
|
@@ -1124,14 +1125,14 @@ var Image = /** @class */ (function () {
|
|
|
1124
1125
|
}
|
|
1125
1126
|
if (e.selectNode[0].parentElement.nodeName === 'A') {
|
|
1126
1127
|
proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
|
|
1127
|
-
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, selectNode: e.selectNode,
|
|
1128
|
+
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
|
|
1128
1129
|
subCommand: e.args.item.subCommand
|
|
1129
1130
|
});
|
|
1130
1131
|
proxy.dialogObj.hide({ returnValue: true });
|
|
1131
1132
|
return;
|
|
1132
1133
|
}
|
|
1133
1134
|
proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
|
|
1134
|
-
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, selectNode: e.selectNode,
|
|
1135
|
+
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
|
|
1135
1136
|
subCommand: e.args.item.subCommand, selection: e.selection
|
|
1136
1137
|
});
|
|
1137
1138
|
var captionEle = closest(e.selectNode[0], '.e-img-caption');
|
|
@@ -1159,7 +1160,29 @@ var Image = /** @class */ (function () {
|
|
|
1159
1160
|
if (this.parent.formatter.getUndoRedoStack().length === 0) {
|
|
1160
1161
|
this.parent.formatter.saveData();
|
|
1161
1162
|
}
|
|
1162
|
-
e.selection.
|
|
1163
|
+
var restoreStartElement = e.selection.range.startContainer;
|
|
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
|
+
}
|
|
1163
1186
|
if (this.contentModule.getEditPanel().querySelector('.e-img-resize')) {
|
|
1164
1187
|
this.removeResizeEle();
|
|
1165
1188
|
}
|
|
@@ -1173,7 +1196,7 @@ var Image = /** @class */ (function () {
|
|
|
1173
1196
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
1174
1197
|
}
|
|
1175
1198
|
this.cancelResizeAction();
|
|
1176
|
-
if (
|
|
1199
|
+
if (isNOU(keyCode)) {
|
|
1177
1200
|
this.parent.trigger(events.afterImageDelete, args);
|
|
1178
1201
|
}
|
|
1179
1202
|
};
|
|
@@ -1227,7 +1250,7 @@ var Image = /** @class */ (function () {
|
|
|
1227
1250
|
addClass([selectNode], 'e-rte-image');
|
|
1228
1251
|
var subCommand = (e.args.item) ?
|
|
1229
1252
|
e.args.item.subCommand : 'Caption';
|
|
1230
|
-
if (!
|
|
1253
|
+
if (!isNOU(closest(selectNode, '.' + classes.CLS_CAPTION))) {
|
|
1231
1254
|
detach(closest(selectNode, '.' + classes.CLS_CAPTION));
|
|
1232
1255
|
if (Browser.isIE) {
|
|
1233
1256
|
this.contentModule.getEditPanel().focus();
|
|
@@ -1242,11 +1265,11 @@ var Image = /** @class */ (function () {
|
|
|
1242
1265
|
}
|
|
1243
1266
|
else {
|
|
1244
1267
|
this.captionEle = this.parent.createElement('span', {
|
|
1245
|
-
className: classes.CLS_CAPTION + ' ' + classes.CLS_RTE_CAPTION +
|
|
1268
|
+
className: classes.CLS_CAPTION + ' ' + classes.CLS_RTE_CAPTION + this.parent.getCssClass(true),
|
|
1246
1269
|
attrs: { contenteditable: 'false', draggable: 'false', style: 'width:' + this.parent.insertImageSettings.width }
|
|
1247
1270
|
});
|
|
1248
|
-
var imgWrap = this.parent.createElement('span', { className: 'e-img-wrap' +
|
|
1249
|
-
var imgInner = this.parent.createElement('span', { className: 'e-img-inner' +
|
|
1271
|
+
var imgWrap = this.parent.createElement('span', { className: 'e-img-wrap' + this.parent.getCssClass(true) });
|
|
1272
|
+
var imgInner = this.parent.createElement('span', { className: 'e-img-inner' + this.parent.getCssClass(true),
|
|
1250
1273
|
attrs: { contenteditable: 'true' } });
|
|
1251
1274
|
var parent_1 = e.selectNode[0].parentElement;
|
|
1252
1275
|
if (parent_1.tagName === 'A') {
|
|
@@ -1286,20 +1309,20 @@ var Image = /** @class */ (function () {
|
|
|
1286
1309
|
return;
|
|
1287
1310
|
}
|
|
1288
1311
|
this.imagDialog(e);
|
|
1289
|
-
if (!
|
|
1312
|
+
if (!isNOU(this.dialogObj)) {
|
|
1290
1313
|
var imgSizeHeader = this.i10n.getConstant('imageSizeHeader');
|
|
1291
1314
|
var linkUpdate = this.i10n.getConstant('dialogUpdate');
|
|
1292
1315
|
var dialogContent = this.imgsizeInput(e);
|
|
1293
1316
|
var selectObj_1 = { args: e.args, selfImage: this, selection: e.selection, selectNode: e.selectNode };
|
|
1294
1317
|
this.dialogObj.setProperties({
|
|
1295
|
-
|
|
1318
|
+
width: '290px', header: imgSizeHeader, content: dialogContent,
|
|
1296
1319
|
buttons: [{
|
|
1297
1320
|
// eslint-disable-next-line
|
|
1298
1321
|
click: function (e) {
|
|
1299
1322
|
_this.insertSize(selectObj_1);
|
|
1300
1323
|
},
|
|
1301
1324
|
buttonModel: {
|
|
1302
|
-
content: linkUpdate, cssClass: 'e-flat e-update-size' +
|
|
1325
|
+
content: linkUpdate, cssClass: 'e-flat e-update-size' + this.parent.getCssClass(true), isPrimary: true
|
|
1303
1326
|
}
|
|
1304
1327
|
}],
|
|
1305
1328
|
cssClass: this.dialogObj.cssClass + ' e-rte-img-size-dialog'
|
|
@@ -1345,7 +1368,7 @@ var Image = /** @class */ (function () {
|
|
|
1345
1368
|
this.dialogObj.hide({ returnValue: true });
|
|
1346
1369
|
return;
|
|
1347
1370
|
}
|
|
1348
|
-
var imgDialog = this.parent.createElement('div', { className: 'e-rte-img-dialog' +
|
|
1371
|
+
var imgDialog = this.parent.createElement('div', { className: 'e-rte-img-dialog' + this.parent.getCssClass(true), id: this.rteID + '_image' });
|
|
1349
1372
|
this.parent.element.appendChild(imgDialog);
|
|
1350
1373
|
var imgInsert = this.i10n.getConstant('dialogInsert');
|
|
1351
1374
|
var imglinkCancel = this.i10n.getConstant('dialogCancel');
|
|
@@ -1354,29 +1377,29 @@ var Image = /** @class */ (function () {
|
|
|
1354
1377
|
var selectObj = { selfImage: this, selection: e.selection, args: e.args, selectParent: e.selectParent };
|
|
1355
1378
|
var dialogModel = {
|
|
1356
1379
|
header: imgHeader,
|
|
1357
|
-
cssClass: classes.CLS_RTE_ELEMENTS +
|
|
1380
|
+
cssClass: classes.CLS_RTE_ELEMENTS + this.parent.getCssClass(true),
|
|
1358
1381
|
enableRtl: this.parent.enableRtl,
|
|
1359
1382
|
locale: this.parent.locale,
|
|
1360
1383
|
showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px',
|
|
1361
1384
|
isModal: Browser.isDevice,
|
|
1362
1385
|
buttons: [{
|
|
1363
1386
|
click: this.insertImageUrl.bind(selectObj),
|
|
1364
|
-
buttonModel: { content: imgInsert, cssClass: 'e-flat e-insertImage' +
|
|
1387
|
+
buttonModel: { content: imgInsert, cssClass: 'e-flat e-insertImage' + this.parent.getCssClass(true), isPrimary: true, disabled: this.parent.editorMode === 'Markdown' ? false : true }
|
|
1365
1388
|
},
|
|
1366
1389
|
{
|
|
1367
1390
|
click: function (e) {
|
|
1368
1391
|
_this.cancelDialog(e);
|
|
1369
1392
|
},
|
|
1370
|
-
buttonModel: { cssClass: 'e-flat e-cancel' +
|
|
1393
|
+
buttonModel: { cssClass: 'e-flat e-cancel' + this.parent.getCssClass(true), content: imglinkCancel }
|
|
1371
1394
|
}],
|
|
1372
1395
|
target: (Browser.isDevice) ? document.body : this.parent.element,
|
|
1373
1396
|
animationSettings: { effect: 'None' },
|
|
1374
1397
|
close: function (event) {
|
|
1375
1398
|
if (_this.isImgUploaded) {
|
|
1376
|
-
_this.uploadObj.
|
|
1399
|
+
_this.uploadObj.remove();
|
|
1377
1400
|
}
|
|
1378
1401
|
_this.parent.isBlur = false;
|
|
1379
|
-
if (event && event.event.returnValue) {
|
|
1402
|
+
if (event && !isNOU(event.event) && event.event.returnValue) {
|
|
1380
1403
|
if (_this.parent.editorMode === 'HTML') {
|
|
1381
1404
|
selection.restore();
|
|
1382
1405
|
}
|
|
@@ -1390,12 +1413,12 @@ var Image = /** @class */ (function () {
|
|
|
1390
1413
|
_this.dialogObj = null;
|
|
1391
1414
|
}
|
|
1392
1415
|
};
|
|
1393
|
-
var dialogContent = this.parent.createElement('div', { className: 'e-img-content' +
|
|
1394
|
-
if ((!
|
|
1416
|
+
var dialogContent = this.parent.createElement('div', { className: 'e-img-content' + this.parent.getCssClass(true) });
|
|
1417
|
+
if ((!isNOU(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
|
|
1395
1418
|
|| this.parent.editorMode === 'HTML') {
|
|
1396
1419
|
dialogContent.appendChild(this.imgUpload(e));
|
|
1397
1420
|
}
|
|
1398
|
-
var linkHeader = this.parent.createElement('div', { className: 'e-linkheader' +
|
|
1421
|
+
var linkHeader = this.parent.createElement('div', { className: 'e-linkheader' + this.parent.getCssClass(true) });
|
|
1399
1422
|
var linkHeaderText = this.i10n.getConstant('imageLinkHeader');
|
|
1400
1423
|
if (this.parent.editorMode === 'HTML') {
|
|
1401
1424
|
linkHeader.innerHTML = linkHeaderText;
|
|
@@ -1415,7 +1438,7 @@ var Image = /** @class */ (function () {
|
|
|
1415
1438
|
this.dialogObj = this.dialogRenderObj.render(dialogModel);
|
|
1416
1439
|
this.dialogObj.createElement = this.parent.createElement;
|
|
1417
1440
|
this.dialogObj.appendTo(imgDialog);
|
|
1418
|
-
if (
|
|
1441
|
+
if (isNOU(this.dialogObj)) {
|
|
1419
1442
|
return;
|
|
1420
1443
|
}
|
|
1421
1444
|
if (e.selectNode && e.selectNode[0].nodeName === 'IMG' && (e.name === 'insertImage')) {
|
|
@@ -1425,7 +1448,7 @@ var Image = /** @class */ (function () {
|
|
|
1425
1448
|
if (this.quickToolObj) {
|
|
1426
1449
|
if (this.quickToolObj.imageQTBar && document.body.contains(this.quickToolObj.imageQTBar.element)) {
|
|
1427
1450
|
this.quickToolObj.imageQTBar.hidePopup();
|
|
1428
|
-
if (!
|
|
1451
|
+
if (!isNOU(e.selectParent)) {
|
|
1429
1452
|
removeClass([e.selectParent[0]], 'e-img-focus');
|
|
1430
1453
|
}
|
|
1431
1454
|
}
|
|
@@ -1441,9 +1464,6 @@ var Image = /** @class */ (function () {
|
|
|
1441
1464
|
Image.prototype.cancelDialog = function (e) {
|
|
1442
1465
|
this.parent.isBlur = false;
|
|
1443
1466
|
this.dialogObj.hide({ returnValue: true });
|
|
1444
|
-
if (this.isImgUploaded) {
|
|
1445
|
-
this.uploadObj.removing();
|
|
1446
|
-
}
|
|
1447
1467
|
};
|
|
1448
1468
|
Image.prototype.onDocumentClick = function (e) {
|
|
1449
1469
|
var target = e.target;
|
|
@@ -1456,7 +1476,7 @@ var Image = /** @class */ (function () {
|
|
|
1456
1476
|
if (target.nodeName !== '#document') {
|
|
1457
1477
|
this.parent.currentTarget = e.target;
|
|
1458
1478
|
}
|
|
1459
|
-
if (!
|
|
1479
|
+
if (!isNOU(this.dialogObj) && ((
|
|
1460
1480
|
// eslint-disable-next-line
|
|
1461
1481
|
!closest(target, '[id=' + "'" + this.dialogObj.element.id + "'" + ']') && this.parent.toolbarSettings.enable && this.parent.getToolbarElement() &&
|
|
1462
1482
|
!this.parent.getToolbarElement().contains(e.target)) ||
|
|
@@ -1467,6 +1487,7 @@ var Image = /** @class */ (function () {
|
|
|
1467
1487
|
if (e.offsetX > e.target.clientWidth || e.offsetY > e.target.clientHeight) {
|
|
1468
1488
|
}
|
|
1469
1489
|
else {
|
|
1490
|
+
this.parent.notify(events.documentClickClosedBy, { closedBy: "outside click" });
|
|
1470
1491
|
this.dialogObj.hide({ returnValue: true });
|
|
1471
1492
|
this.parent.isBlur = true;
|
|
1472
1493
|
dispatchEvent(this.parent.element, 'focusout');
|
|
@@ -1495,9 +1516,11 @@ var Image = /** @class */ (function () {
|
|
|
1495
1516
|
for (var i = 0; i < items.length; i++) {
|
|
1496
1517
|
removeClass([items[i]], 'e-img-focus');
|
|
1497
1518
|
removeClass([items[i]], 'e-resize');
|
|
1498
|
-
items[i].style.maxWidth = '';
|
|
1499
1519
|
}
|
|
1500
1520
|
}
|
|
1521
|
+
if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
|
|
1522
|
+
this.dialogObj.hide();
|
|
1523
|
+
}
|
|
1501
1524
|
};
|
|
1502
1525
|
Image.prototype.removeResizeEle = function () {
|
|
1503
1526
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
|
|
@@ -1509,13 +1532,12 @@ var Image = /** @class */ (function () {
|
|
|
1509
1532
|
this.cancelResizeAction();
|
|
1510
1533
|
}
|
|
1511
1534
|
};
|
|
1512
|
-
// eslint-disable-next-line
|
|
1513
1535
|
Image.prototype.imageUrlPopup = function (e) {
|
|
1514
1536
|
var _this = this;
|
|
1515
|
-
var imgUrl = this.parent.createElement('div', { className: 'imgUrl' +
|
|
1537
|
+
var imgUrl = this.parent.createElement('div', { className: 'imgUrl' + this.parent.getCssClass(true) });
|
|
1516
1538
|
var placeUrl = this.i10n.getConstant('imageUrl');
|
|
1517
1539
|
this.inputUrl = this.parent.createElement('input', {
|
|
1518
|
-
className: 'e-input e-img-url' +
|
|
1540
|
+
className: 'e-input e-img-url' + this.parent.getCssClass(true),
|
|
1519
1541
|
attrs: { placeholder: placeUrl, spellcheck: 'false', 'aria-label': this.i10n.getConstant('imageLinkHeader') }
|
|
1520
1542
|
});
|
|
1521
1543
|
this.inputUrl.addEventListener('input', function () {
|
|
@@ -1528,6 +1550,10 @@ var Image = /** @class */ (function () {
|
|
|
1528
1550
|
}
|
|
1529
1551
|
}
|
|
1530
1552
|
});
|
|
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
|
+
}
|
|
1531
1557
|
imgUrl.appendChild(this.inputUrl);
|
|
1532
1558
|
return imgUrl;
|
|
1533
1559
|
};
|
|
@@ -1536,10 +1562,13 @@ var Image = /** @class */ (function () {
|
|
|
1536
1562
|
var proxy = this.selfImage;
|
|
1537
1563
|
proxy.isImgUploaded = false;
|
|
1538
1564
|
var url = proxy.inputUrl.value;
|
|
1565
|
+
if (proxy.parent.editorMode === 'Markdown' && url === '') {
|
|
1566
|
+
url = 'http://';
|
|
1567
|
+
}
|
|
1539
1568
|
if (proxy.parent.formatter.getUndoRedoStack().length === 0) {
|
|
1540
1569
|
proxy.parent.formatter.saveData();
|
|
1541
1570
|
}
|
|
1542
|
-
if (!
|
|
1571
|
+
if (!isNOU(proxy.uploadUrl) && proxy.uploadUrl.url !== '') {
|
|
1543
1572
|
proxy.uploadUrl.cssClass = (proxy.parent.insertImageSettings.display === 'inline' ?
|
|
1544
1573
|
classes.CLS_IMGINLINE : classes.CLS_IMGBREAK);
|
|
1545
1574
|
proxy.dialogObj.hide({ returnValue: false });
|
|
@@ -1551,7 +1580,7 @@ var Image = /** @class */ (function () {
|
|
|
1551
1580
|
}
|
|
1552
1581
|
}
|
|
1553
1582
|
else if (url !== '') {
|
|
1554
|
-
if (proxy.parent.editorMode === 'HTML' &&
|
|
1583
|
+
if (proxy.parent.editorMode === 'HTML' && isNOU(closest(
|
|
1555
1584
|
// eslint-disable-next-line
|
|
1556
1585
|
this.selection.range.startContainer.parentNode, '[id=' + "'" + proxy.contentModule.getPanel().id + "'" + ']'))) {
|
|
1557
1586
|
proxy.contentModule.getEditPanel().focus();
|
|
@@ -1560,7 +1589,7 @@ var Image = /** @class */ (function () {
|
|
|
1560
1589
|
this.selectParent = proxy.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
|
|
1561
1590
|
}
|
|
1562
1591
|
var regex = /[\w-]+.(jpg|png|jpeg|gif)/g;
|
|
1563
|
-
var matchUrl = (!
|
|
1592
|
+
var matchUrl = (!isNOU(url.match(regex)) && proxy.parent.editorMode === 'HTML') ? url.match(regex)[0] : '';
|
|
1564
1593
|
var value = {
|
|
1565
1594
|
cssClass: (proxy.parent.insertImageSettings.display === 'inline' ? classes.CLS_IMGINLINE : classes.CLS_IMGBREAK),
|
|
1566
1595
|
url: url, selection: this.selection, altText: matchUrl,
|
|
@@ -1582,19 +1611,25 @@ var Image = /** @class */ (function () {
|
|
|
1582
1611
|
var selectNode = e.selectNode[0];
|
|
1583
1612
|
var imgHeight = this.i10n.getConstant('imageHeight');
|
|
1584
1613
|
var imgWidth = this.i10n.getConstant('imageWidth');
|
|
1585
|
-
var imgSizeWrap = this.parent.createElement('div', { className: 'e-img-sizewrap' +
|
|
1586
|
-
var widthVal =
|
|
1587
|
-
selectNode.style.width !== '') ? selectNode.style.width : !
|
|
1614
|
+
var imgSizeWrap = this.parent.createElement('div', { className: 'e-img-sizewrap' + this.parent.getCssClass(true) });
|
|
1615
|
+
var widthVal = isNOU(this.changedWidthValue) && (selectNode.style.width.toString() === 'auto' ||
|
|
1616
|
+
selectNode.style.width !== '') ? selectNode.style.width : !isNOU(this.changedWidthValue) ?
|
|
1588
1617
|
this.changedWidthValue : (parseInt(selectNode.getClientRects()[0].width.toString(), 10)).toString();
|
|
1589
|
-
var heightVal =
|
|
1590
|
-
selectNode.style.height !== '') ? selectNode.style.height : !
|
|
1618
|
+
var heightVal = isNOU(this.changedHeightValue) && (selectNode.style.height.toString() === 'auto' ||
|
|
1619
|
+
selectNode.style.height !== '') ? selectNode.style.height : !isNOU(this.changedHeightValue) ?
|
|
1591
1620
|
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
|
+
}
|
|
1592
1627
|
this.changedWidthValue = null;
|
|
1593
1628
|
this.changedHeightValue = null;
|
|
1594
|
-
var content = '<div class="e-rte-label' +
|
|
1595
|
-
'</label></div><div class="e-rte-field' +
|
|
1596
|
-
'<div class="e-rte-label' +
|
|
1597
|
-
'<input type="text" id="imgheight" class="e-img-height' +
|
|
1629
|
+
var content = '<div class="e-rte-label' + this.parent.getCssClass(true) + '"><label>' + imgWidth +
|
|
1630
|
+
'</label></div><div class="e-rte-field' + this.parent.getCssClass(true) + '"><input type="text" id="imgwidth" class="e-img-width' + this.parent.getCssClass(true) + '"/></div>' +
|
|
1631
|
+
'<div class="e-rte-label' + this.parent.getCssClass(true) + '">' + '<label>' + imgHeight + '</label></div><div class="e-rte-field' + this.parent.getCssClass(true) + '"> ' +
|
|
1632
|
+
'<input type="text" id="imgheight" class="e-img-height' + this.parent.getCssClass(true) + '"/></div>';
|
|
1598
1633
|
var contentElem = parseHtml(content);
|
|
1599
1634
|
contentElem.getElementById('imgwidth').setAttribute('value', widthVal);
|
|
1600
1635
|
contentElem.getElementById('imgheight').setAttribute('value', heightVal);
|
|
@@ -1602,7 +1637,7 @@ var Image = /** @class */ (function () {
|
|
|
1602
1637
|
this.widthNum = new TextBox({
|
|
1603
1638
|
value: formatUnit(widthVal),
|
|
1604
1639
|
enableRtl: this.parent.enableRtl,
|
|
1605
|
-
cssClass: this.parent.
|
|
1640
|
+
cssClass: this.parent.getCssClass(),
|
|
1606
1641
|
input: function (e) {
|
|
1607
1642
|
_this.inputWidthValue = formatUnit(_this.inputValue(e.value));
|
|
1608
1643
|
}
|
|
@@ -1612,7 +1647,7 @@ var Image = /** @class */ (function () {
|
|
|
1612
1647
|
this.heightNum = new TextBox({
|
|
1613
1648
|
value: formatUnit(heightVal),
|
|
1614
1649
|
enableRtl: this.parent.enableRtl,
|
|
1615
|
-
cssClass: this.parent.
|
|
1650
|
+
cssClass: this.parent.getCssClass(),
|
|
1616
1651
|
input: function (e) {
|
|
1617
1652
|
_this.inputHeightValue = formatUnit(_this.inputValue(e.value));
|
|
1618
1653
|
}
|
|
@@ -1652,10 +1687,10 @@ var Image = /** @class */ (function () {
|
|
|
1652
1687
|
};
|
|
1653
1688
|
Image.prototype.insertImage = function (e) {
|
|
1654
1689
|
this.imagDialog(e);
|
|
1655
|
-
if (!
|
|
1690
|
+
if (!isNOU(this.dialogObj)) {
|
|
1656
1691
|
this.dialogObj.element.style.maxHeight = 'inherit';
|
|
1657
1692
|
var dialogContent = this.dialogObj.element.querySelector('.e-img-content');
|
|
1658
|
-
if (((!
|
|
1693
|
+
if (((!isNOU(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
|
|
1659
1694
|
|| this.parent.editorMode === 'HTML')) {
|
|
1660
1695
|
document.getElementById(this.rteID + '_insertImage').focus();
|
|
1661
1696
|
}
|
|
@@ -1671,7 +1706,7 @@ var Image = /** @class */ (function () {
|
|
|
1671
1706
|
// eslint-disable-next-line
|
|
1672
1707
|
var proxy = this;
|
|
1673
1708
|
var iframe = proxy.parent.iframeSettings.enable;
|
|
1674
|
-
if (proxy.parent.editorMode === 'HTML' && (!iframe &&
|
|
1709
|
+
if (proxy.parent.editorMode === 'HTML' && (!iframe && isNOU(closest(e.selection.range.startContainer.parentNode, '[id='
|
|
1675
1710
|
// eslint-disable-next-line
|
|
1676
1711
|
+ "'" + this.parent.contentModule.getPanel().id + "'" + ']'))
|
|
1677
1712
|
|| (iframe && !hasClass(e.selection.range.startContainer.parentNode.ownerDocument.querySelector('body'), 'e-lib')))) {
|
|
@@ -1684,16 +1719,16 @@ var Image = /** @class */ (function () {
|
|
|
1684
1719
|
save = e.selection;
|
|
1685
1720
|
selectParent = e.selectParent;
|
|
1686
1721
|
}
|
|
1687
|
-
var uploadParentEle = this.parent.createElement('div', { className: 'e-img-uploadwrap e-droparea' +
|
|
1722
|
+
var uploadParentEle = this.parent.createElement('div', { className: 'e-img-uploadwrap e-droparea' + this.parent.getCssClass(true) });
|
|
1688
1723
|
var deviceImgUpMsg = this.i10n.getConstant('imageDeviceUploadMessage');
|
|
1689
1724
|
var imgUpMsg = this.i10n.getConstant('imageUploadMessage');
|
|
1690
|
-
var span = this.parent.createElement('span', { className: 'e-droptext' +
|
|
1725
|
+
var span = this.parent.createElement('span', { className: 'e-droptext' + this.parent.getCssClass(true) });
|
|
1691
1726
|
var spanMsg = this.parent.createElement('span', {
|
|
1692
|
-
className: 'e-rte-upload-text' +
|
|
1727
|
+
className: 'e-rte-upload-text' + this.parent.getCssClass(true), innerHTML: ((Browser.isDevice) ? deviceImgUpMsg : imgUpMsg)
|
|
1693
1728
|
});
|
|
1694
1729
|
span.appendChild(spanMsg);
|
|
1695
1730
|
var btnEle = this.parent.createElement('button', {
|
|
1696
|
-
className: 'e-browsebtn' +
|
|
1731
|
+
className: 'e-browsebtn' + this.parent.getCssClass(true), id: this.rteID + '_insertImage', attrs: { autofocus: 'true', type: 'button' }
|
|
1697
1732
|
});
|
|
1698
1733
|
span.appendChild(btnEle);
|
|
1699
1734
|
uploadParentEle.appendChild(span);
|
|
@@ -1705,7 +1740,7 @@ var Image = /** @class */ (function () {
|
|
|
1705
1740
|
var btnClick = (Browser.isDevice) ? span : btnEle;
|
|
1706
1741
|
EventHandler.add(btnClick, 'click', this.fileSelect, this);
|
|
1707
1742
|
var uploadEle = this.parent.createElement('input', {
|
|
1708
|
-
id: this.rteID + '_upload', attrs: { type: 'File', name: 'UploadFiles' }, className: this.parent.
|
|
1743
|
+
id: this.rteID + '_upload', attrs: { type: 'File', name: 'UploadFiles' }, className: this.parent.getCssClass()
|
|
1709
1744
|
});
|
|
1710
1745
|
uploadParentEle.appendChild(uploadEle);
|
|
1711
1746
|
var altText;
|
|
@@ -1713,7 +1748,7 @@ var Image = /** @class */ (function () {
|
|
|
1713
1748
|
var filesData;
|
|
1714
1749
|
this.uploadObj = new Uploader({
|
|
1715
1750
|
asyncSettings: { saveUrl: this.parent.insertImageSettings.saveUrl, removeUrl: this.parent.insertImageSettings.removeUrl },
|
|
1716
|
-
dropArea: span, multiple: false, enableRtl: this.parent.enableRtl, cssClass: this.parent.
|
|
1751
|
+
dropArea: span, multiple: false, enableRtl: this.parent.enableRtl, cssClass: this.parent.getCssClass(),
|
|
1717
1752
|
allowedExtensions: this.parent.insertImageSettings.allowedTypes.toString(),
|
|
1718
1753
|
selected: function (e) {
|
|
1719
1754
|
proxy.isImgUploaded = true;
|
|
@@ -1723,8 +1758,8 @@ var Image = /** @class */ (function () {
|
|
|
1723
1758
|
_this.parent.trigger(events.imageSelected, selectArgs, function (selectArgs) {
|
|
1724
1759
|
if (!selectArgs.cancel) {
|
|
1725
1760
|
_this.checkExtension(selectArgs.filesData[0]);
|
|
1726
|
-
altText = selectArgs.filesData[0].name;
|
|
1727
|
-
if (_this.parent.editorMode === 'HTML' &&
|
|
1761
|
+
altText = selectArgs.filesData[0].name.replace(/\.[a-zA-Z0-9]+$/, '');
|
|
1762
|
+
if (_this.parent.editorMode === 'HTML' && isNOU(_this.parent.insertImageSettings.path)) {
|
|
1728
1763
|
var reader_1 = new FileReader();
|
|
1729
1764
|
// eslint-disable-next-line
|
|
1730
1765
|
reader_1.addEventListener('load', function (e) {
|
|
@@ -1743,8 +1778,8 @@ var Image = /** @class */ (function () {
|
|
|
1743
1778
|
}
|
|
1744
1779
|
};
|
|
1745
1780
|
proxy.inputUrl.setAttribute('disabled', 'true');
|
|
1746
|
-
if (
|
|
1747
|
-
&& !
|
|
1781
|
+
if (isNOU(proxy.parent.insertImageSettings.saveUrl) && _this.isAllowedTypes
|
|
1782
|
+
&& !isNOU(_this.dialogObj)) {
|
|
1748
1783
|
_this.dialogObj.getButtons(0).element.removeAttribute('disabled');
|
|
1749
1784
|
}
|
|
1750
1785
|
});
|
|
@@ -1763,7 +1798,7 @@ var Image = /** @class */ (function () {
|
|
|
1763
1798
|
},
|
|
1764
1799
|
success: function (e) {
|
|
1765
1800
|
_this.parent.trigger(events.imageUploadSuccess, e, function (e) {
|
|
1766
|
-
if (!
|
|
1801
|
+
if (!isNOU(_this.parent.insertImageSettings.path)) {
|
|
1767
1802
|
var url = _this.parent.insertImageSettings.path + e.file.name;
|
|
1768
1803
|
// eslint-disable-next-line
|
|
1769
1804
|
var value = { url: url, selection: save };
|
|
@@ -1779,7 +1814,7 @@ var Image = /** @class */ (function () {
|
|
|
1779
1814
|
};
|
|
1780
1815
|
proxy.inputUrl.setAttribute('disabled', 'true');
|
|
1781
1816
|
}
|
|
1782
|
-
if (e.operation === 'upload' && !
|
|
1817
|
+
if (e.operation === 'upload' && !isNOU(_this.dialogObj)) {
|
|
1783
1818
|
_this.dialogObj.getButtons(0).element.removeAttribute('disabled');
|
|
1784
1819
|
}
|
|
1785
1820
|
});
|
|
@@ -1787,9 +1822,9 @@ var Image = /** @class */ (function () {
|
|
|
1787
1822
|
failure: function (e) {
|
|
1788
1823
|
_this.parent.trigger(events.imageUploadFailed, e);
|
|
1789
1824
|
},
|
|
1790
|
-
removing: function () {
|
|
1825
|
+
removing: function (removeEventArgs) {
|
|
1791
1826
|
// eslint-disable-next-line
|
|
1792
|
-
_this.parent.trigger(events.imageRemoving,
|
|
1827
|
+
_this.parent.trigger(events.imageRemoving, removeEventArgs, function (e) {
|
|
1793
1828
|
proxy.isImgUploaded = false;
|
|
1794
1829
|
_this.dialogObj.getButtons(0).element.disabled = true;
|
|
1795
1830
|
proxy.inputUrl.removeAttribute('disabled');
|
|
@@ -2078,7 +2113,7 @@ var Image = /** @class */ (function () {
|
|
|
2078
2113
|
saveUrl: this.parent.insertImageSettings.saveUrl,
|
|
2079
2114
|
removeUrl: this.parent.insertImageSettings.removeUrl
|
|
2080
2115
|
},
|
|
2081
|
-
cssClass: classes.CLS_RTE_DIALOG_UPLOAD +
|
|
2116
|
+
cssClass: classes.CLS_RTE_DIALOG_UPLOAD + this.parent.getCssClass(true),
|
|
2082
2117
|
dropArea: this.parent.element,
|
|
2083
2118
|
allowedExtensions: this.parent.insertImageSettings.allowedTypes.toString(),
|
|
2084
2119
|
removing: function () {
|
|
@@ -2108,10 +2143,10 @@ var Image = /** @class */ (function () {
|
|
|
2108
2143
|
isUploading = true;
|
|
2109
2144
|
_this.parent.trigger(events.imageUploading, e, function (imageUploadingArgs) {
|
|
2110
2145
|
if (imageUploadingArgs.cancel) {
|
|
2111
|
-
if (!
|
|
2146
|
+
if (!isNOU(imageElement)) {
|
|
2112
2147
|
detach(imageElement);
|
|
2113
2148
|
}
|
|
2114
|
-
if (!
|
|
2149
|
+
if (!isNOU(_this.popupObj.element)) {
|
|
2115
2150
|
detach(_this.popupObj.element);
|
|
2116
2151
|
}
|
|
2117
2152
|
}
|
|
@@ -2208,7 +2243,7 @@ var Image = /** @class */ (function () {
|
|
|
2208
2243
|
imageElement.classList.add(classes.CLS_IMG_FOCUS);
|
|
2209
2244
|
e.element = imageElement;
|
|
2210
2245
|
this.parent.trigger(events.imageUploadSuccess, e, function (e) {
|
|
2211
|
-
if (!
|
|
2246
|
+
if (!isNOU(_this.parent.insertImageSettings.path)) {
|
|
2212
2247
|
var url = _this.parent.insertImageSettings.path + e.file.name;
|
|
2213
2248
|
imageElement.src = url;
|
|
2214
2249
|
imageElement.setAttribute('alt', e.file.name);
|
|
@@ -2223,7 +2258,7 @@ var Image = /** @class */ (function () {
|
|
|
2223
2258
|
};
|
|
2224
2259
|
Image.prototype.imagePaste = function (args) {
|
|
2225
2260
|
var _this = this;
|
|
2226
|
-
if (args.text.length === 0 && !
|
|
2261
|
+
if (args.text.length === 0 && !isNOU(args.file)) {
|
|
2227
2262
|
// eslint-disable-next-line
|
|
2228
2263
|
var proxy_1 = this;
|
|
2229
2264
|
var reader_2 = new FileReader();
|
|
@@ -2232,7 +2267,7 @@ var Image = /** @class */ (function () {
|
|
|
2232
2267
|
reader_2.addEventListener('load', function (e) {
|
|
2233
2268
|
var url = {
|
|
2234
2269
|
cssClass: (proxy_1.parent.insertImageSettings.display === 'inline' ? classes.CLS_IMGINLINE : classes.CLS_IMGBREAK),
|
|
2235
|
-
url: _this.parent.insertImageSettings.saveFormat === 'Base64' || !
|
|
2270
|
+
url: _this.parent.insertImageSettings.saveFormat === 'Base64' || !isNOU(args.callBack) ?
|
|
2236
2271
|
reader_2.result : URL.createObjectURL(convertToBlob(reader_2.result)),
|
|
2237
2272
|
width: {
|
|
2238
2273
|
width: proxy_1.parent.insertImageSettings.width, minWidth: proxy_1.parent.insertImageSettings.minWidth,
|
|
@@ -2243,7 +2278,7 @@ var Image = /** @class */ (function () {
|
|
|
2243
2278
|
maxHeight: proxy_1.parent.insertImageSettings.maxHeight
|
|
2244
2279
|
}
|
|
2245
2280
|
};
|
|
2246
|
-
if (!
|
|
2281
|
+
if (!isNOU(args.callBack)) {
|
|
2247
2282
|
args.callBack(url);
|
|
2248
2283
|
return;
|
|
2249
2284
|
}
|
|
@@ -2284,10 +2319,10 @@ var Image = /** @class */ (function () {
|
|
|
2284
2319
|
*/
|
|
2285
2320
|
/* eslint-enable */
|
|
2286
2321
|
Image.prototype.destroy = function () {
|
|
2287
|
-
this.prevSelectedImgEle = undefined;
|
|
2288
2322
|
if (isNOU(this.parent)) {
|
|
2289
2323
|
return;
|
|
2290
2324
|
}
|
|
2325
|
+
this.prevSelectedImgEle = undefined;
|
|
2291
2326
|
this.removeEventListener();
|
|
2292
2327
|
};
|
|
2293
2328
|
Image.prototype.moduleDestroy = function () {
|