@syncfusion/ej2-richtexteditor 20.3.61 → 20.4.38
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 +16 -1
- package/CHANGELOG.md +0 -40
- package/README.md +53 -45
- package/dist/ej2-richtexteditor.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +312 -181
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +300 -168
- 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 +15 -15
- package/src/editor-manager/plugin/clearformat.js +2 -1
- package/src/editor-manager/plugin/dom-node.js +1 -1
- package/src/editor-manager/plugin/formats.js +1 -0
- package/src/editor-manager/plugin/image.js +1 -0
- package/src/editor-manager/plugin/link.js +3 -1
- package/src/editor-manager/plugin/lists.js +15 -7
- package/src/editor-manager/plugin/ms-word-clean-up.js +6 -2
- package/src/editor-manager/plugin/selection-commands.js +8 -41
- package/src/editor-manager/plugin/table.js +6 -0
- package/src/editor-manager/plugin/toolbar-status.js +3 -0
- package/src/editor-manager/plugin/video.js +2 -2
- package/src/markdown-parser/plugin/clearformat.js +9 -7
- package/src/markdown-parser/plugin/formats.js +6 -5
- package/src/markdown-parser/plugin/lists.js +5 -0
- package/src/markdown-parser/plugin/markdown-selection.js +3 -0
- package/src/markdown-parser/plugin/md-selection-formats.js +13 -10
- package/src/rich-text-editor/actions/enter-key.js +66 -15
- package/src/rich-text-editor/actions/file-manager.js +1 -0
- package/src/rich-text-editor/actions/html-attributes.js +8 -8
- package/src/rich-text-editor/actions/html-editor.js +2 -0
- package/src/rich-text-editor/actions/keyboard.js +4 -4
- package/src/rich-text-editor/actions/markdown-toolbar-status.js +2 -1
- package/src/rich-text-editor/actions/paste-clean-up.js +2 -1
- package/src/rich-text-editor/actions/toolbar.js +2 -0
- package/src/rich-text-editor/base/constant.d.ts +8 -8
- package/src/rich-text-editor/base/constant.js +8 -8
- package/src/rich-text-editor/base/rich-text-editor.d.ts +2 -0
- package/src/rich-text-editor/base/rich-text-editor.js +43 -10
- package/src/rich-text-editor/base/util.js +9 -9
- package/src/rich-text-editor/renderer/audio-module.d.ts +1 -1
- package/src/rich-text-editor/renderer/audio-module.js +7 -5
- package/src/rich-text-editor/renderer/image-module.js +10 -6
- package/src/rich-text-editor/renderer/link-module.js +5 -4
- package/src/rich-text-editor/renderer/table-module.js +19 -5
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +1 -0
- package/src/rich-text-editor/renderer/toolbar-renderer.js +1 -0
- package/src/rich-text-editor/renderer/video-module.d.ts +1 -1
- package/src/rich-text-editor/renderer/video-module.js +13 -4
- package/src/rich-text-editor/services/renderer-factory.js +4 -4
- package/src/rich-text-editor/services/service-locator.js +4 -4
- package/src/selection/selection.js +2 -0
- package/styles/bootstrap-dark.css +12 -5
- package/styles/bootstrap.css +12 -5
- package/styles/bootstrap4.css +12 -5
- package/styles/bootstrap5-dark.css +12 -5
- package/styles/bootstrap5.css +12 -5
- package/styles/fabric-dark.css +12 -5
- package/styles/fabric.css +12 -5
- package/styles/fluent-dark.css +12 -5
- package/styles/fluent.css +12 -5
- package/styles/highcontrast-light.css +12 -5
- package/styles/highcontrast.css +12 -5
- package/styles/material-dark.css +12 -5
- package/styles/material.css +12 -5
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +1 -0
- package/styles/rich-text-editor/_bootstrap-definition.scss +1 -0
- package/styles/rich-text-editor/_bootstrap4-definition.scss +1 -0
- package/styles/rich-text-editor/_bootstrap5-definition.scss +1 -0
- package/styles/rich-text-editor/_fabric-dark-definition.scss +1 -0
- package/styles/rich-text-editor/_fabric-definition.scss +1 -0
- package/styles/rich-text-editor/_fluent-definition.scss +1 -0
- package/styles/rich-text-editor/_fusionnew-definition.scss +1 -0
- package/styles/rich-text-editor/_highcontrast-definition.scss +1 -0
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +1 -0
- package/styles/rich-text-editor/_material-dark-definition.scss +1 -0
- package/styles/rich-text-editor/_material-definition.scss +1 -0
- package/styles/rich-text-editor/_material3-definition.scss +1 -0
- package/styles/rich-text-editor/_tailwind-definition.scss +1 -0
- package/styles/rich-text-editor/_theme.scss +11 -6
- package/styles/rich-text-editor/bootstrap-dark.css +12 -5
- package/styles/rich-text-editor/bootstrap.css +12 -5
- package/styles/rich-text-editor/bootstrap4.css +12 -5
- package/styles/rich-text-editor/bootstrap5-dark.css +12 -5
- package/styles/rich-text-editor/bootstrap5.css +12 -5
- package/styles/rich-text-editor/fabric-dark.css +12 -5
- package/styles/rich-text-editor/fabric.css +12 -5
- package/styles/rich-text-editor/fluent-dark.css +12 -5
- package/styles/rich-text-editor/fluent.css +12 -5
- package/styles/rich-text-editor/highcontrast-light.css +12 -5
- package/styles/rich-text-editor/highcontrast.css +12 -5
- package/styles/rich-text-editor/material-dark.css +12 -5
- package/styles/rich-text-editor/material.css +12 -5
- package/styles/rich-text-editor/tailwind-dark.css +12 -5
- package/styles/rich-text-editor/tailwind.css +12 -5
- package/styles/tailwind-dark.css +12 -5
- package/styles/tailwind.css +12 -5
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 20.
|
|
3
|
+
* version : 20.4.38
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@syncfusion/ej2-richtexteditor@*",
|
|
3
|
-
"_id": "@syncfusion/ej2-richtexteditor@
|
|
3
|
+
"_id": "@syncfusion/ej2-richtexteditor@19.12.13",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-NrHw57pb65pb0YSr2lpOQ2quYsJxgnDVkWE5PmaOs3aHKQSc9pDt6w80P5ZE9psSSG1gkc4ie3l3f+gB+VsU8w==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-richtexteditor",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"/@syncfusion/ej2-react-richtexteditor",
|
|
27
27
|
"/@syncfusion/ej2-vue-richtexteditor"
|
|
28
28
|
],
|
|
29
|
-
"_resolved": "https://nexus.syncfusion.com/repository/ej2-
|
|
30
|
-
"_shasum": "
|
|
29
|
+
"_resolved": "https://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-19.12.13.tgz",
|
|
30
|
+
"_shasum": "042bd3a46b2817c540d359e6cdef985e35995533",
|
|
31
31
|
"_spec": "@syncfusion/ej2-richtexteditor@*",
|
|
32
32
|
"_where": "/jenkins/workspace/ease-automation_release_19.1.0.1/packages/included",
|
|
33
33
|
"author": {
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
},
|
|
39
39
|
"bundleDependencies": false,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@syncfusion/ej2-base": "~20.
|
|
42
|
-
"@syncfusion/ej2-buttons": "~20.
|
|
43
|
-
"@syncfusion/ej2-filemanager": "~20.
|
|
44
|
-
"@syncfusion/ej2-inputs": "~20.
|
|
45
|
-
"@syncfusion/ej2-navigations": "~20.
|
|
46
|
-
"@syncfusion/ej2-popups": "~20.
|
|
47
|
-
"@syncfusion/ej2-splitbuttons": "~20.
|
|
41
|
+
"@syncfusion/ej2-base": "~20.4.38",
|
|
42
|
+
"@syncfusion/ej2-buttons": "~20.4.38",
|
|
43
|
+
"@syncfusion/ej2-filemanager": "~20.4.38",
|
|
44
|
+
"@syncfusion/ej2-inputs": "~20.4.38",
|
|
45
|
+
"@syncfusion/ej2-navigations": "~20.4.38",
|
|
46
|
+
"@syncfusion/ej2-popups": "~20.4.38",
|
|
47
|
+
"@syncfusion/ej2-splitbuttons": "~20.4.38"
|
|
48
48
|
},
|
|
49
49
|
"deprecated": false,
|
|
50
50
|
"description": "Essential JS 2 RichTextEditor component",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"keywords": [
|
|
55
55
|
"ej2",
|
|
56
56
|
"syncfusion",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
57
|
+
"HTML5-rich-text-editor",
|
|
58
|
+
"wysiwyg-html-editor",
|
|
59
59
|
"rich-text-editor",
|
|
60
|
-
"markdowneditor",
|
|
61
60
|
"markdown-editor",
|
|
61
|
+
"wysiwyg-markdown-editor",
|
|
62
62
|
"editor"
|
|
63
63
|
],
|
|
64
64
|
"license": "SEE LICENSE IN license",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
"url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
|
|
71
71
|
},
|
|
72
72
|
"typings": "index.d.ts",
|
|
73
|
-
"version": "20.
|
|
73
|
+
"version": "20.4.38",
|
|
74
74
|
"sideEffects": false
|
|
75
75
|
}
|
|
@@ -187,7 +187,8 @@ var ClearFormat = /** @class */ (function () {
|
|
|
187
187
|
this.unWrap(docElement, blockNodes, nodeCutter, nodeSelection);
|
|
188
188
|
}
|
|
189
189
|
else if (this.BLOCK_TAGS.indexOf(childNodes[index2].nodeName.toLocaleLowerCase()) > -1 &&
|
|
190
|
-
childNodes[index2].parentNode.nodeName.toLocaleLowerCase() ===
|
|
190
|
+
childNodes[index2].parentNode.nodeName.toLocaleLowerCase() ===
|
|
191
|
+
childNodes[index2].nodeName.toLocaleLowerCase()) {
|
|
191
192
|
InsertMethods.unwrap(childNodes[index2]);
|
|
192
193
|
}
|
|
193
194
|
else if (this.BLOCK_TAGS.indexOf(childNodes[index2].nodeName.toLocaleLowerCase()) > -1 &&
|
|
@@ -114,7 +114,7 @@ var DOMNode = /** @class */ (function () {
|
|
|
114
114
|
var orderRawAttr = Object.keys(rawAttr).sort();
|
|
115
115
|
for (var e = 0; e < orderRawAttr.length; e++) {
|
|
116
116
|
var attrKey = orderRawAttr[e];
|
|
117
|
-
var attrValue = rawAttr[attrKey];
|
|
117
|
+
var attrValue = rawAttr["" + attrKey];
|
|
118
118
|
/* eslint-disable */
|
|
119
119
|
if (attrValue.indexOf("'") < 0 && attrValue.indexOf('"') >= 0) {
|
|
120
120
|
attr += ' ' + attrKey + "='" + attrValue + "'";
|
|
@@ -107,6 +107,7 @@ var Formats = /** @class */ (function () {
|
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
Formats.prototype.removeCodeContent = function (range) {
|
|
110
|
+
// eslint-disable-next-line
|
|
110
111
|
var regEx = new RegExp(String.fromCharCode(65279), 'g');
|
|
111
112
|
if (!isNOU(range.endContainer.textContent.match(regEx))) {
|
|
112
113
|
var pointer = range.endContainer.textContent.charCodeAt(range.endOffset - 1) === 65279 ?
|
|
@@ -182,6 +182,7 @@ var ImageCommand = /** @class */ (function () {
|
|
|
182
182
|
this.callBack(e);
|
|
183
183
|
};
|
|
184
184
|
ImageCommand.prototype.openImageLink = function (e) {
|
|
185
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
185
186
|
document.defaultView.open(e.item.url, e.item.target);
|
|
186
187
|
this.callBack(e);
|
|
187
188
|
};
|
|
@@ -152,7 +152,8 @@ var LinkCommand = /** @class */ (function () {
|
|
|
152
152
|
finalinlineNodes[j_1] = inlineNodes[i];
|
|
153
153
|
}
|
|
154
154
|
if (inlineNodes.length > 1 && i < inlineNodes.length - 1) {
|
|
155
|
-
if ((inlineNodes[i].parentElement === inlineNodes[i + 1].parentElement) &&
|
|
155
|
+
if ((inlineNodes[i].parentElement === inlineNodes[i + 1].parentElement) &&
|
|
156
|
+
(inlineNodes[i] === inlineNodes[i + 1])) {
|
|
156
157
|
continue;
|
|
157
158
|
}
|
|
158
159
|
else {
|
|
@@ -249,6 +250,7 @@ var LinkCommand = /** @class */ (function () {
|
|
|
249
250
|
return arr.join(' ') + ' ';
|
|
250
251
|
};
|
|
251
252
|
LinkCommand.prototype.openLink = function (e) {
|
|
253
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
252
254
|
document.defaultView.open(e.item.url, e.item.target);
|
|
253
255
|
this.callBack(e);
|
|
254
256
|
};
|
|
@@ -91,8 +91,15 @@ var Lists = /** @class */ (function () {
|
|
|
91
91
|
range.startContainer.parentElement.closest('LI');
|
|
92
92
|
var endNode = range.endContainer.nodeName === 'LI' ? range.endContainer :
|
|
93
93
|
range.endContainer.parentElement.closest('LI');
|
|
94
|
+
// Checks for Image, Audio , Video Element inside List Element
|
|
95
|
+
var hasMediaElem = false;
|
|
96
|
+
if (!isNOU(startNode)) {
|
|
97
|
+
var videoElemList = startNode.querySelectorAll('.e-video-clickelem');
|
|
98
|
+
var embedVideoElem = videoElemList.length > 0 && videoElemList[0].childNodes[0].nodeName === 'IFRAME';
|
|
99
|
+
hasMediaElem = startNode.querySelectorAll('IMG').length > 0 || startNode.querySelectorAll('AUDIO').length > 0 || startNode.querySelectorAll('VIDEO').length > 0 || embedVideoElem;
|
|
100
|
+
}
|
|
94
101
|
if (!isNOU(startNode) && !isNOU(endNode) && startNode === endNode && startNode.tagName === 'LI' &&
|
|
95
|
-
startNode.textContent.trim() === '' &&
|
|
102
|
+
startNode.textContent.trim() === '' && !hasMediaElem) {
|
|
96
103
|
if (startNode.innerHTML.indexOf(' ') >= 0) {
|
|
97
104
|
return;
|
|
98
105
|
}
|
|
@@ -129,7 +136,6 @@ var Lists = /** @class */ (function () {
|
|
|
129
136
|
}
|
|
130
137
|
}
|
|
131
138
|
};
|
|
132
|
-
// eslint-disable-next-line
|
|
133
139
|
Lists.prototype.backspaceList = function (e) {
|
|
134
140
|
var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
135
141
|
var startNode = this.parent.domNode.getSelectedNode(range.startContainer, range.startOffset);
|
|
@@ -215,7 +221,8 @@ var Lists = /** @class */ (function () {
|
|
|
215
221
|
detach(currentLIElem);
|
|
216
222
|
}
|
|
217
223
|
};
|
|
218
|
-
|
|
224
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
225
|
+
Lists.prototype.firstListBackSpace = function (range, _e) {
|
|
219
226
|
var startNode = this.parent.domNode.getSelectedNode(range.startContainer, range.startOffset);
|
|
220
227
|
if (!isNOU(startNode.closest('OL'))) {
|
|
221
228
|
this.commonLIParent = startNode.closest('OL');
|
|
@@ -478,6 +485,7 @@ var Lists = /** @class */ (function () {
|
|
|
478
485
|
range.startOffset]) || range.startContainer);
|
|
479
486
|
var endNode = (range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) :
|
|
480
487
|
range.endOffset] || range.endContainer);
|
|
488
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
481
489
|
var lastSelectionNode = endNode.lastChild.nodeName === 'BR' ? (isNOU(endNode.lastChild.previousSibling) ? endNode
|
|
482
490
|
: endNode.lastChild.previousSibling) : endNode.lastChild;
|
|
483
491
|
while (!isNOU(lastSelectionNode) && lastSelectionNode.nodeName !== '#text' && lastSelectionNode.nodeName !== 'IMG' &&
|
|
@@ -620,8 +628,8 @@ var Lists = /** @class */ (function () {
|
|
|
620
628
|
var openTag = '<' + type + '>';
|
|
621
629
|
var closeTag = '</' + type + '>';
|
|
622
630
|
var newTag = 'li' + elemAtt;
|
|
623
|
-
var replaceHTML = (elements[i].tagName.toLowerCase() === CONSTANT.DEFAULT_TAG ?
|
|
624
|
-
elements[i].outerHTML);
|
|
631
|
+
var replaceHTML = (elements[i].tagName.toLowerCase() === CONSTANT.DEFAULT_TAG ?
|
|
632
|
+
elements[i].innerHTML : elements[i].outerHTML);
|
|
625
633
|
var innerHTML = this.domNode.createTagString(newTag, null, replaceHTML);
|
|
626
634
|
var collectionString = openTag + innerHTML + closeTag;
|
|
627
635
|
this.domNode.replaceWith(elements[i], collectionString);
|
|
@@ -633,8 +641,8 @@ var Lists = /** @class */ (function () {
|
|
|
633
641
|
var openTag = '<' + type + elemAtt + '>';
|
|
634
642
|
var closeTag = '</' + type + '>';
|
|
635
643
|
var newTag = 'li';
|
|
636
|
-
var replaceHTML = (elements[i].tagName.toLowerCase() === CONSTANT.DEFAULT_TAG ?
|
|
637
|
-
elements[i].outerHTML);
|
|
644
|
+
var replaceHTML = (elements[i].tagName.toLowerCase() === CONSTANT.DEFAULT_TAG ?
|
|
645
|
+
elements[i].innerHTML : elements[i].outerHTML);
|
|
638
646
|
var innerHTML = this.domNode.createTagString(newTag, null, replaceHTML);
|
|
639
647
|
var collectionString = openTag + innerHTML + closeTag;
|
|
640
648
|
this.domNode.replaceWith(elements[i], collectionString);
|
|
@@ -205,6 +205,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
205
205
|
MsWordPaste.prototype.hexConversion = function (rtfData) {
|
|
206
206
|
// eslint-disable-next-line
|
|
207
207
|
var picHead = /\{\\pict[\s\S]+?\\bliptag\-?\d+(\\blipupi\-?\d+)?(\{\\\*\\blipuid\s?[\da-fA-F]+)?[\s\}]*?/;
|
|
208
|
+
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
208
209
|
var pic = new RegExp('(?:(' + picHead.source + '))([\\da-fA-F\\s]+)\\}', 'g');
|
|
209
210
|
var fullImg = rtfData.match(pic);
|
|
210
211
|
var imgType;
|
|
@@ -268,7 +269,9 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
268
269
|
MsWordPaste.prototype.removeUnwantedElements = function (elm) {
|
|
269
270
|
var innerElement = elm.innerHTML;
|
|
270
271
|
for (var i = 0; i < this.removableElements.length; i++) {
|
|
272
|
+
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
271
273
|
var regExpStartElem = new RegExp('<' + this.removableElements[i] + '>', 'g');
|
|
274
|
+
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
272
275
|
var regExpEndElem = new RegExp('</' + this.removableElements[i] + '>', 'g');
|
|
273
276
|
innerElement = innerElement.replace(regExpStartElem, '');
|
|
274
277
|
innerElement = innerElement.replace(regExpEndElem, '');
|
|
@@ -317,7 +320,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
317
320
|
var styleClassObject_1 = !isNOU(styles) ? this.findStyleObject(styles) : null;
|
|
318
321
|
var keys = Object.keys(styleClassObject_1);
|
|
319
322
|
var values = keys.map(function (key) {
|
|
320
|
-
return styleClassObject_1[key];
|
|
323
|
+
return styleClassObject_1["" + key];
|
|
321
324
|
});
|
|
322
325
|
values = this.removeUnwantedStyle(values, wordPasteStyleConfig);
|
|
323
326
|
this.filterStyles(elm, wordPasteStyleConfig);
|
|
@@ -599,7 +602,8 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
599
602
|
for (var j = 0; j < collection[index].nestedLevel - pLevel; j++) {
|
|
600
603
|
prevList.appendChild(temp = createElement(collection[index].listType));
|
|
601
604
|
prevList = createElement('li');
|
|
602
|
-
if (j !== collection[index].nestedLevel - pLevel - 1 &&
|
|
605
|
+
if (j !== collection[index].nestedLevel - pLevel - 1 &&
|
|
606
|
+
collection[index].nestedLevel - pLevel > 1) {
|
|
603
607
|
prevList.style.listStyleType = 'none';
|
|
604
608
|
}
|
|
605
609
|
temp.appendChild(prevList);
|
|
@@ -49,7 +49,7 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
49
49
|
var currentFormatNode = isFormatted.getFormattedNode(range.startContainer, format, endNode);
|
|
50
50
|
var currentSelector = !isNOU(currentFormatNode) ?
|
|
51
51
|
(currentFormatNode.getAttribute('style') === null ? currentFormatNode.nodeName :
|
|
52
|
-
currentFormatNode.nodeName +
|
|
52
|
+
currentFormatNode.nodeName + '[style=\'' + currentFormatNode.getAttribute('style') + '\']') : null;
|
|
53
53
|
if (nodes.length > 0) {
|
|
54
54
|
isCollapsed = true;
|
|
55
55
|
range = nodeCutter.GetCursorRange(docElement, range, nodes[0]);
|
|
@@ -58,7 +58,9 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
58
58
|
range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') ||
|
|
59
59
|
!isNOU(currentFormatNode) && currentFormatNode ===
|
|
60
60
|
(range.startContainer.parentElement.closest(currentSelector)) &&
|
|
61
|
-
((range.startContainer.parentElement.closest(currentSelector)).textContent.replace(
|
|
61
|
+
((range.startContainer.parentElement.closest(currentSelector)).textContent.replace(
|
|
62
|
+
// eslint-disable-next-line
|
|
63
|
+
new RegExp(String.fromCharCode(8203), 'g'), '').trim().length !== 0))) {
|
|
62
64
|
isCollapsed = true;
|
|
63
65
|
range = nodeCutter.GetCursorRange(docElement, range, range.startContainer);
|
|
64
66
|
nodes.push(range.startContainer);
|
|
@@ -93,15 +95,6 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
93
95
|
isSubSup = formatNode === null ? false : true;
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
|
-
else if (formatNode.textContent !== nodes[index].textContent && formatNode.nodeName === 'SPAN' && formatNode.style[0] === 'font-size') {
|
|
97
|
-
var currentParentElem = nodes[index].parentElement.textContent !== nodes[index].textContent ? nodes[index] : nodes[index].parentElement;
|
|
98
|
-
var isSameTextContent = true;
|
|
99
|
-
while (currentParentElem.textContent !== nodes[index].textContent && nodes[index].style[0] !== format && currentParentElem.nodeName === 'SPAN') {
|
|
100
|
-
isSameTextContent = currentParentElem.textContent === currentParentElem.parentElement.textContent;
|
|
101
|
-
currentParentElem = !isNOU(currentParentElem.parentElement) && isSameTextContent ? currentParentElem.parentElement : currentParentElem;
|
|
102
|
-
}
|
|
103
|
-
formatNode = currentParentElem;
|
|
104
|
-
}
|
|
105
98
|
if (index === 0 && formatNode === null) {
|
|
106
99
|
isFormat = true;
|
|
107
100
|
}
|
|
@@ -135,7 +128,7 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
135
128
|
if (cursorFormat) {
|
|
136
129
|
cursorNode = cursorNodes[0];
|
|
137
130
|
if (cursorFormat.firstChild.textContent.charCodeAt(0) === 8203 && cursorFormat.firstChild.nodeType === 3) {
|
|
138
|
-
|
|
131
|
+
// eslint-disable-next-line
|
|
139
132
|
var regEx = new RegExp(String.fromCharCode(8203), 'g');
|
|
140
133
|
var emptySpaceNode = void 0;
|
|
141
134
|
if (cursorFormat.firstChild === cursorNode) {
|
|
@@ -146,7 +139,6 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
146
139
|
cursorFormat.parentElement.firstChild && cursorFormat.parentElement.firstChild.nodeType === 1) ?
|
|
147
140
|
cursorNode.textContent : cursorNode.textContent.replace(regEx, ''));
|
|
148
141
|
emptySpaceNode = cursorNode;
|
|
149
|
-
isCursorEqual = true;
|
|
150
142
|
}
|
|
151
143
|
else {
|
|
152
144
|
cursorFormat.firstChild.textContent = cursorFormat.firstChild.textContent.replace(regEx, '');
|
|
@@ -318,7 +310,8 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
318
310
|
}
|
|
319
311
|
if (child.length > 0 && isFontStyle) {
|
|
320
312
|
for (var num = 0; num < child.length; num++) {
|
|
321
|
-
if (child[num].nodeType !== 3 || (child[num].textContent &&
|
|
313
|
+
if (child[num].nodeType !== 3 || (child[num].textContent &&
|
|
314
|
+
child[num].textContent.trim().length > 0)) {
|
|
322
315
|
child[num] = InsertMethods.Wrap(child[num], this.GetFormatNode(format, value, formatNodeTagName, formatNodeStyles));
|
|
323
316
|
if (child[num].textContent === startText) {
|
|
324
317
|
if (num === 0) {
|
|
@@ -394,33 +387,7 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
394
387
|
liElement.style.textDecoration = 'inherit';
|
|
395
388
|
}
|
|
396
389
|
}
|
|
397
|
-
|
|
398
|
-
var currentNode = nodes[index];
|
|
399
|
-
var isNestedNode = !isNOU(currentNode) && nodes[index].nodeName === '#text' && nodes[index].parentElement.nodeName !== enterType;
|
|
400
|
-
var currentParentElem = currentNode.parentElement.textContent !== currentNode.textContent ? currentNode : currentNode.parentElement;
|
|
401
|
-
if (isNestedNode) {
|
|
402
|
-
var isSameTextContent = true;
|
|
403
|
-
isNestedNode = false;
|
|
404
|
-
while (!isNOU(currentParentElem) && isSameTextContent && currentParentElem.parentElement.nodeName !== enterType
|
|
405
|
-
&& (currentParentElem.nodeName === 'SPAN' && (currentParentElem.style.textDecoration === 'line-through' || 'underline')
|
|
406
|
-
|| currentParentElem.nodeName === 'SPAN' && (currentParentElem.style[0] === 'background-color' || 'font-family' || 'color')
|
|
407
|
-
|| (currentParentElem.nodeName === 'EM' || 'STRONG' || 'SUB' || 'SUP'))) {
|
|
408
|
-
isSameTextContent = currentParentElem.textContent === currentParentElem.parentElement.textContent;
|
|
409
|
-
currentParentElem = !isNOU(currentParentElem.parentElement) && isSameTextContent ? currentParentElem.parentElement : currentParentElem;
|
|
410
|
-
}
|
|
411
|
-
if (!isNOU(currentParentElem) && currentParentElem.childNodes.length > 0) {
|
|
412
|
-
var nodeList = currentParentElem.querySelectorAll('span,strong,em,sub,sup');
|
|
413
|
-
isNestedNode = nodeList.length > 0 && isSameTextContent;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
if (isNestedNode) {
|
|
417
|
-
var nodeList = [];
|
|
418
|
-
nodeList[0] = currentParentElem;
|
|
419
|
-
this.applyStyles(nodeList, index, element);
|
|
420
|
-
}
|
|
421
|
-
else {
|
|
422
|
-
nodes[index] = this.applyStyles(nodes, index, element);
|
|
423
|
-
}
|
|
390
|
+
nodes[index] = this.applyStyles(nodes, index, element);
|
|
424
391
|
if (format === 'fontsize') {
|
|
425
392
|
var bg = closest(nodes[index].parentElement, 'span[style*=' + 'background-color' + ']');
|
|
426
393
|
if (!isNOU(bg)) {
|
|
@@ -172,6 +172,7 @@ var TableCommand = /** @class */ (function () {
|
|
|
172
172
|
var newRow = createElement('tr');
|
|
173
173
|
var isHeaderSelect = this.curTable.querySelectorAll('th.e-cell-select').length > 0;
|
|
174
174
|
for (var i = 0; i < allCells[minVal].length; i++) {
|
|
175
|
+
// eslint-disable-next-line max-len
|
|
175
176
|
if (isBelow && minVal < allCells.length - 1 && allCells[minVal][i] === allCells[minVal + 1][i] ||
|
|
176
177
|
!isBelow && 0 < minVal && allCells[minVal][i] === allCells[minVal - 1][i]) {
|
|
177
178
|
if (0 === i || 0 < i && allCells[minVal][i] !== allCells[minVal][i - 1]) {
|
|
@@ -351,10 +352,12 @@ var TableCommand = /** @class */ (function () {
|
|
|
351
352
|
1 === rowSpanVal ? allCells[maxI][j].removeAttribute('rowspan') : allCells[maxI][j].setAttribute('rowspan', rowSpanVal.toString());
|
|
352
353
|
}
|
|
353
354
|
}
|
|
355
|
+
// eslint-disable-next-line max-len
|
|
354
356
|
if (maxI < allCells.length - 1 && allCells[maxI][j] === allCells[maxI + 1][j] && (0 === maxI ||
|
|
355
357
|
allCells[maxI][j] !== allCells[maxI - 1][j])) {
|
|
356
358
|
var element = allCells[maxI][j];
|
|
357
359
|
var index = void 0;
|
|
360
|
+
// eslint-disable-next-line max-len
|
|
358
361
|
for (index = j; 0 < index && allCells[maxI][index] === allCells[maxI][index - 1]; index--) {
|
|
359
362
|
if (index === 0) {
|
|
360
363
|
this.curTable.rows[maxI + 1].prepend(element);
|
|
@@ -567,6 +570,7 @@ var TableCommand = /** @class */ (function () {
|
|
|
567
570
|
for (rowValue = min; rowValue <= max; rowValue++) {
|
|
568
571
|
// eslint-disable-next-line
|
|
569
572
|
if (!(min < rowValue && eleArray[rowValue][0] === eleArray[rowValue - 1][0])
|
|
573
|
+
// eslint-disable-next-line no-cond-assign
|
|
570
574
|
&& eleArray[rowValue][0] && 1 < (index = Math.min(parseInt(eleArray[rowValue][0].getAttribute('rowspan'), 10) ||
|
|
571
575
|
1, max - min + 1)) && eleArray[rowValue][0] === eleArray[rowValue + 1][0]) {
|
|
572
576
|
for (count = index - 1, colIndex = 1; colIndex < eleArray[0].length; colIndex++) {
|
|
@@ -603,6 +607,7 @@ var TableCommand = /** @class */ (function () {
|
|
|
603
607
|
min < rowIndex && elements[rowIndex][colIndex] === elements[rowIndex - 1][colIndex] ||
|
|
604
608
|
firstIndex < colIndex && elements[rowIndex][colIndex] === elements[rowIndex][colIndex - 1] ||
|
|
605
609
|
1 < (spanCount = parseInt(elements[rowIndex][colIndex].getAttribute(attr), 10) || 1) &&
|
|
610
|
+
// eslint-disable-next-line max-len
|
|
606
611
|
(1 < spanCount - index ? elements[rowIndex][colIndex].setAttribute(attr, (spanCount - index).toString()) :
|
|
607
612
|
elements[rowIndex][colIndex].removeAttribute(attr));
|
|
608
613
|
}
|
|
@@ -667,6 +672,7 @@ var TableCommand = /** @class */ (function () {
|
|
|
667
672
|
for (avgRowIndex = activeCellIndex[0] + Math.ceil(activeCellRowSpan / 2),
|
|
668
673
|
colIndex = 0 === activeCellIndex[1] ? activeCellIndex[1]
|
|
669
674
|
: activeCellIndex[1] - 1; 0 <= colIndex && (correspondingCells[avgRowIndex][colIndex] ===
|
|
675
|
+
// eslint-disable-next-line max-len
|
|
670
676
|
correspondingCells[avgRowIndex][colIndex - 1] || 0 < avgRowIndex && correspondingCells[avgRowIndex][colIndex]
|
|
671
677
|
=== correspondingCells[avgRowIndex - 1][colIndex]);) {
|
|
672
678
|
colIndex--;
|
|
@@ -53,6 +53,7 @@ var ToolbarStatus = /** @class */ (function () {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
for (var index = 0; index < nodes.length; index++) {
|
|
56
|
+
// eslint-disable-next-line max-len
|
|
56
57
|
formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], targetNode, formatNode, fontSize, fontName);
|
|
57
58
|
if ((index === 0 && formatCollection.bold) || !formatCollection.bold) {
|
|
58
59
|
nodeCollection.bold = formatCollection.bold;
|
|
@@ -232,12 +233,14 @@ var ToolbarStatus = /** @class */ (function () {
|
|
|
232
233
|
var index = null;
|
|
233
234
|
if ((name !== null && name !== '' && name !== undefined)
|
|
234
235
|
&& (fontName === null || fontName === undefined || (fontName.filter(function (value, pos) {
|
|
236
|
+
// eslint-disable-next-line
|
|
235
237
|
var pattern = new RegExp(name, 'i');
|
|
236
238
|
if ((value.replace(/"/g, '').replace(/ /g, '').toLowerCase() === name.replace(/"/g, '').replace(/ /g, '').toLowerCase()) ||
|
|
237
239
|
(value.split(',')[0] && value.split(',')[0].search(pattern) > -1)) {
|
|
238
240
|
index = pos;
|
|
239
241
|
}
|
|
240
242
|
}) && (index !== null)))) {
|
|
243
|
+
// eslint-disable-next-line
|
|
241
244
|
return (index !== null) ? fontName[index] : name.replace(/"/g, '');
|
|
242
245
|
}
|
|
243
246
|
else {
|
|
@@ -174,8 +174,8 @@ var VideoCommand = /** @class */ (function () {
|
|
|
174
174
|
videoElm_1.load();
|
|
175
175
|
}
|
|
176
176
|
if (Browser.userAgent.indexOf('Firefox') !== -1) {
|
|
177
|
-
vidElement.addEventListener('play', function (
|
|
178
|
-
vidElement.addEventListener('pause', function (
|
|
177
|
+
vidElement.addEventListener('play', function () { _this.editAreaVideoClick(e); });
|
|
178
|
+
vidElement.addEventListener('pause', function () { _this.editAreaVideoClick(e); });
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
};
|
|
@@ -38,23 +38,25 @@ var ClearFormat = /** @class */ (function () {
|
|
|
38
38
|
var key = keys[num];
|
|
39
39
|
// eslint-disable-next-line
|
|
40
40
|
if (data.hasOwnProperty(key) && data[key] !== '') {
|
|
41
|
-
var expString = this.replaceRegex(data[key]);
|
|
41
|
+
var expString = this.replaceRegex(data["" + key]);
|
|
42
42
|
var regExp = void 0;
|
|
43
|
-
var startExp = data[key].length;
|
|
44
|
-
var endExp = (data[key] === '<sup>' || data[key] === '<sub>') ? data[key].length + 1 : data[key].length;
|
|
45
|
-
if (data[key] === '<sup>') {
|
|
43
|
+
var startExp = data["" + key].length;
|
|
44
|
+
var endExp = (data["" + key] === '<sup>' || data["" + key] === '<sub>') ? data["" + key].length + 1 : data["" + key].length;
|
|
45
|
+
if (data["" + key] === '<sup>') {
|
|
46
46
|
// eslint-disable-next-line
|
|
47
47
|
regExp = new RegExp('<sup>(.*?)<\/sup>', 'ig');
|
|
48
48
|
}
|
|
49
|
-
else if (data[key] === '<sub>') {
|
|
49
|
+
else if (data["" + key] === '<sub>') {
|
|
50
50
|
// eslint-disable-next-line
|
|
51
51
|
regExp = new RegExp('<sub>(.*?)<\/sub>', 'ig');
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
|
+
// eslint-disable-next-line
|
|
54
55
|
regExp = new RegExp(expString + '(.*?)' + expString, 'ig');
|
|
55
56
|
}
|
|
56
57
|
var val = text.match(regExp);
|
|
57
58
|
for (var index = 0; val && index < val.length && val[index] !== ''; index++) {
|
|
59
|
+
// eslint-disable-next-line max-len
|
|
58
60
|
text = text.replace(val[index], val[index].substr(startExp, val[index].length - endExp - startExp));
|
|
59
61
|
}
|
|
60
62
|
}
|
|
@@ -76,8 +78,8 @@ var ClearFormat = /** @class */ (function () {
|
|
|
76
78
|
var key = keys[index];
|
|
77
79
|
// eslint-disable-next-line
|
|
78
80
|
if (data.hasOwnProperty(key) && data[key] !== '') {
|
|
79
|
-
if (lines[len].indexOf(data[key]) === 0) {
|
|
80
|
-
lines[len] = lines[len].replace(data[key], '');
|
|
81
|
+
if (lines[len].indexOf(data["" + key]) === 0) {
|
|
82
|
+
lines[len] = lines[len].replace(data["" + key], '');
|
|
81
83
|
lines[len] = this.clearFormatLines([lines[len]]);
|
|
82
84
|
}
|
|
83
85
|
}
|
|
@@ -121,6 +121,7 @@ var MDFormats = /** @class */ (function () {
|
|
|
121
121
|
if (configKey[j] === command) {
|
|
122
122
|
continue;
|
|
123
123
|
}
|
|
124
|
+
// eslint-disable-next-line
|
|
124
125
|
var regex = new RegExp('^(' + this.selection.replaceSpecialChar(removeText) + ')', 'gim');
|
|
125
126
|
if (regex.test(parents[i].text)) {
|
|
126
127
|
parents[i].text = parents[i].text.replace(regex, '');
|
|
@@ -164,14 +165,14 @@ var MDFormats = /** @class */ (function () {
|
|
|
164
165
|
!this.selection.isStartWith(lastNextText, this.syntax.pre.split('\n')[0])) {
|
|
165
166
|
var lines = textArea.value.substring(start, end).split('\n');
|
|
166
167
|
var lastLine = lines[lines.length - 1] === '' ? '' : '\n';
|
|
167
|
-
textArea.value = textArea.value.substr(0, start) + this.syntax[command] + textArea.value.substring(start, end) +
|
|
168
|
-
lastLine + this.syntax[command] +
|
|
168
|
+
textArea.value = textArea.value.substr(0, start) + this.syntax["" + command] + textArea.value.substring(start, end) +
|
|
169
|
+
lastLine + this.syntax["" + command] +
|
|
169
170
|
textArea.value.substr(end, textArea.value.length);
|
|
170
|
-
start = this.selection.selectionStart + this.syntax[command].length;
|
|
171
|
-
end = this.selection.selectionEnd + this.syntax[command].length - 1;
|
|
171
|
+
start = this.selection.selectionStart + this.syntax["" + command].length;
|
|
172
|
+
end = this.selection.selectionEnd + this.syntax["" + command].length - 1;
|
|
172
173
|
}
|
|
173
174
|
else {
|
|
174
|
-
var cmd = this.syntax[command];
|
|
175
|
+
var cmd = this.syntax["" + command];
|
|
175
176
|
var selection = this.parent.markdownSelection.getSelectedInlinePoints(textArea);
|
|
176
177
|
var startNo = textArea.value.substr(0, textArea.selectionStart).lastIndexOf(cmd);
|
|
177
178
|
var endNo = textArea.value.substr(textArea.selectionEnd, textArea.selectionEnd).indexOf(cmd);
|
|
@@ -64,6 +64,7 @@ var MDLists = /** @class */ (function () {
|
|
|
64
64
|
var regex = this.getListRegex();
|
|
65
65
|
this.currentAction = this.getAction(parents[0].text);
|
|
66
66
|
for (var i = 0; i < parents.length; i++) {
|
|
67
|
+
// eslint-disable-next-line max-len
|
|
67
68
|
var prevIndex = event.event.shiftKey ? parents[i].line - 1 : parents[i].line - 1;
|
|
68
69
|
var prevLine = this.selection.getLine(textArea, prevIndex);
|
|
69
70
|
if (prevLine && (!event.event.shiftKey && isNotFirst || (event.event.shiftKey))) {
|
|
@@ -111,6 +112,7 @@ var MDLists = /** @class */ (function () {
|
|
|
111
112
|
addedLength += tabSpaceLength;
|
|
112
113
|
if (parents.length !== 1) {
|
|
113
114
|
for (var j = i; j < parents.length; j++) {
|
|
115
|
+
// eslint-disable-next-line max-len
|
|
114
116
|
parents[j].start = j !== 0 ? parents[j].start + tabSpaceLength : parents[j].start;
|
|
115
117
|
parents[j].end = parents[j].end + tabSpaceLength;
|
|
116
118
|
}
|
|
@@ -241,6 +243,7 @@ var MDLists = /** @class */ (function () {
|
|
|
241
243
|
var ol = line.split('. ')[0];
|
|
242
244
|
// eslint-disable-next-line
|
|
243
245
|
var currentState = /^\d+$/.test(ol.trim());
|
|
246
|
+
// eslint-disable-next-line
|
|
244
247
|
var ul = line.trim().split(new RegExp('^(' + this.selection.replaceSpecialChar(this.syntax.UL).trim() + ')'))[1];
|
|
245
248
|
return (currentState ? 'OL' : ul ? 'UL' : 'NOTLIST');
|
|
246
249
|
};
|
|
@@ -400,6 +403,7 @@ var MDLists = /** @class */ (function () {
|
|
|
400
403
|
};
|
|
401
404
|
MDLists.prototype.appliedLine = function (line, prefixPattern, perfixObj, preTabSpaceLength) {
|
|
402
405
|
var points = {};
|
|
406
|
+
// eslint-disable-next-line
|
|
403
407
|
var regex = new RegExp('^[' + this.syntax.UL.trim() + ']');
|
|
404
408
|
var lineSplit = line.split('. ');
|
|
405
409
|
var currentPrefix = lineSplit[0] + '. ';
|
|
@@ -463,6 +467,7 @@ var MDLists = /** @class */ (function () {
|
|
|
463
467
|
regex += regex === '' ? '^(' + syntax + ')|^(' + syntax.trim() + ')' :
|
|
464
468
|
'|^(' + syntax + ')|^(' + syntax.trim() + ')';
|
|
465
469
|
}
|
|
470
|
+
// eslint-disable-next-line
|
|
466
471
|
return new RegExp(regex);
|
|
467
472
|
};
|
|
468
473
|
return MDLists;
|
|
@@ -161,7 +161,9 @@ var MarkdownSelection = /** @class */ (function () {
|
|
|
161
161
|
var isStart = false;
|
|
162
162
|
if (line) {
|
|
163
163
|
var reg = line.trim() === command.trim() ?
|
|
164
|
+
// eslint-disable-next-line
|
|
164
165
|
new RegExp('^(' + this.replaceSpecialChar(command.trim()) + ')', 'gim') :
|
|
166
|
+
// eslint-disable-next-line
|
|
165
167
|
new RegExp('^(' + this.replaceSpecialChar(command) + ')', 'gim');
|
|
166
168
|
isStart = reg.test(line.trim());
|
|
167
169
|
}
|
|
@@ -191,6 +193,7 @@ var MarkdownSelection = /** @class */ (function () {
|
|
|
191
193
|
MarkdownSelection.prototype.isClear = function (parents, regex) {
|
|
192
194
|
var isClear = false;
|
|
193
195
|
for (var i = 0; i < parents.length; i++) {
|
|
196
|
+
// eslint-disable-next-line
|
|
194
197
|
if (new RegExp(regex, 'gim').test(parents[i].text)) {
|
|
195
198
|
return true;
|
|
196
199
|
}
|
|
@@ -72,9 +72,11 @@ var MDSelectionFormats = /** @class */ (function () {
|
|
|
72
72
|
return matchText;
|
|
73
73
|
};
|
|
74
74
|
MDSelectionFormats.prototype.multiCharRegx = function (cmd) {
|
|
75
|
+
// eslint-disable-next-line
|
|
75
76
|
return new RegExp('(\\' + cmd + '\\' + cmd + ')', 'g');
|
|
76
77
|
};
|
|
77
78
|
MDSelectionFormats.prototype.singleCharRegx = function (cmd) {
|
|
79
|
+
// eslint-disable-next-line
|
|
78
80
|
return new RegExp('(\\' + cmd + ')', 'g');
|
|
79
81
|
};
|
|
80
82
|
MDSelectionFormats.prototype.isAppliedCommand = function (cmd) {
|
|
@@ -263,22 +265,22 @@ var MDSelectionFormats = /** @class */ (function () {
|
|
|
263
265
|
}
|
|
264
266
|
};
|
|
265
267
|
MDSelectionFormats.prototype.textReplace = function (text, command) {
|
|
266
|
-
var regx = this.singleCharRegx(this.syntax[command]);
|
|
268
|
+
var regx = this.singleCharRegx(this.syntax["" + command]);
|
|
267
269
|
switch (command) {
|
|
268
270
|
case 'Bold':
|
|
269
|
-
regx = this.multiCharRegx(this.syntax[command].substr(0, 1));
|
|
271
|
+
regx = this.multiCharRegx(this.syntax["" + command].substr(0, 1));
|
|
270
272
|
text = text.replace(regx, '');
|
|
271
273
|
break;
|
|
272
274
|
case 'Italic':
|
|
273
|
-
if (!this.isBold(text, this.syntax[command].substr(0, 1))) {
|
|
275
|
+
if (!this.isBold(text, this.syntax["" + command].substr(0, 1))) {
|
|
274
276
|
text = text.replace(regx, '');
|
|
275
277
|
}
|
|
276
278
|
else {
|
|
277
|
-
var regxB = this.multiCharRegx(this.syntax[command].substr(0, 1));
|
|
279
|
+
var regxB = this.multiCharRegx(this.syntax["" + command].substr(0, 1));
|
|
278
280
|
var repText = text;
|
|
279
281
|
repText = repText.replace(regxB, '$%@').replace(regx, '');
|
|
280
282
|
var regxTemp = new RegExp('\\$%@', 'g');
|
|
281
|
-
text = repText.replace(regxTemp, this.syntax[command].substr(0, 1) + this.syntax[command].substr(0, 1));
|
|
283
|
+
text = repText.replace(regxTemp, this.syntax["" + command].substr(0, 1) + this.syntax["" + command].substr(0, 1));
|
|
282
284
|
}
|
|
283
285
|
break;
|
|
284
286
|
case 'StrikeThrough':
|
|
@@ -297,23 +299,24 @@ var MDSelectionFormats = /** @class */ (function () {
|
|
|
297
299
|
return text;
|
|
298
300
|
};
|
|
299
301
|
MDSelectionFormats.prototype.isApplied = function (line, command) {
|
|
300
|
-
var regx = this.singleCharRegx(this.syntax[command]);
|
|
302
|
+
var regx = this.singleCharRegx(this.syntax["" + command]);
|
|
301
303
|
switch (command) {
|
|
302
304
|
case 'SubScript':
|
|
303
305
|
case 'SuperScript':
|
|
304
|
-
regx = this.singleCharRegx(this.syntax[command]);
|
|
306
|
+
regx = this.singleCharRegx(this.syntax["" + command]);
|
|
305
307
|
return regx.test(line.text);
|
|
306
308
|
case 'Bold':
|
|
307
309
|
case 'StrikeThrough':
|
|
308
|
-
regx = this.multiCharRegx(this.syntax[command].substr(0, 1));
|
|
310
|
+
regx = this.multiCharRegx(this.syntax["" + command].substr(0, 1));
|
|
309
311
|
return regx.test(line.text);
|
|
310
312
|
case 'UpperCase':
|
|
311
313
|
case 'LowerCase':
|
|
312
|
-
|
|
314
|
+
// eslint-disable-next-line
|
|
315
|
+
regx = new RegExp('^[' + this.syntax["" + command] + ']*$', 'g');
|
|
313
316
|
return regx.test(line.text);
|
|
314
317
|
case 'Italic': {
|
|
315
318
|
var regTest = void 0;
|
|
316
|
-
var regxB = this.multiCharRegx(this.syntax[command].substr(0, 1));
|
|
319
|
+
var regxB = this.multiCharRegx(this.syntax["" + command].substr(0, 1));
|
|
317
320
|
if (regxB.test(line.text)) {
|
|
318
321
|
var repText = line.text;
|
|
319
322
|
repText = repText.replace(regxB, '$%#');
|