@syncfusion/ej2-richtexteditor 20.1.55 → 20.1.58
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 +40 -0
- package/dist/ej2-richtexteditor.umd.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +481 -93
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +473 -93
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/dist/global/ej2-richtexteditor.min.js +2 -2
- package/dist/global/ej2-richtexteditor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +11 -11
- package/src/editor-manager/plugin/dom-node.js +7 -1
- package/src/editor-manager/plugin/lists.d.ts +1 -0
- package/src/editor-manager/plugin/lists.js +38 -1
- package/src/editor-manager/plugin/selection-commands.js +10 -2
- package/src/rich-text-editor/actions/base-quick-toolbar.js +8 -3
- package/src/rich-text-editor/actions/base-toolbar.d.ts +1 -0
- package/src/rich-text-editor/actions/base-toolbar.js +14 -1
- package/src/rich-text-editor/actions/color-picker.d.ts +2 -0
- package/src/rich-text-editor/actions/color-picker.js +22 -1
- package/src/rich-text-editor/actions/dropdown-buttons.d.ts +2 -0
- package/src/rich-text-editor/actions/dropdown-buttons.js +25 -0
- package/src/rich-text-editor/actions/file-manager.d.ts +1 -0
- package/src/rich-text-editor/actions/file-manager.js +14 -1
- package/src/rich-text-editor/actions/html-editor.js +11 -1
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +6 -0
- package/src/rich-text-editor/actions/paste-clean-up.js +79 -47
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +2 -0
- package/src/rich-text-editor/actions/quick-toolbar.js +23 -2
- package/src/rich-text-editor/actions/toolbar.d.ts +1 -0
- package/src/rich-text-editor/actions/toolbar.js +15 -1
- package/src/rich-text-editor/base/constant.d.ts +10 -0
- package/src/rich-text-editor/base/constant.js +10 -0
- package/src/rich-text-editor/base/interface.d.ts +14 -0
- package/src/rich-text-editor/base/rich-text-editor.js +43 -1
- package/src/rich-text-editor/base/util.js +5 -0
- package/src/rich-text-editor/formatter/formatter.js +15 -0
- package/src/rich-text-editor/renderer/content-renderer.js +2 -1
- package/src/rich-text-editor/renderer/image-module.d.ts +5 -0
- package/src/rich-text-editor/renderer/image-module.js +57 -13
- package/src/rich-text-editor/renderer/link-module.d.ts +2 -0
- package/src/rich-text-editor/renderer/link-module.js +19 -2
- package/src/rich-text-editor/renderer/table-module.d.ts +6 -0
- package/src/rich-text-editor/renderer/table-module.js +58 -17
- package/src/rich-text-editor/renderer/toolbar-renderer.js +2 -1
- package/styles/bootstrap-dark.css +135 -519
- package/styles/bootstrap.css +136 -525
- package/styles/bootstrap4.css +145 -572
- package/styles/bootstrap5-dark.css +135 -539
- package/styles/bootstrap5.css +135 -539
- package/styles/fabric-dark.css +134 -518
- package/styles/fabric.css +135 -519
- package/styles/fluent-dark.css +134 -521
- package/styles/fluent.css +134 -521
- package/styles/highcontrast-light.css +135 -519
- package/styles/highcontrast.css +135 -517
- package/styles/material-dark.css +134 -518
- package/styles/material.css +135 -519
- package/styles/rich-text-editor/bootstrap-dark.css +135 -519
- package/styles/rich-text-editor/bootstrap.css +136 -525
- package/styles/rich-text-editor/bootstrap4.css +145 -572
- package/styles/rich-text-editor/bootstrap5-dark.css +135 -539
- package/styles/rich-text-editor/bootstrap5.css +135 -539
- package/styles/rich-text-editor/fabric-dark.css +134 -518
- package/styles/rich-text-editor/fabric.css +135 -519
- package/styles/rich-text-editor/fluent-dark.css +134 -521
- package/styles/rich-text-editor/fluent.css +134 -521
- package/styles/rich-text-editor/highcontrast-light.css +135 -519
- package/styles/rich-text-editor/highcontrast.css +135 -517
- package/styles/rich-text-editor/material-dark.css +134 -518
- package/styles/rich-text-editor/material.css +135 -519
- package/styles/rich-text-editor/tailwind-dark.css +135 -524
- package/styles/rich-text-editor/tailwind.css +135 -524
- package/styles/tailwind-dark.css +135 -524
- package/styles/tailwind.css +135 -524
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as events from '../base/constant';
|
|
2
2
|
import { Popup } from '@syncfusion/ej2-popups';
|
|
3
3
|
import { RadioButton } from '@syncfusion/ej2-buttons';
|
|
4
|
-
import { isNullOrUndefined as isNOU, isNullOrUndefined, detach, extend, addClass } from '@syncfusion/ej2-base';
|
|
4
|
+
import { isNullOrUndefined as isNOU, isNullOrUndefined, detach, extend, addClass, removeClass } from '@syncfusion/ej2-base';
|
|
5
5
|
import { getUniqueID, Browser } from '@syncfusion/ej2-base';
|
|
6
6
|
import { CLS_RTE_PASTE_KEEP_FORMAT, CLS_RTE_PASTE_REMOVE_FORMAT, CLS_RTE_PASTE_PLAIN_FORMAT } from '../base/classes';
|
|
7
7
|
import { CLS_RTE_PASTE_OK, CLS_RTE_PASTE_CANCEL, CLS_RTE_DIALOG_MIN_HEIGHT } from '../base/classes';
|
|
@@ -42,6 +42,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
this.parent.on(events.pasteClean, this.pasteClean, this);
|
|
45
|
+
this.parent.on(events.bindCssClass, this.setCssClass, this);
|
|
45
46
|
this.parent.on(events.destroy, this.destroy, this);
|
|
46
47
|
};
|
|
47
48
|
PasteCleanup.prototype.destroy = function () {
|
|
@@ -52,6 +53,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
55
|
this.parent.off(events.pasteClean, this.pasteClean);
|
|
56
|
+
this.parent.off(events.bindCssClass, this.setCssClass);
|
|
55
57
|
this.parent.off(events.destroy, this.destroy);
|
|
56
58
|
};
|
|
57
59
|
PasteCleanup.prototype.pasteClean = function (e) {
|
|
@@ -231,7 +233,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
231
233
|
id: this.parent.element.id + '_upload', attrs: { type: 'File', name: 'UploadFiles' }
|
|
232
234
|
});
|
|
233
235
|
var offsetY = this.parent.iframeSettings.enable ? -50 : -90;
|
|
234
|
-
|
|
236
|
+
this.popupObj = new Popup(popupEle, {
|
|
235
237
|
relateTo: imgElem,
|
|
236
238
|
height: '85px',
|
|
237
239
|
width: '300px',
|
|
@@ -244,19 +246,22 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
244
246
|
// eslint-disable-next-line
|
|
245
247
|
close: function (event) {
|
|
246
248
|
_this.parent.isBlur = false;
|
|
247
|
-
popupObj.destroy();
|
|
248
|
-
detach(popupObj.element);
|
|
249
|
+
_this.popupObj.destroy();
|
|
250
|
+
detach(_this.popupObj.element);
|
|
249
251
|
}
|
|
250
252
|
});
|
|
251
|
-
popupObj.element.style.display = 'none';
|
|
252
|
-
addClass([popupObj.element], [classes.CLS_POPUP_OPEN, classes.CLS_RTE_UPLOAD_POPUP]);
|
|
253
|
+
this.popupObj.element.style.display = 'none';
|
|
254
|
+
addClass([this.popupObj.element], [classes.CLS_POPUP_OPEN, classes.CLS_RTE_UPLOAD_POPUP]);
|
|
255
|
+
if (!isNOU(this.parent.cssClass)) {
|
|
256
|
+
addClass([this.popupObj.element], this.parent.cssClass);
|
|
257
|
+
}
|
|
253
258
|
var timeOut = fileList.size > 1000000 ? 300 : 100;
|
|
254
259
|
setTimeout(function () {
|
|
255
|
-
_this.refreshPopup(imgElem, popupObj);
|
|
260
|
+
_this.refreshPopup(imgElem, _this.popupObj);
|
|
256
261
|
}, timeOut);
|
|
257
262
|
var rawFile;
|
|
258
263
|
var beforeUploadArgs;
|
|
259
|
-
|
|
264
|
+
this.uploadObj = new Uploader({
|
|
260
265
|
asyncSettings: {
|
|
261
266
|
saveUrl: this.parent.insertImageSettings.saveUrl,
|
|
262
267
|
removeUrl: this.parent.insertImageSettings.removeUrl
|
|
@@ -266,7 +271,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
266
271
|
allowedExtensions: this.parent.insertImageSettings.allowedTypes.toString(),
|
|
267
272
|
success: function (e) {
|
|
268
273
|
setTimeout(function () {
|
|
269
|
-
_this.popupClose(popupObj, uploadObj, imgElem, e);
|
|
274
|
+
_this.popupClose(_this.popupObj, _this.uploadObj, imgElem, e);
|
|
270
275
|
}, 900);
|
|
271
276
|
},
|
|
272
277
|
uploading: function (e) {
|
|
@@ -276,8 +281,8 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
276
281
|
if (!isNullOrUndefined(imgElem)) {
|
|
277
282
|
detach(imgElem);
|
|
278
283
|
}
|
|
279
|
-
if (!isNullOrUndefined(popupObj.element)) {
|
|
280
|
-
detach(popupObj.element);
|
|
284
|
+
if (!isNullOrUndefined(_this.popupObj.element)) {
|
|
285
|
+
detach(_this.popupObj.element);
|
|
281
286
|
}
|
|
282
287
|
}
|
|
283
288
|
else {
|
|
@@ -297,11 +302,11 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
297
302
|
}
|
|
298
303
|
_this.toolbarEnableDisable(true);
|
|
299
304
|
/* eslint-disable */
|
|
300
|
-
uploadObj.currentRequestHeader = beforeUploadArgs.currentRequest ?
|
|
301
|
-
beforeUploadArgs.currentRequest : uploadObj.currentRequestHeader;
|
|
302
|
-
uploadObj.customFormDatas = beforeUploadArgs.customFormData && beforeUploadArgs.customFormData.length > 0 ?
|
|
303
|
-
beforeUploadArgs.customFormData : uploadObj.customFormDatas;
|
|
304
|
-
uploadObj.uploadFiles(rawFile, null);
|
|
305
|
+
_this.uploadObj.currentRequestHeader = beforeUploadArgs.currentRequest ?
|
|
306
|
+
beforeUploadArgs.currentRequest : _this.uploadObj.currentRequestHeader;
|
|
307
|
+
_this.uploadObj.customFormDatas = beforeUploadArgs.customFormData && beforeUploadArgs.customFormData.length > 0 ?
|
|
308
|
+
beforeUploadArgs.customFormData : _this.uploadObj.customFormDatas;
|
|
309
|
+
_this.uploadObj.uploadFiles(rawFile, null);
|
|
305
310
|
/* eslint-enable */
|
|
306
311
|
});
|
|
307
312
|
}
|
|
@@ -313,7 +318,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
313
318
|
// eslint-disable-next-line
|
|
314
319
|
failure: function (e) {
|
|
315
320
|
setTimeout(function () {
|
|
316
|
-
_this.uploadFailure(imgElem, uploadObj, popupObj, e);
|
|
321
|
+
_this.uploadFailure(imgElem, _this.uploadObj, _this.popupObj, e);
|
|
317
322
|
}, 900);
|
|
318
323
|
},
|
|
319
324
|
canceling: function () {
|
|
@@ -322,7 +327,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
322
327
|
detach(imgElem.nextSibling);
|
|
323
328
|
}
|
|
324
329
|
detach(imgElem);
|
|
325
|
-
popupObj.close();
|
|
330
|
+
_this.popupObj.close();
|
|
326
331
|
},
|
|
327
332
|
selected: function (e) {
|
|
328
333
|
e.cancel = true;
|
|
@@ -336,10 +341,10 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
336
341
|
detach(imgElem.nextSibling);
|
|
337
342
|
}
|
|
338
343
|
detach(imgElem);
|
|
339
|
-
popupObj.close();
|
|
344
|
+
_this.popupObj.close();
|
|
340
345
|
}
|
|
341
346
|
});
|
|
342
|
-
uploadObj.appendTo(popupObj.element.childNodes[0]);
|
|
347
|
+
this.uploadObj.appendTo(this.popupObj.element.childNodes[0]);
|
|
343
348
|
/* eslint-disable */
|
|
344
349
|
var fileData = [{
|
|
345
350
|
name: fileList.name,
|
|
@@ -349,13 +354,13 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
349
354
|
validationMessages: { minSize: "", maxSize: "" },
|
|
350
355
|
statusCode: '1'
|
|
351
356
|
}];
|
|
352
|
-
uploadObj.createFileList(fileData);
|
|
353
|
-
uploadObj.filesData.push(fileData[0]);
|
|
357
|
+
this.uploadObj.createFileList(fileData);
|
|
358
|
+
this.uploadObj.filesData.push(fileData[0]);
|
|
354
359
|
/* eslint-enable */
|
|
355
360
|
rawFile = fileData;
|
|
356
|
-
uploadObj.upload(fileData);
|
|
357
|
-
popupObj.element.getElementsByClassName('e-file-select-wrap')[0].style.display = 'none';
|
|
358
|
-
detach(popupObj.element.querySelector('.e-rte-dialog-upload .e-file-select-wrap'));
|
|
361
|
+
this.uploadObj.upload(fileData);
|
|
362
|
+
this.popupObj.element.getElementsByClassName('e-file-select-wrap')[0].style.display = 'none';
|
|
363
|
+
detach(this.popupObj.element.querySelector('.e-rte-dialog-upload .e-file-select-wrap'));
|
|
359
364
|
};
|
|
360
365
|
PasteCleanup.prototype.uploadFailure = function (imgElem, uploadObj, popupObj, e) {
|
|
361
366
|
this.parent.inputElement.contentEditable = 'true';
|
|
@@ -448,19 +453,19 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
448
453
|
}
|
|
449
454
|
};
|
|
450
455
|
PasteCleanup.prototype.radioRender = function () {
|
|
451
|
-
|
|
456
|
+
this.keepRadioButton = new RadioButton({ label: this.i10n.getConstant('keepFormat'),
|
|
452
457
|
name: 'pasteOption', checked: true });
|
|
453
|
-
keepRadioButton.isStringTemplate = true;
|
|
458
|
+
this.keepRadioButton.isStringTemplate = true;
|
|
454
459
|
var keepFormatElement = this.parent.element.querySelector('#keepFormating');
|
|
455
|
-
keepRadioButton.appendTo(keepFormatElement);
|
|
456
|
-
|
|
457
|
-
cleanRadioButton.isStringTemplate = true;
|
|
460
|
+
this.keepRadioButton.appendTo(keepFormatElement);
|
|
461
|
+
this.cleanRadioButton = new RadioButton({ label: this.i10n.getConstant('cleanFormat'), name: 'pasteOption' });
|
|
462
|
+
this.cleanRadioButton.isStringTemplate = true;
|
|
458
463
|
var cleanFormatElement = this.parent.element.querySelector('#cleanFormat');
|
|
459
|
-
cleanRadioButton.appendTo(cleanFormatElement);
|
|
460
|
-
|
|
461
|
-
plainTextRadioButton.isStringTemplate = true;
|
|
464
|
+
this.cleanRadioButton.appendTo(cleanFormatElement);
|
|
465
|
+
this.plainTextRadioButton = new RadioButton({ label: this.i10n.getConstant('plainText'), name: 'pasteOption' });
|
|
466
|
+
this.plainTextRadioButton.isStringTemplate = true;
|
|
462
467
|
var plainTextElement = this.parent.element.querySelector('#plainTextFormat');
|
|
463
|
-
plainTextRadioButton.appendTo(plainTextElement);
|
|
468
|
+
this.plainTextRadioButton.appendTo(plainTextElement);
|
|
464
469
|
};
|
|
465
470
|
PasteCleanup.prototype.selectFormatting = function (value, args, keepChecked, cleanChecked) {
|
|
466
471
|
if (keepChecked) {
|
|
@@ -481,15 +486,15 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
481
486
|
buttons: [
|
|
482
487
|
{
|
|
483
488
|
click: function () {
|
|
484
|
-
if (!
|
|
489
|
+
if (!_this.dialogObj.isDestroyed) {
|
|
485
490
|
var keepChecked = _this.parent.element.querySelector('#keepFormating').checked;
|
|
486
491
|
var cleanChecked = _this.parent.element.querySelector('#cleanFormat').checked;
|
|
487
|
-
|
|
492
|
+
_this.dialogObj.hide();
|
|
488
493
|
_this.parent.height = isHeight ? preRTEHeight : _this.parent.height;
|
|
489
494
|
isHeight = false;
|
|
490
|
-
var argument =
|
|
495
|
+
var argument = _this.dialogObj;
|
|
491
496
|
_this.dialogRenderObj.close(argument);
|
|
492
|
-
|
|
497
|
+
_this.dialogObj.destroy();
|
|
493
498
|
_this.selectFormatting(value, args, keepChecked, cleanChecked);
|
|
494
499
|
}
|
|
495
500
|
},
|
|
@@ -501,13 +506,13 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
501
506
|
},
|
|
502
507
|
{
|
|
503
508
|
click: function () {
|
|
504
|
-
if (!
|
|
505
|
-
|
|
509
|
+
if (!_this.dialogObj.isDestroyed) {
|
|
510
|
+
_this.dialogObj.hide();
|
|
506
511
|
_this.parent.height = isHeight ? preRTEHeight : _this.parent.height;
|
|
507
512
|
isHeight = false;
|
|
508
|
-
var args_1 =
|
|
513
|
+
var args_1 = _this.dialogObj;
|
|
509
514
|
_this.dialogRenderObj.close(args_1);
|
|
510
|
-
|
|
515
|
+
_this.dialogObj.destroy();
|
|
511
516
|
}
|
|
512
517
|
},
|
|
513
518
|
buttonModel: {
|
|
@@ -530,7 +535,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
530
535
|
isModal: true,
|
|
531
536
|
visible: false
|
|
532
537
|
};
|
|
533
|
-
|
|
538
|
+
this.dialogObj = this.dialogRenderObj.render(dialogModel);
|
|
534
539
|
var rteDialogWrapper = this.parent.element.querySelector('#' + this.parent.getID()
|
|
535
540
|
+ '_pasteCleanupDialog');
|
|
536
541
|
if (rteDialogWrapper !== null && rteDialogWrapper.innerHTML !== '') {
|
|
@@ -542,15 +547,42 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
542
547
|
});
|
|
543
548
|
this.parent.element.appendChild(rteDialogWrapper);
|
|
544
549
|
}
|
|
545
|
-
|
|
550
|
+
this.dialogObj.appendTo(rteDialogWrapper);
|
|
546
551
|
this.radioRender();
|
|
547
552
|
/* eslint-disable */
|
|
548
|
-
if (this.parent.element.offsetHeight < parseInt(
|
|
549
|
-
this.parent.height = parseInt(
|
|
553
|
+
if (this.parent.element.offsetHeight < parseInt(this.dialogObj.height.split('px')[0], null)) {
|
|
554
|
+
this.parent.height = parseInt(this.dialogObj.height.split('px')[0], null) + 40;
|
|
550
555
|
/* eslint-enable */
|
|
551
556
|
isHeight = true;
|
|
552
557
|
}
|
|
553
|
-
|
|
558
|
+
this.dialogObj.show();
|
|
559
|
+
this.setCssClass({ cssClass: this.parent.cssClass });
|
|
560
|
+
};
|
|
561
|
+
PasteCleanup.prototype.updateCss = function (currentObj, e) {
|
|
562
|
+
if (currentObj && e.cssClass) {
|
|
563
|
+
if (isNullOrUndefined(e.oldCssClass)) {
|
|
564
|
+
currentObj.setProperties({ cssClass: (currentObj.cssClass + ' ' + e.cssClass).trim() });
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
currentObj.setProperties({ cssClass: (currentObj.cssClass.replace(e.oldCssClass, '').trim() + ' ' + e.cssClass).trim() });
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
PasteCleanup.prototype.setCssClass = function (e) {
|
|
572
|
+
if (this.popupObj && e.cssClass) {
|
|
573
|
+
if (isNullOrUndefined(e.oldCssClass)) {
|
|
574
|
+
addClass([this.popupObj.element], e.cssClass);
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
removeClass([this.popupObj.element], e.oldCssClass);
|
|
578
|
+
addClass([this.popupObj.element], e.cssClass);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
this.updateCss(this.dialogObj, e);
|
|
582
|
+
this.updateCss(this.uploadObj, e);
|
|
583
|
+
this.updateCss(this.plainTextRadioButton, e);
|
|
584
|
+
this.updateCss(this.cleanRadioButton, e);
|
|
585
|
+
this.updateCss(this.keepRadioButton, e);
|
|
554
586
|
};
|
|
555
587
|
PasteCleanup.prototype.destroyDialog = function (rteDialogWrapper) {
|
|
556
588
|
var rteDialogContainer = this.parent.element.querySelector('.e-dlg-container');
|
|
@@ -46,7 +46,8 @@ var QuickToolbar = /** @class */ (function () {
|
|
|
46
46
|
popupType: popType,
|
|
47
47
|
toolbarItems: items,
|
|
48
48
|
mode: mode,
|
|
49
|
-
renderType: type
|
|
49
|
+
renderType: type,
|
|
50
|
+
cssClass: this.parent.cssClass
|
|
50
51
|
};
|
|
51
52
|
};
|
|
52
53
|
/**
|
|
@@ -357,6 +358,7 @@ var QuickToolbar = /** @class */ (function () {
|
|
|
357
358
|
this.parent.on(events.destroy, this.destroy, this);
|
|
358
359
|
this.parent.on(events.keyDown, this.onKeyDown, this);
|
|
359
360
|
this.parent.on(events.rtlMode, this.setRtl, this);
|
|
361
|
+
this.parent.on(events.bindCssClass, this.setCssClass, this);
|
|
360
362
|
};
|
|
361
363
|
QuickToolbar.prototype.onKeyDown = function (e) {
|
|
362
364
|
var args = e.args;
|
|
@@ -370,6 +372,24 @@ var QuickToolbar = /** @class */ (function () {
|
|
|
370
372
|
this.hideQuickToolbars();
|
|
371
373
|
this.hideInlineQTBar();
|
|
372
374
|
};
|
|
375
|
+
QuickToolbar.prototype.updateCss = function (baseQTObj, e) {
|
|
376
|
+
if (baseQTObj && e.cssClass) {
|
|
377
|
+
if (isNullOrUndefined(e.oldCssClass && baseQTObj.quickTBarObj.toolbarObj.cssClass !== e.cssClass)) {
|
|
378
|
+
baseQTObj.quickTBarObj.toolbarObj.setProperties({ cssClass: (baseQTObj.quickTBarObj.toolbarObj.cssClass + ' ' + e.cssClass).trim() });
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
baseQTObj.quickTBarObj.toolbarObj.setProperties({ cssClass: (baseQTObj.quickTBarObj.toolbarObj.cssClass.replace(e.oldCssClass, '').trim() + ' ' + e.cssClass).trim() });
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
QuickToolbar.prototype.setCssClass = function (e) {
|
|
386
|
+
var baseQuickToolbarObj = [
|
|
387
|
+
this.inlineQTBar, this.imageQTBar, this.linkQTBar, this.textQTBar, this.tableQTBar
|
|
388
|
+
];
|
|
389
|
+
for (var i = 0; i < baseQuickToolbarObj.length; i++) {
|
|
390
|
+
this.updateCss(baseQuickToolbarObj[i], e);
|
|
391
|
+
}
|
|
392
|
+
};
|
|
373
393
|
QuickToolbar.prototype.setRtl = function (args) {
|
|
374
394
|
if (this.inlineQTBar) {
|
|
375
395
|
this.inlineQTBar.quickTBarObj.toolbarObj.setProperties({ enableRtl: args.enableRtl });
|
|
@@ -378,7 +398,7 @@ var QuickToolbar = /** @class */ (function () {
|
|
|
378
398
|
this.imageQTBar.quickTBarObj.toolbarObj.setProperties({ enableRtl: args.enableRtl });
|
|
379
399
|
}
|
|
380
400
|
if (this.linkQTBar) {
|
|
381
|
-
this.
|
|
401
|
+
this.linkQTBar.quickTBarObj.toolbarObj.setProperties({ enableRtl: args.enableRtl });
|
|
382
402
|
}
|
|
383
403
|
};
|
|
384
404
|
/**
|
|
@@ -407,6 +427,7 @@ var QuickToolbar = /** @class */ (function () {
|
|
|
407
427
|
this.parent.off(events.iframeMouseDown, this.onIframeMouseDown);
|
|
408
428
|
this.parent.off(events.keyDown, this.onKeyDown);
|
|
409
429
|
this.parent.off(events.rtlMode, this.setRtl);
|
|
430
|
+
this.parent.off(events.bindCssClass, this.setCssClass);
|
|
410
431
|
};
|
|
411
432
|
/**
|
|
412
433
|
* Called internally if any of the property value changed.
|
|
@@ -161,6 +161,7 @@ export declare class Toolbar {
|
|
|
161
161
|
protected unWireEvents(): void;
|
|
162
162
|
protected addEventListener(): void;
|
|
163
163
|
protected removeEventListener(): void;
|
|
164
|
+
private setCssClass;
|
|
164
165
|
private onRefresh;
|
|
165
166
|
/**
|
|
166
167
|
* Called internally if any of the property value changed.
|
|
@@ -593,6 +593,7 @@ var Toolbar = /** @class */ (function () {
|
|
|
593
593
|
this.parent.on(events.focusChange, this.focusChangeHandler, this);
|
|
594
594
|
this.parent.on(events.mouseDown, this.mouseDownHandler, this);
|
|
595
595
|
this.parent.on(events.sourceCodeMouseDown, this.mouseDownHandler, this);
|
|
596
|
+
this.parent.on(events.bindCssClass, this.setCssClass, this);
|
|
596
597
|
if (!this.parent.inlineMode.enable && !isIDevice()) {
|
|
597
598
|
this.parent.on(events.toolbarClick, this.toolbarClickHandler, this);
|
|
598
599
|
}
|
|
@@ -616,12 +617,25 @@ var Toolbar = /** @class */ (function () {
|
|
|
616
617
|
this.parent.off(events.focusChange, this.focusChangeHandler);
|
|
617
618
|
this.parent.off(events.mouseDown, this.mouseDownHandler);
|
|
618
619
|
this.parent.off(events.sourceCodeMouseDown, this.mouseDownHandler);
|
|
620
|
+
this.parent.off(events.bindCssClass, this.setCssClass);
|
|
619
621
|
if (!this.parent.inlineMode.enable && !isIDevice()) {
|
|
620
622
|
this.parent.off(events.toolbarClick, this.toolbarClickHandler);
|
|
621
623
|
}
|
|
622
624
|
};
|
|
625
|
+
Toolbar.prototype.setCssClass = function (e) {
|
|
626
|
+
if (this.toolbarObj && e.cssClass) {
|
|
627
|
+
if (isNullOrUndefined(e.oldCssClass)) {
|
|
628
|
+
this.toolbarObj.setProperties({ cssClass: (this.toolbarObj.cssClass + ' ' + e.cssClass).trim() });
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
this.toolbarObj.setProperties({ cssClass: (this.toolbarObj.cssClass.replace(e.oldCssClass, '').trim() + ' ' + e.cssClass).trim() });
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
};
|
|
623
635
|
Toolbar.prototype.onRefresh = function () {
|
|
624
|
-
this.
|
|
636
|
+
if (!this.parent.inlineMode.enable) {
|
|
637
|
+
this.refreshToolbarOverflow();
|
|
638
|
+
}
|
|
625
639
|
this.parent.setContentHeight('', true);
|
|
626
640
|
};
|
|
627
641
|
/**
|
|
@@ -601,3 +601,13 @@ export declare const showTableDialog: string;
|
|
|
601
601
|
|
|
602
602
|
*/
|
|
603
603
|
export declare const closeTableDialog: string;
|
|
604
|
+
/**
|
|
605
|
+
* @hidden
|
|
606
|
+
|
|
607
|
+
*/
|
|
608
|
+
export declare const bindCssClass: string;
|
|
609
|
+
/**
|
|
610
|
+
* @hidden
|
|
611
|
+
|
|
612
|
+
*/
|
|
613
|
+
export declare const blockInlineEmptyNodes: string;
|
|
@@ -601,3 +601,13 @@ export var showTableDialog = 'showTableDialog';
|
|
|
601
601
|
|
|
602
602
|
*/
|
|
603
603
|
export var closeTableDialog = 'closeTableDialog';
|
|
604
|
+
/**
|
|
605
|
+
* @hidden
|
|
606
|
+
|
|
607
|
+
*/
|
|
608
|
+
export var bindCssClass = 'closeTableDialog';
|
|
609
|
+
/**
|
|
610
|
+
* @hidden
|
|
611
|
+
|
|
612
|
+
*/
|
|
613
|
+
export var blockInlineEmptyNodes = "address:empty, article:empty, aside:empty, blockquote:empty,\ndetails:empty, dd:empty, div:empty, dl:empty, dt:empty, fieldset:empty, footer:empty,form:empty, h1:empty,\nh2:empty, h3:empty, h4:empty, h5:empty, h6:empty, header:empty, hgroup:empty, hr:empty, li:empty, main:empty, nav:empty,\nnoscript:empty, output:empty, p:empty, pre:empty, section:empty, td:empty, th:empty,\na:empty, abbr:empty, acronym:empty, b:empty, bdi:empty, bdo:empty, big:empty, button:empty,\ncanvas:empty, cite:empty, code:empty, data:empty, datalist:empty, del:empty, dfn:empty, em:empty, font:empty, i:empty, iframe:empty,\nins:empty, kbd:empty, label:empty, map:empty, mark:empty, meter:empty, noscript:empty, object:empty, output:empty, picture:empty, progress:empty,\nq:empty, ruby:empty, s:empty, samp:empty, script:empty, select:empty, slot:empty, small:empty, span:empty, strong:empty, strike:empty, sub:empty, sup:empty, svg:empty,\ntemplate:empty, textarea:empty, time:empty, u:empty, tt:empty, var:empty, wbr:empty";
|
|
@@ -80,6 +80,7 @@ export interface IRichTextEditor extends Component<HTMLElement> {
|
|
|
80
80
|
enabled?: boolean;
|
|
81
81
|
readonly?: boolean;
|
|
82
82
|
placeholder?: string;
|
|
83
|
+
cssClass?: string;
|
|
83
84
|
valueContainer?: HTMLTextAreaElement;
|
|
84
85
|
editorMode?: EditorMode;
|
|
85
86
|
enableHtmlEncode?: boolean;
|
|
@@ -117,6 +118,7 @@ export interface IRichTextEditor extends Component<HTMLElement> {
|
|
|
117
118
|
getCollection?(items: string | string[]): string[];
|
|
118
119
|
getRange(): Range;
|
|
119
120
|
getID(): string;
|
|
121
|
+
getText(): string;
|
|
120
122
|
updateValueData?(): void;
|
|
121
123
|
getBaseToolbarObject(): BaseToolbar;
|
|
122
124
|
setContentHeight(target?: string, isExpand?: boolean): void;
|
|
@@ -205,6 +207,13 @@ export interface NotifyArgs {
|
|
|
205
207
|
touchData?: ITouchData;
|
|
206
208
|
allowedStylePropertiesArray?: string[];
|
|
207
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Provides information about the current and previous cssClass property .
|
|
212
|
+
*/
|
|
213
|
+
export interface ICssClassArgs {
|
|
214
|
+
cssClass?: string;
|
|
215
|
+
oldCssClass?: string;
|
|
216
|
+
}
|
|
208
217
|
/**
|
|
209
218
|
|
|
210
219
|
*/
|
|
@@ -217,6 +226,8 @@ export interface IItemCollectionArgs {
|
|
|
217
226
|
selectParent?: Node[];
|
|
218
227
|
/** Defines the URL action details for link element */
|
|
219
228
|
url?: string;
|
|
229
|
+
/** Defines the Display Text action details for link element */
|
|
230
|
+
text?: string;
|
|
220
231
|
/** Defines the title of the link action details */
|
|
221
232
|
title?: string;
|
|
222
233
|
/** Defines the target as string for link element */
|
|
@@ -458,6 +469,7 @@ export interface IToolbarOptions {
|
|
|
458
469
|
rteToolbarObj: BaseToolbar;
|
|
459
470
|
enablePersistence: boolean;
|
|
460
471
|
overflowMode?: OverflowMode;
|
|
472
|
+
cssClass?: string;
|
|
461
473
|
}
|
|
462
474
|
/**
|
|
463
475
|
|
|
@@ -476,6 +488,7 @@ export interface IToolbarRenderOptions {
|
|
|
476
488
|
items?: (string | IToolbarItems)[];
|
|
477
489
|
mode?: OverflowMode;
|
|
478
490
|
container?: string;
|
|
491
|
+
cssClass?: string;
|
|
479
492
|
}
|
|
480
493
|
/**
|
|
481
494
|
|
|
@@ -645,6 +658,7 @@ export interface IQuickToolbarOptions {
|
|
|
645
658
|
mode: OverflowMode;
|
|
646
659
|
renderType: RenderType;
|
|
647
660
|
toolbarItems: (string | IToolbarItems)[];
|
|
661
|
+
cssClass: string;
|
|
648
662
|
}
|
|
649
663
|
/**
|
|
650
664
|
* Provides information about a BeforeQuickToolbarOpen event.
|
|
@@ -339,6 +339,35 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
339
339
|
this.formatter.saveData();
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
+
if (this.maxLength !== -1 && !isNOU(tool.command)) {
|
|
343
|
+
var currentInsertContentLength = 0;
|
|
344
|
+
if (tool.command === 'Links') {
|
|
345
|
+
currentInsertContentLength = value.text.length === 0 ?
|
|
346
|
+
value.url.length : value.text.length;
|
|
347
|
+
}
|
|
348
|
+
if (tool.command === 'Images' || tool.command === 'Table' || tool.command === 'Files') {
|
|
349
|
+
currentInsertContentLength = 1;
|
|
350
|
+
}
|
|
351
|
+
if (tool.command === 'InsertHTML') {
|
|
352
|
+
if (!isNOU(value)) {
|
|
353
|
+
var tempElem = this.createElement('div');
|
|
354
|
+
tempElem.innerHTML = value;
|
|
355
|
+
currentInsertContentLength = tempElem.textContent.length;
|
|
356
|
+
}
|
|
357
|
+
else if (!isNOU(tool.value) && (tool.value === '<hr/>' || tool.value === '<br/>')) {
|
|
358
|
+
currentInsertContentLength = 1;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (tool.command === 'InsertText') {
|
|
362
|
+
currentInsertContentLength = value.length;
|
|
363
|
+
}
|
|
364
|
+
var currentLength = this.getText().trim().length;
|
|
365
|
+
var selectionLength = this.getSelection().length;
|
|
366
|
+
var totalLength = (currentLength - selectionLength) + currentInsertContentLength;
|
|
367
|
+
if (!(this.maxLength === -1 || totalLength <= this.maxLength)) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
342
371
|
this.formatter.editorManager.execCommand(tool.command, tool.subCommand ? tool.subCommand : (value ? value : tool.value), null, null, (value ? value : tool.value), (value ? value : tool.value));
|
|
343
372
|
if (option && option.undo) {
|
|
344
373
|
this.formatter.saveData();
|
|
@@ -450,6 +479,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
450
479
|
}
|
|
451
480
|
// eslint-disable-next-line
|
|
452
481
|
(!this.enabled) ? this.unWireEvents() : this.eventInitializer();
|
|
482
|
+
this.notify(events.bindCssClass, { cssClass: this.cssClass });
|
|
453
483
|
this.renderComplete();
|
|
454
484
|
};
|
|
455
485
|
/**
|
|
@@ -570,6 +600,17 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
570
600
|
this.autoResize();
|
|
571
601
|
};
|
|
572
602
|
RichTextEditor.prototype.keyUp = function (e) {
|
|
603
|
+
if (this.editorMode === "HTML") {
|
|
604
|
+
var range = this.getRange();
|
|
605
|
+
if (Browser.userAgent.indexOf('Firefox') != -1 && range.startContainer.nodeName === '#text' &&
|
|
606
|
+
range.startContainer.parentElement === this.inputElement && this.enterKey !== 'BR') {
|
|
607
|
+
var range_1 = this.getRange();
|
|
608
|
+
var tempElem = this.createElement(this.enterKey);
|
|
609
|
+
range_1.startContainer.parentElement.insertBefore(tempElem, range_1.startContainer);
|
|
610
|
+
tempElem.appendChild(range_1.startContainer);
|
|
611
|
+
this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), tempElem.childNodes[0], tempElem.childNodes[0], tempElem.childNodes[0].textContent.length, tempElem.childNodes[0].textContent.length);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
573
614
|
this.notify(events.keyUp, { member: 'keyup', args: e });
|
|
574
615
|
if (e.code === 'KeyX' && e.which === 88 && e.keyCode === 88 && e.ctrlKey && (this.inputElement.innerHTML === '' ||
|
|
575
616
|
this.inputElement.innerHTML === '<br>')) {
|
|
@@ -722,7 +763,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
722
763
|
requestType: 'Paste'
|
|
723
764
|
};
|
|
724
765
|
this.trigger(events.actionBegin, evenArgs, function (pasteArgs) {
|
|
725
|
-
var currentLength = _this.
|
|
766
|
+
var currentLength = _this.inputElement.textContent.length;
|
|
726
767
|
var selectionLength = _this.getSelection().length;
|
|
727
768
|
var pastedContentLength = (isNOU(e) || isNOU(e.clipboardData))
|
|
728
769
|
? 0 : e.clipboardData.getData('text/plain').length;
|
|
@@ -1032,6 +1073,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1032
1073
|
case 'cssClass':
|
|
1033
1074
|
this.element.classList.remove(oldProp[prop]);
|
|
1034
1075
|
this.setCssClass(newProp[prop]);
|
|
1076
|
+
this.notify(events.bindCssClass, { cssClass: newProp[prop], oldCssClass: oldProp[prop] });
|
|
1035
1077
|
break;
|
|
1036
1078
|
case 'enabled':
|
|
1037
1079
|
this.setEnable();
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { isNullOrUndefined as isNOU, addClass, removeClass, selectAll, createElement } from '@syncfusion/ej2-base';
|
|
5
5
|
import { Browser, detach, SanitizeHtmlHelper, extend } from '@syncfusion/ej2-base';
|
|
6
6
|
import * as classes from '../base/classes';
|
|
7
|
+
import * as CONSTANT from '../base/constant';
|
|
7
8
|
import * as model from '../models/items';
|
|
8
9
|
import { toolsLocale, fontNameLocale, formatsLocale, numberFormatListLocale, bulletFormatListLocale } from '../models/default-locale';
|
|
9
10
|
var undoRedoItems = ['Undo', 'Redo'];
|
|
@@ -413,6 +414,10 @@ export function updateTextNode(value, rteObj) {
|
|
|
413
414
|
var previousParent = void 0;
|
|
414
415
|
var insertElem = void 0;
|
|
415
416
|
while (tempNode.firstChild) {
|
|
417
|
+
var emptyElem = tempNode.querySelectorAll(CONSTANT.blockInlineEmptyNodes);
|
|
418
|
+
for (var i = 0; i < emptyElem.length; i++) {
|
|
419
|
+
emptyElem[i].innerHTML = '<br>';
|
|
420
|
+
}
|
|
416
421
|
if (rteObj.enterKey !== 'BR' && ((tempNode.firstChild.nodeName === '#text' &&
|
|
417
422
|
(tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
|
|
418
423
|
inlineNode.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0)) {
|
|
@@ -43,6 +43,21 @@ var Formatter = /** @class */ (function () {
|
|
|
43
43
|
|| self.contentModule.getPanel() === range.commonAncestorContainer)) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
+
if (!isNullOrUndefined(args) && self.maxLength !== -1 && !isNullOrUndefined(args.item.command)) {
|
|
47
|
+
var currentInsertContentLength = 0;
|
|
48
|
+
if (args.item.command === 'Links') {
|
|
49
|
+
currentInsertContentLength = value.text.length === 0 ? value.url.length : value.text.length;
|
|
50
|
+
}
|
|
51
|
+
if (args.item.command === 'Images' || args.item.command === 'Table' || args.item.command === 'Files') {
|
|
52
|
+
currentInsertContentLength = 1;
|
|
53
|
+
}
|
|
54
|
+
var currentLength = self.getText().trim().length;
|
|
55
|
+
var selectionLength = self.getSelection().length;
|
|
56
|
+
var totalLength = (currentLength - selectionLength) + currentInsertContentLength;
|
|
57
|
+
if (!(self.maxLength === -1 || totalLength <= self.maxLength)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
46
61
|
if (isNullOrUndefined(args)) {
|
|
47
62
|
var action_1 = event.action;
|
|
48
63
|
if (action_1 !== 'tab' && action_1 !== 'enter' && action_1 !== 'space' && action_1 !== 'escape') {
|
|
@@ -66,7 +66,8 @@ var ContentRender = /** @class */ (function () {
|
|
|
66
66
|
* @returns {string} - specifies the string element.
|
|
67
67
|
*/
|
|
68
68
|
ContentRender.prototype.getText = function () {
|
|
69
|
-
|
|
69
|
+
var textString = this.getEditPanel().innerText;
|
|
70
|
+
return textString === '\n' ? '' : textString;
|
|
70
71
|
};
|
|
71
72
|
/**
|
|
72
73
|
* Set the content div element of RichTextEditor
|
|
@@ -14,6 +14,9 @@ export declare class Image {
|
|
|
14
14
|
private inputUrl;
|
|
15
15
|
private captionEle;
|
|
16
16
|
private checkBoxObj;
|
|
17
|
+
private widthNum;
|
|
18
|
+
private heightNum;
|
|
19
|
+
private browseButton;
|
|
17
20
|
private uploadUrl;
|
|
18
21
|
private contentModule;
|
|
19
22
|
private rendererFactory;
|
|
@@ -37,6 +40,8 @@ export declare class Image {
|
|
|
37
40
|
private constructor();
|
|
38
41
|
protected addEventListener(): void;
|
|
39
42
|
protected removeEventListener(): void;
|
|
43
|
+
private updateCss;
|
|
44
|
+
private setCssClass;
|
|
40
45
|
private onIframeMouseDown;
|
|
41
46
|
private afterRender;
|
|
42
47
|
private undoStack;
|