@syncfusion/ej2-richtexteditor 19.2.62 → 19.3.43
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 +1 -1
- package/CHANGELOG.md +21 -9
- 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 +858 -245
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +864 -243
- 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 +12 -12
- package/src/common/types.d.ts +8 -0
- package/src/editor-manager/base/editor-manager.d.ts +1 -1
- package/src/editor-manager/base/editor-manager.js +6 -6
- package/src/editor-manager/base/interface.d.ts +7 -1
- package/src/editor-manager/plugin/clearformat-exec.js +2 -2
- package/src/editor-manager/plugin/clearformat.d.ts +3 -1
- package/src/editor-manager/plugin/clearformat.js +19 -9
- package/src/editor-manager/plugin/dom-node.js +2 -2
- package/src/editor-manager/plugin/formats.d.ts +1 -0
- package/src/editor-manager/plugin/formats.js +87 -7
- package/src/editor-manager/plugin/image.js +55 -47
- package/src/editor-manager/plugin/inserthtml.js +10 -2
- package/src/editor-manager/plugin/isformatted.js +2 -1
- package/src/editor-manager/plugin/lists.d.ts +1 -0
- package/src/editor-manager/plugin/lists.js +87 -8
- package/src/editor-manager/plugin/nodecutter.d.ts +1 -0
- package/src/editor-manager/plugin/nodecutter.js +1 -0
- package/src/editor-manager/plugin/selection-commands.d.ts +2 -1
- package/src/editor-manager/plugin/selection-commands.js +14 -6
- package/src/editor-manager/plugin/selection-exec.js +2 -2
- package/src/editor-manager/plugin/table.js +19 -9
- package/src/rich-text-editor/actions/base-quick-toolbar.js +3 -4
- package/src/rich-text-editor/actions/enter-key.d.ts +18 -0
- package/src/rich-text-editor/actions/enter-key.js +290 -0
- package/src/rich-text-editor/actions/html-editor.js +30 -20
- package/src/rich-text-editor/actions/paste-clean-up.js +5 -5
- package/src/rich-text-editor/actions/resize.js +4 -4
- package/src/rich-text-editor/base/constant.d.ts +5 -0
- package/src/rich-text-editor/base/constant.js +5 -0
- package/src/rich-text-editor/base/interface.d.ts +15 -3
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +27 -1
- package/src/rich-text-editor/base/rich-text-editor.d.ts +34 -5
- package/src/rich-text-editor/base/rich-text-editor.js +58 -56
- package/src/rich-text-editor/base/util.d.ts +7 -1
- package/src/rich-text-editor/base/util.js +45 -11
- package/src/rich-text-editor/formatter/formatter.js +9 -7
- package/src/rich-text-editor/models/items.js +3 -3
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +2 -2
- package/src/rich-text-editor/renderer/image-module.d.ts +6 -0
- package/src/rich-text-editor/renderer/image-module.js +70 -26
- package/src/rich-text-editor/renderer/link-module.js +4 -3
- package/src/rich-text-editor/renderer/popup-renderer.js +1 -2
- package/src/rich-text-editor/renderer/render.js +10 -2
- package/src/rich-text-editor/renderer/table-module.js +13 -5
- package/src/rich-text-editor/renderer/view-source.js +21 -3
- package/styles/bootstrap-dark.css +25 -12
- package/styles/bootstrap.css +25 -12
- package/styles/bootstrap4.css +21 -13
- package/styles/bootstrap5-dark.css +3058 -0
- package/styles/bootstrap5-dark.scss +1 -0
- package/styles/bootstrap5.css +3058 -0
- package/styles/bootstrap5.scss +1 -0
- package/styles/fabric-dark.css +20 -12
- package/styles/fabric.css +20 -12
- package/styles/highcontrast-light.css +20 -12
- package/styles/highcontrast.css +19 -18
- package/styles/material-dark.css +22 -14
- package/styles/material.css +19 -11
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +1 -1
- package/styles/rich-text-editor/_bootstrap-definition.scss +1 -1
- package/styles/rich-text-editor/_bootstrap4-definition.scss +2 -2
- package/styles/rich-text-editor/_bootstrap5-dark-definition.scss +1 -0
- package/styles/rich-text-editor/_bootstrap5-definition.scss +168 -0
- package/styles/rich-text-editor/_fabric-dark-definition.scss +1 -1
- package/styles/rich-text-editor/_fabric-definition.scss +1 -1
- package/styles/rich-text-editor/_highcontrast-definition.scss +2 -2
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +1 -1
- package/styles/rich-text-editor/_layout.scss +64 -7
- package/styles/rich-text-editor/_tailwind-dark-definition.scss +1 -165
- package/styles/rich-text-editor/_tailwind-definition.scss +74 -72
- package/styles/rich-text-editor/_theme.scss +103 -3
- package/styles/rich-text-editor/bootstrap-dark.css +25 -12
- package/styles/rich-text-editor/bootstrap.css +25 -12
- package/styles/rich-text-editor/bootstrap4.css +21 -13
- package/styles/rich-text-editor/bootstrap5-dark.css +3058 -0
- package/styles/rich-text-editor/bootstrap5-dark.scss +4 -0
- package/styles/rich-text-editor/bootstrap5.css +3058 -0
- package/styles/rich-text-editor/bootstrap5.scss +4 -0
- package/styles/rich-text-editor/fabric-dark.css +20 -12
- package/styles/rich-text-editor/fabric.css +20 -12
- package/styles/rich-text-editor/highcontrast-light.css +20 -12
- package/styles/rich-text-editor/highcontrast.css +19 -18
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +1 -1
- package/styles/rich-text-editor/icons/_bootstrap.scss +1 -1
- package/styles/rich-text-editor/icons/_bootstrap4.scss +1 -1
- package/styles/rich-text-editor/icons/_bootstrap5-dark.scss +1 -0
- package/styles/rich-text-editor/icons/_bootstrap5.scss +303 -0
- package/styles/rich-text-editor/icons/_fabric-dark.scss +1 -1
- package/styles/rich-text-editor/icons/_fabric.scss +1 -1
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +1 -1
- package/styles/rich-text-editor/icons/_highcontrast.scss +1 -1
- package/styles/rich-text-editor/icons/_material-dark.scss +1 -1
- package/styles/rich-text-editor/icons/_material.scss +1 -1
- package/styles/rich-text-editor/icons/_tailwind-dark.scss +1 -304
- package/styles/rich-text-editor/icons/_tailwind.scss +2 -2
- package/styles/rich-text-editor/material-dark.css +22 -14
- package/styles/rich-text-editor/material.css +19 -11
- package/styles/rich-text-editor/tailwind-dark.css +51 -20
- package/styles/rich-text-editor/tailwind.css +49 -18
- package/styles/tailwind-dark.css +51 -20
- package/styles/tailwind.css +49 -18
|
@@ -31,7 +31,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
31
31
|
import { Component, EventHandler, Complex, Browser, addClass, select, detach } from '@syncfusion/ej2-base';
|
|
32
32
|
import { Property, NotifyPropertyChanges, formatUnit, L10n, closest } from '@syncfusion/ej2-base';
|
|
33
33
|
import { setStyleAttribute, Event, removeClass, print as printWindow, attributes } from '@syncfusion/ej2-base';
|
|
34
|
-
import { isNullOrUndefined as isNOU, compile, append, extend, debounce
|
|
34
|
+
import { isNullOrUndefined as isNOU, compile, append, extend, debounce } from '@syncfusion/ej2-base';
|
|
35
35
|
import { Touch as EJ2Touch } from '@syncfusion/ej2-base';
|
|
36
36
|
import { getScrollableParent } from '@syncfusion/ej2-popups';
|
|
37
37
|
import * as events from '../base/constant';
|
|
@@ -53,8 +53,9 @@ import { InlineMode } from '../models/inline-mode';
|
|
|
53
53
|
import { defaultLocale } from '../models/default-locale';
|
|
54
54
|
import { setAttributes } from '../actions/html-attributes';
|
|
55
55
|
import { FullScreen } from '../actions/full-screen';
|
|
56
|
+
import { EnterKeyAction } from '../actions/enter-key';
|
|
56
57
|
import * as CONSTANT from '../../common/constant';
|
|
57
|
-
import { dispatchEvent, getEditValue, isIDevice, decode, isEditableValueEmpty } from '../base/util';
|
|
58
|
+
import { dispatchEvent, getEditValue, isIDevice, decode, isEditableValueEmpty, getDefaultValue } from '../base/util';
|
|
58
59
|
import { DialogRenderer } from '../renderer/dialog-renderer';
|
|
59
60
|
/**
|
|
60
61
|
* Represents the Rich Text Editor component.
|
|
@@ -207,9 +208,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
207
208
|
this.htmlAttributes = { 'tabindex': this.element.getAttribute('tabindex') };
|
|
208
209
|
this.element.removeAttribute('tabindex');
|
|
209
210
|
}
|
|
210
|
-
|
|
211
|
-
this.element.innerHTML = '';
|
|
212
|
-
}
|
|
211
|
+
this.element.innerHTML = '';
|
|
213
212
|
var invalidAttr = ['class', 'style', 'id', 'ejs-for'];
|
|
214
213
|
var htmlAttr = {};
|
|
215
214
|
for (var a = 0; a < this.element.attributes.length; a++) {
|
|
@@ -227,23 +226,10 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
227
226
|
var rteOuterWrapper = this.createElement('div', {
|
|
228
227
|
className: this.element.getAttribute('class')
|
|
229
228
|
});
|
|
230
|
-
|
|
231
|
-
this.element.innerHTML = '';
|
|
232
|
-
}
|
|
229
|
+
this.element.innerHTML = '';
|
|
233
230
|
this.element.parentElement.insertBefore(rteOuterWrapper, this.element);
|
|
234
|
-
|
|
235
|
-
rteOuterWrapper.appendChild(this.element);
|
|
236
|
-
this.valueContainer = this.createElement('textarea', {
|
|
237
|
-
id: this.element.id + '-value'
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
this.valueContainer = this.element;
|
|
242
|
-
}
|
|
231
|
+
this.valueContainer = this.element;
|
|
243
232
|
removeClass([this.valueContainer], this.element.getAttribute('class').split(' '));
|
|
244
|
-
if (this.isBlazor()) {
|
|
245
|
-
addClass([this.element], classes.CLS_RTE_HIDDEN);
|
|
246
|
-
}
|
|
247
233
|
this.element = rteOuterWrapper;
|
|
248
234
|
}
|
|
249
235
|
else {
|
|
@@ -460,12 +446,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
460
446
|
}
|
|
461
447
|
this.setContentHeight();
|
|
462
448
|
if (this.value !== null) {
|
|
463
|
-
|
|
464
|
-
this.valueContainer.defaultValue = this.value;
|
|
465
|
-
}
|
|
466
|
-
else {
|
|
467
|
-
this.defaultResetValue = this.value;
|
|
468
|
-
}
|
|
449
|
+
this.valueContainer.defaultValue = this.value;
|
|
469
450
|
}
|
|
470
451
|
// eslint-disable-next-line
|
|
471
452
|
(!this.enabled) ? this.unWireEvents() : this.eventInitializer();
|
|
@@ -568,7 +549,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
568
549
|
this.notify(events.keyUp, { member: 'keyup', args: e });
|
|
569
550
|
if (e.code === 'KeyX' && e.which === 88 && e.keyCode === 88 && e.ctrlKey && (this.inputElement.innerHTML === '' ||
|
|
570
551
|
this.inputElement.innerHTML === '<br>')) {
|
|
571
|
-
this.inputElement.innerHTML = getEditValue(
|
|
552
|
+
this.inputElement.innerHTML = getEditValue(getDefaultValue(this), this);
|
|
572
553
|
}
|
|
573
554
|
var allowedKeys = e.which === 32 || e.which === 13 || e.which === 8 || e.which === 46;
|
|
574
555
|
if (((e.key !== 'shift' && !e.ctrlKey) && e.key && e.key.length === 1 || allowedKeys) || (this.editorMode === 'Markdown'
|
|
@@ -580,7 +561,10 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
580
561
|
this.notify(events.toolbarRefresh, { args: e });
|
|
581
562
|
}
|
|
582
563
|
if (!isNOU(this.placeholder)) {
|
|
583
|
-
this.
|
|
564
|
+
if (!(e.key === 'Enter' && e.keyCode === 13) && (this.inputElement.innerHTML === '<p><br></p>' || this.inputElement.innerHTML === '<div><br></div>' ||
|
|
565
|
+
this.inputElement.innerHTML === '<br>')) {
|
|
566
|
+
this.setPlaceHolder();
|
|
567
|
+
}
|
|
584
568
|
}
|
|
585
569
|
};
|
|
586
570
|
/**
|
|
@@ -809,22 +793,16 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
809
793
|
}
|
|
810
794
|
this.unWireEvents();
|
|
811
795
|
if (this.originalElement.tagName === 'TEXTAREA') {
|
|
812
|
-
if (isBlazor()) {
|
|
813
|
-
detach(this.valueContainer);
|
|
814
|
-
this.valueContainer = this.element.querySelector('.e-blazor-hidden.e-control.e-richtexteditor');
|
|
815
|
-
}
|
|
816
796
|
this.element.parentElement.insertBefore(this.valueContainer, this.element);
|
|
817
797
|
this.valueContainer.id = this.getID();
|
|
818
798
|
this.valueContainer.removeAttribute('name');
|
|
819
799
|
detach(this.element);
|
|
820
800
|
if (this.originalElement.innerHTML.trim() !== '') {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
this.setProperties({ value: (!isNOU(this.initialValue) ? this.initialValue : null) }, true);
|
|
824
|
-
}
|
|
801
|
+
this.valueContainer.value = this.originalElement.innerHTML.trim();
|
|
802
|
+
this.setProperties({ value: (!isNOU(this.initialValue) ? this.initialValue : null) }, true);
|
|
825
803
|
}
|
|
826
804
|
else {
|
|
827
|
-
this.valueContainer.value =
|
|
805
|
+
this.valueContainer.value = this.valueContainer.defaultValue;
|
|
828
806
|
}
|
|
829
807
|
this.element = this.valueContainer;
|
|
830
808
|
for (var i = 0; i < this.originalElement.classList.length; i++) {
|
|
@@ -900,12 +878,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
900
878
|
* @returns {Element} - specifies the element.
|
|
901
879
|
*/
|
|
902
880
|
RichTextEditor.prototype.getContent = function () {
|
|
903
|
-
|
|
904
|
-
return this.inputElement;
|
|
905
|
-
}
|
|
906
|
-
else {
|
|
907
|
-
return this.contentModule.getPanel();
|
|
908
|
-
}
|
|
881
|
+
return this.contentModule.getPanel();
|
|
909
882
|
};
|
|
910
883
|
/**
|
|
911
884
|
* Returns the text content as string.
|
|
@@ -977,10 +950,23 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
977
950
|
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
978
951
|
var prop = _a[_i];
|
|
979
952
|
switch (prop) {
|
|
953
|
+
case 'enterKey':
|
|
980
954
|
case 'value': {
|
|
981
|
-
var nVal =
|
|
955
|
+
var nVal = void 0;
|
|
956
|
+
if (prop === 'enterKey') {
|
|
957
|
+
if (this.value === null || this.value === '<div><br></div>' || this.value === '<p><br></p>' ||
|
|
958
|
+
this.value === '<br>') {
|
|
959
|
+
nVal = null;
|
|
960
|
+
}
|
|
961
|
+
else {
|
|
962
|
+
nVal = this.value;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
else {
|
|
966
|
+
nVal = newProp[prop];
|
|
967
|
+
}
|
|
982
968
|
var val = this.editorMode === 'HTML' ? getEditValue(nVal, this) : nVal;
|
|
983
|
-
if (!isNOU(nVal) && nVal !== '') {
|
|
969
|
+
if ((!isNOU(nVal) && nVal !== '') || prop === 'enterKey') {
|
|
984
970
|
this.value = this.serializeValue(((this.enableHtmlEncode) ? this.encode(decode(val)) : val));
|
|
985
971
|
}
|
|
986
972
|
this.updatePanelValue();
|
|
@@ -1146,7 +1132,18 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1146
1132
|
getTextArea.value = '';
|
|
1147
1133
|
}
|
|
1148
1134
|
if (this.editorMode === 'HTML') {
|
|
1149
|
-
this.
|
|
1135
|
+
if (this.enterKey === 'DIV') {
|
|
1136
|
+
this.inputElement.innerHTML = '<div><br/></div>';
|
|
1137
|
+
}
|
|
1138
|
+
else if (this.enterKey === 'BR') {
|
|
1139
|
+
this.inputElement.innerHTML = '<br/>';
|
|
1140
|
+
}
|
|
1141
|
+
else {
|
|
1142
|
+
this.inputElement.innerHTML = '<p><br/></p>';
|
|
1143
|
+
if (value === '' && this.formatter && this.inputElement) {
|
|
1144
|
+
this.formatter.editorManager.nodeSelection.setCursorPoint(this.contentModule.getDocument(), this.inputElement.firstElementChild, this.inputElement.firstElementChild.childElementCount);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1150
1147
|
}
|
|
1151
1148
|
else {
|
|
1152
1149
|
this.inputElement.value = '';
|
|
@@ -1194,10 +1191,9 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1194
1191
|
});
|
|
1195
1192
|
}
|
|
1196
1193
|
this.placeHolderWrapper.innerHTML = this.placeholder;
|
|
1197
|
-
if (this.inputElement.textContent.length === 0 &&
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
this.inputElement.innerHTML !== '<p><br></p><p><br></p>') {
|
|
1194
|
+
if (this.inputElement.textContent.length === 0 && !isNOU(this.inputElement.firstChild) && (this.inputElement.firstChild.nodeName === 'BR' ||
|
|
1195
|
+
((this.inputElement.firstChild.nodeName === 'P' || this.inputElement.firstChild.nodeName === 'DIV') && !isNOU(this.inputElement.firstChild.firstChild) &&
|
|
1196
|
+
this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
|
|
1201
1197
|
this.placeHolderWrapper.style.display = 'block';
|
|
1202
1198
|
}
|
|
1203
1199
|
else {
|
|
@@ -1359,6 +1355,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1359
1355
|
var rendererFactory = this.serviceLocator.getService('rendererFactory');
|
|
1360
1356
|
this.contentModule = rendererFactory.getRenderer(RenderType.Content);
|
|
1361
1357
|
this.fullScreenModule = new FullScreen(this);
|
|
1358
|
+
this.enterKeyModule = new EnterKeyAction(this);
|
|
1362
1359
|
this.renderModule.render();
|
|
1363
1360
|
this.inputElement = this.contentModule.getEditPanel();
|
|
1364
1361
|
this.setHeight(this.height);
|
|
@@ -1428,9 +1425,6 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1428
1425
|
styleEle.rel = 'stylesheet';
|
|
1429
1426
|
return styleEle;
|
|
1430
1427
|
};
|
|
1431
|
-
RichTextEditor.prototype.isBlazor = function () {
|
|
1432
|
-
return (!isBlazor() ? false : true);
|
|
1433
|
-
};
|
|
1434
1428
|
RichTextEditor.prototype.setValue = function () {
|
|
1435
1429
|
if (this.valueTemplate) {
|
|
1436
1430
|
if (typeof this.valueTemplate === 'string') {
|
|
@@ -1737,7 +1731,8 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1737
1731
|
this.isFocusOut = false;
|
|
1738
1732
|
addClass([this.element], [classes.CLS_FOCUS]);
|
|
1739
1733
|
if (this.editorMode === 'HTML') {
|
|
1740
|
-
this.cloneValue = (this.inputElement.innerHTML === '<p><br></p>'
|
|
1734
|
+
this.cloneValue = (this.inputElement.innerHTML === '<p><br></p>' || this.inputElement.innerHTML === '<div><br></div>' ||
|
|
1735
|
+
this.inputElement.innerHTML === '<br>') ? null : this.enableHtmlEncode ?
|
|
1741
1736
|
this.encode(decode(this.inputElement.innerHTML)) : this.inputElement.innerHTML;
|
|
1742
1737
|
}
|
|
1743
1738
|
else {
|
|
@@ -1786,7 +1781,8 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1786
1781
|
}
|
|
1787
1782
|
var getTextArea = this.element.querySelector('.e-rte-srctextarea');
|
|
1788
1783
|
if (this.editorMode === 'HTML') {
|
|
1789
|
-
value = (this.inputElement.innerHTML === '<p><br></p>'
|
|
1784
|
+
value = (this.inputElement.innerHTML === '<p><br></p>' || this.inputElement.innerHTML === '<div><br></div>' ||
|
|
1785
|
+
this.inputElement.innerHTML === '<br>') ? null : this.enableHtmlEncode ?
|
|
1790
1786
|
this.encode(decode(this.inputElement.innerHTML)) : this.inputElement.innerHTML;
|
|
1791
1787
|
if (getTextArea && getTextArea.style.display === 'block') {
|
|
1792
1788
|
value = getTextArea.value;
|
|
@@ -1970,7 +1966,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1970
1966
|
};
|
|
1971
1967
|
RichTextEditor.prototype.resetHandler = function () {
|
|
1972
1968
|
var defaultValue = this.valueContainer.defaultValue.trim();
|
|
1973
|
-
this.setProperties({ value: defaultValue === '' ? null :
|
|
1969
|
+
this.setProperties({ value: defaultValue === '' ? null : defaultValue });
|
|
1974
1970
|
};
|
|
1975
1971
|
/**
|
|
1976
1972
|
* @returns {void}
|
|
@@ -2186,6 +2182,12 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
2186
2182
|
__decorate([
|
|
2187
2183
|
Property(null)
|
|
2188
2184
|
], RichTextEditor.prototype, "value", void 0);
|
|
2185
|
+
__decorate([
|
|
2186
|
+
Property('P')
|
|
2187
|
+
], RichTextEditor.prototype, "enterKey", void 0);
|
|
2188
|
+
__decorate([
|
|
2189
|
+
Property('BR')
|
|
2190
|
+
], RichTextEditor.prototype, "shiftEnterKey", void 0);
|
|
2189
2191
|
__decorate([
|
|
2190
2192
|
Property(30)
|
|
2191
2193
|
], RichTextEditor.prototype, "undoRedoSteps", void 0);
|
|
@@ -128,7 +128,13 @@ export declare function getEditValue(value: string, rteObj: IRichTextEditor): st
|
|
|
128
128
|
* @returns {string} - returns the string
|
|
129
129
|
* @hidden
|
|
130
130
|
*/
|
|
131
|
-
export declare function updateTextNode(value: string): string;
|
|
131
|
+
export declare function updateTextNode(value: string, rteObj?: IRichTextEditor): string;
|
|
132
|
+
/**
|
|
133
|
+
* @param {IRichTextEditor} rteObj - specifies the rte object
|
|
134
|
+
* @returns {string} - returns the value based on enter configuration.
|
|
135
|
+
* @hidden
|
|
136
|
+
*/
|
|
137
|
+
export declare function getDefaultValue(rteObj: IRichTextEditor): string;
|
|
132
138
|
/**
|
|
133
139
|
* @param {string} value - specifies the value
|
|
134
140
|
* @returns {boolean} - returns the boolean value
|
|
@@ -380,11 +380,19 @@ export function toObjectLowerCase(obj) {
|
|
|
380
380
|
export function getEditValue(value, rteObj) {
|
|
381
381
|
var val;
|
|
382
382
|
if (value !== null && value !== '') {
|
|
383
|
-
val = rteObj.enableHtmlEncode ? updateTextNode(decode(value)) : updateTextNode(value);
|
|
383
|
+
val = rteObj.enableHtmlEncode ? updateTextNode(decode(value), rteObj) : updateTextNode(value, rteObj);
|
|
384
384
|
rteObj.setProperties({ value: val }, true);
|
|
385
385
|
}
|
|
386
386
|
else {
|
|
387
|
-
|
|
387
|
+
if (rteObj.enterKey === 'DIV') {
|
|
388
|
+
val = rteObj.enableHtmlEncode ? '<div><br/></div>' : '<div><br/></div>';
|
|
389
|
+
}
|
|
390
|
+
else if (rteObj.enterKey === 'BR') {
|
|
391
|
+
val = rteObj.enableHtmlEncode ? '<br/>' : '<br/>';
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
val = rteObj.enableHtmlEncode ? '<p><br/></p>' : '<p><br/></p>';
|
|
395
|
+
}
|
|
388
396
|
}
|
|
389
397
|
return val;
|
|
390
398
|
}
|
|
@@ -393,7 +401,7 @@ export function getEditValue(value, rteObj) {
|
|
|
393
401
|
* @returns {string} - returns the string
|
|
394
402
|
* @hidden
|
|
395
403
|
*/
|
|
396
|
-
export function updateTextNode(value) {
|
|
404
|
+
export function updateTextNode(value, rteObj) {
|
|
397
405
|
var tempNode = document.createElement('div');
|
|
398
406
|
var resultElm = document.createElement('div');
|
|
399
407
|
var childNodes = tempNode.childNodes;
|
|
@@ -402,20 +410,25 @@ export function updateTextNode(value) {
|
|
|
402
410
|
if (childNodes.length > 0) {
|
|
403
411
|
var isPreviousInlineElem = void 0;
|
|
404
412
|
var previousParent = void 0;
|
|
405
|
-
var
|
|
413
|
+
var insertElem = void 0;
|
|
406
414
|
while (tempNode.firstChild) {
|
|
407
|
-
if ((tempNode.firstChild.nodeName === '#text' &&
|
|
415
|
+
if (rteObj.enterKey !== 'BR' && ((tempNode.firstChild.nodeName === '#text' &&
|
|
408
416
|
(tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
|
|
409
|
-
inlineNode.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0) {
|
|
417
|
+
inlineNode.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0)) {
|
|
410
418
|
if (!isPreviousInlineElem) {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
419
|
+
if (rteObj.enterKey === 'DIV') {
|
|
420
|
+
insertElem = createElement('div');
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
insertElem = createElement('p');
|
|
424
|
+
}
|
|
425
|
+
resultElm.appendChild(insertElem);
|
|
426
|
+
insertElem.appendChild(tempNode.firstChild);
|
|
414
427
|
}
|
|
415
428
|
else {
|
|
416
429
|
previousParent.appendChild(tempNode.firstChild);
|
|
417
430
|
}
|
|
418
|
-
previousParent =
|
|
431
|
+
previousParent = insertElem;
|
|
419
432
|
isPreviousInlineElem = true;
|
|
420
433
|
}
|
|
421
434
|
else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
|
|
@@ -440,13 +453,34 @@ export function updateTextNode(value) {
|
|
|
440
453
|
}
|
|
441
454
|
return resultElm.innerHTML;
|
|
442
455
|
}
|
|
456
|
+
/**
|
|
457
|
+
* @param {IRichTextEditor} rteObj - specifies the rte object
|
|
458
|
+
* @returns {string} - returns the value based on enter configuration.
|
|
459
|
+
* @hidden
|
|
460
|
+
*/
|
|
461
|
+
export function getDefaultValue(rteObj) {
|
|
462
|
+
var currentVal;
|
|
463
|
+
if (rteObj.enterKey === 'DIV') {
|
|
464
|
+
currentVal = rteObj.enableHtmlEncode ? '<div><br/></div>' : '<div><br/></div>';
|
|
465
|
+
}
|
|
466
|
+
else if (rteObj.enterKey === 'BR') {
|
|
467
|
+
currentVal = rteObj.enableHtmlEncode ? '<br/>' : '<br/>';
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
currentVal = rteObj.enableHtmlEncode ? '<p><br/></p>' : '<p><br/></p>';
|
|
471
|
+
}
|
|
472
|
+
return currentVal;
|
|
473
|
+
}
|
|
443
474
|
/**
|
|
444
475
|
* @param {string} value - specifies the value
|
|
445
476
|
* @returns {boolean} - returns the boolean value
|
|
446
477
|
* @hidden
|
|
447
478
|
*/
|
|
448
479
|
export function isEditableValueEmpty(value) {
|
|
449
|
-
return (value === '<p><br></p>' || value === '<p><br></p>'
|
|
480
|
+
return (value === '<p><br></p>' || value === '<p><br></p>'
|
|
481
|
+
|| value === '<div><br></div>' || value === '<div><br></div>'
|
|
482
|
+
|| value === '<br>' || value === '<br>'
|
|
483
|
+
|| value === '') ? true : false;
|
|
450
484
|
}
|
|
451
485
|
/**
|
|
452
486
|
* @param {string} value - specifies the string value
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extend, isNullOrUndefined, Browser
|
|
1
|
+
import { extend, isNullOrUndefined, Browser } from '@syncfusion/ej2-base';
|
|
2
2
|
import * as CONSTANT from '../base/constant';
|
|
3
3
|
import { updateUndoRedoStatus, isIDevice } from '../base/util';
|
|
4
4
|
import { KEY_DOWN, KEY_UP } from './../../common/constant';
|
|
@@ -59,10 +59,6 @@ var Formatter = /** @class */ (function () {
|
|
|
59
59
|
itemCollection: value
|
|
60
60
|
};
|
|
61
61
|
extend(args, args, items, true);
|
|
62
|
-
if (isBlazor()) {
|
|
63
|
-
delete args.item;
|
|
64
|
-
delete args.itemCollection;
|
|
65
|
-
}
|
|
66
62
|
self.trigger(CONSTANT.actionBegin, args, function (actionBeginArgs) {
|
|
67
63
|
if (actionBeginArgs.cancel) {
|
|
68
64
|
if (action_1 === 'paste' || action_1 === 'cut' || action_1 === 'copy') {
|
|
@@ -74,10 +70,16 @@ var Formatter = /** @class */ (function () {
|
|
|
74
70
|
var isTableModule = isNullOrUndefined(self.tableModule) ? true : self.tableModule ?
|
|
75
71
|
self.tableModule.ensureInsideTableList : false;
|
|
76
72
|
if ((event.which === 9 && isTableModule) || event.which !== 9) {
|
|
73
|
+
if (event.which === 13 && self.editorMode === 'HTML') {
|
|
74
|
+
value = {
|
|
75
|
+
'enterAction': self.enterKey
|
|
76
|
+
};
|
|
77
|
+
}
|
|
77
78
|
this.editorManager.observer.notify((event.type === 'keydown' ? KEY_DOWN : KEY_UP), {
|
|
78
79
|
event: event,
|
|
79
80
|
callBack: this.onSuccess.bind(this, self),
|
|
80
|
-
value: value
|
|
81
|
+
value: value,
|
|
82
|
+
enterAction: self.enterKey
|
|
81
83
|
});
|
|
82
84
|
}
|
|
83
85
|
}
|
|
@@ -105,7 +107,7 @@ var Formatter = /** @class */ (function () {
|
|
|
105
107
|
else {
|
|
106
108
|
_this.editorManager.observer.notify(CONSTANT.checkUndo, { subCommand: actionBeginArgs.item.subCommand });
|
|
107
109
|
_this.editorManager.execCommand(actionBeginArgs.item.command, actionBeginArgs.item.subCommand, event, _this.onSuccess.bind(_this, self), actionBeginArgs.item.value, actionBeginArgs.item.subCommand === 'Pre' && args.name === 'dropDownSelect' ?
|
|
108
|
-
{ name: args.name } : value, ('#' + self.getID() + ' iframe'));
|
|
110
|
+
{ name: args.name } : value, ('#' + self.getID() + ' iframe'), self.enterKey);
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
});
|
|
@@ -149,14 +149,14 @@ export var tools = {
|
|
|
149
149
|
'numberformatlist': {
|
|
150
150
|
'id': 'NumberFormatList',
|
|
151
151
|
'icon': 'e-order-list',
|
|
152
|
-
'tooltip': '
|
|
152
|
+
'tooltip': 'Number Format List',
|
|
153
153
|
'command': 'NumberFormatList',
|
|
154
154
|
'subCommand': 'NumberFormatList'
|
|
155
155
|
},
|
|
156
156
|
'bulletformatlist': {
|
|
157
157
|
'id': 'BulletFormatList',
|
|
158
158
|
'icon': 'e-unorder-list',
|
|
159
|
-
'tooltip': '
|
|
159
|
+
'tooltip': 'Bullet Format List',
|
|
160
160
|
'command': 'BulletFormatList',
|
|
161
161
|
'subCommand': 'BulletFormatList'
|
|
162
162
|
},
|
|
@@ -330,7 +330,7 @@ export var tools = {
|
|
|
330
330
|
},
|
|
331
331
|
'dimension': {
|
|
332
332
|
'id': 'Dimension',
|
|
333
|
-
'icon': 'e-dimension',
|
|
333
|
+
'icon': 'e-img-dimension',
|
|
334
334
|
'tooltip': 'Change Size',
|
|
335
335
|
'command': 'Images',
|
|
336
336
|
'subCommand': 'Dimension'
|
|
@@ -39,10 +39,10 @@ var IframeContentRender = /** @class */ (function (_super) {
|
|
|
39
39
|
rteContent + '</body></html>';
|
|
40
40
|
var iFrameContent = IFRAMEHEADER + iFrameBodyContent;
|
|
41
41
|
var iframe = this.parent.createElement('iframe', {
|
|
42
|
-
innerHTML: iFrameContent,
|
|
43
42
|
id: this.parent.getID() + '_rte-view',
|
|
44
43
|
className: 'e-rte-content',
|
|
45
|
-
styles: 'display:block;'
|
|
44
|
+
styles: 'display:block;',
|
|
45
|
+
attrs: { 'srcdoc': iFrameContent }
|
|
46
46
|
});
|
|
47
47
|
this.setPanel(iframe);
|
|
48
48
|
rteObj.element.appendChild(iframe);
|
|
@@ -24,10 +24,15 @@ export declare class Image {
|
|
|
24
24
|
private imgEle;
|
|
25
25
|
private prevSelectedImgEle;
|
|
26
26
|
private isImgUploaded;
|
|
27
|
+
private isAllowedTypes;
|
|
27
28
|
private pageX;
|
|
28
29
|
private pageY;
|
|
29
30
|
private dialogRenderObj;
|
|
30
31
|
private deletedImg;
|
|
32
|
+
private changedWidthValue;
|
|
33
|
+
private changedHeightValue;
|
|
34
|
+
private inputWidthValue;
|
|
35
|
+
private inputHeightValue;
|
|
31
36
|
private constructor();
|
|
32
37
|
protected addEventListener(): void;
|
|
33
38
|
protected removeEventListener(): void;
|
|
@@ -87,6 +92,7 @@ export declare class Image {
|
|
|
87
92
|
private imageUrlPopup;
|
|
88
93
|
private insertImageUrl;
|
|
89
94
|
private imgsizeInput;
|
|
95
|
+
private inputValue;
|
|
90
96
|
private insertSize;
|
|
91
97
|
private insertImage;
|
|
92
98
|
private imgUpload;
|