devexpress-richedit 24.1.4-build-24186-1015 → 24.1.4
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/dist/dx.richedit.js +105 -76
- package/dist/dx.richedit.min.js +1 -1
- package/lib/client/client-rich-edit.js +2 -2
- package/lib/common/formats/html/import/html-importer.d.ts +9 -4
- package/lib/common/formats/html/import/html-importer.js +27 -15
- package/lib/common/formats/html/import/importers/a.d.ts +1 -1
- package/lib/common/formats/html/import/importers/a.js +1 -1
- package/lib/common/formats/html/import/importers/b.d.ts +1 -1
- package/lib/common/formats/html/import/importers/b.js +1 -1
- package/lib/common/formats/html/import/importers/base.d.ts +2 -1
- package/lib/common/formats/html/import/importers/base.js +1 -0
- package/lib/common/formats/html/import/importers/br.d.ts +1 -1
- package/lib/common/formats/html/import/importers/br.js +1 -1
- package/lib/common/formats/html/import/importers/center.d.ts +1 -1
- package/lib/common/formats/html/import/importers/center.js +1 -1
- package/lib/common/formats/html/import/importers/cite.d.ts +1 -1
- package/lib/common/formats/html/import/importers/cite.js +1 -1
- package/lib/common/formats/html/import/importers/div.d.ts +1 -1
- package/lib/common/formats/html/import/importers/div.js +3 -3
- package/lib/common/formats/html/import/importers/em.d.ts +1 -1
- package/lib/common/formats/html/import/importers/em.js +1 -1
- package/lib/common/formats/html/import/importers/font.d.ts +1 -1
- package/lib/common/formats/html/import/importers/font.js +1 -1
- package/lib/common/formats/html/import/importers/i.d.ts +1 -1
- package/lib/common/formats/html/import/importers/i.js +1 -1
- package/lib/common/formats/html/import/importers/img.d.ts +1 -1
- package/lib/common/formats/html/import/importers/img.js +1 -1
- package/lib/common/formats/html/import/importers/li.d.ts +2 -1
- package/lib/common/formats/html/import/importers/li.js +13 -10
- package/lib/common/formats/html/import/importers/list-base.d.ts +1 -1
- package/lib/common/formats/html/import/importers/list-base.js +2 -1
- package/lib/common/formats/html/import/importers/p.d.ts +3 -3
- package/lib/common/formats/html/import/importers/p.js +19 -16
- package/lib/common/formats/html/import/importers/pre.d.ts +1 -1
- package/lib/common/formats/html/import/importers/pre.js +1 -1
- package/lib/common/formats/html/import/importers/span.d.ts +1 -1
- package/lib/common/formats/html/import/importers/span.js +1 -1
- package/lib/common/formats/html/import/importers/table.d.ts +1 -1
- package/lib/common/formats/html/import/importers/table.js +2 -2
- package/lib/common/formats/html/import/importers/tbody.d.ts +1 -1
- package/lib/common/formats/html/import/importers/tbody.js +1 -1
- package/lib/common/formats/html/import/importers/td.d.ts +1 -1
- package/lib/common/formats/html/import/importers/td.js +2 -2
- package/lib/common/formats/html/import/importers/text-node.d.ts +1 -1
- package/lib/common/formats/html/import/importers/text-node.js +2 -2
- package/lib/common/formats/html/import/importers/tr.d.ts +1 -1
- package/lib/common/formats/html/import/importers/tr.js +1 -1
- package/lib/common/formats/html/import/importers/tt.d.ts +1 -1
- package/lib/common/formats/html/import/importers/tt.js +1 -1
- package/lib/common/formats/html/import/importers/undefined.d.ts +1 -1
- package/lib/common/formats/html/import/importers/undefined.js +2 -2
- package/lib/common/formats/html/import/utils/paragraph-list-properties-utils.js +13 -4
- package/lib/common/input-controller.d.ts +8 -8
- package/lib/common/input-controller.js +5 -5
- package/lib/common/rich-utils/html-utils.d.ts +1 -1
- package/package.json +3 -3
package/dist/dx.richedit.js
CHANGED
@@ -68016,6 +68016,7 @@ class HtmlModelInserter {
|
|
68016
68016
|
class HtmlTagImporterBase {
|
68017
68017
|
constructor(importer) {
|
68018
68018
|
this.enablePreserveLineBreaks = false;
|
68019
|
+
this.paragraphWasAddedBefore = false;
|
68019
68020
|
this.importer = importer;
|
68020
68021
|
}
|
68021
68022
|
get colorProvider() { return this.importer.modelManager.model.colorProvider; }
|
@@ -68063,7 +68064,7 @@ class HtmlATagImporter extends HtmlTagImporterBase {
|
|
68063
68064
|
this.addRun(new ImportedTextRunInfo(this.importer.modelManager.model, this.importer.measurer, codeText, this.importer.htmlImporterMaskedCharacterProperties.getBundleFrom(this.element, new fixed.FixedInterval(this.importer.currPosition, codeText.length))));
|
68064
68065
|
this.addRun(new ImportedFieldCodeEndRunInfo(this.importer.charPropsBundle, this.importer.fieldsId));
|
68065
68066
|
}
|
68066
|
-
|
68067
|
+
isImportChildren() {
|
68067
68068
|
return true;
|
68068
68069
|
}
|
68069
68070
|
importAfter() {
|
@@ -68085,7 +68086,7 @@ class HtmlBTagImporter extends HtmlTagImporterBase {
|
|
68085
68086
|
}
|
68086
68087
|
importBefore() {
|
68087
68088
|
}
|
68088
|
-
|
68089
|
+
isImportChildren() {
|
68089
68090
|
return true;
|
68090
68091
|
}
|
68091
68092
|
importAfter() {
|
@@ -68107,7 +68108,7 @@ class HtmlBrTagImporter extends HtmlTagImporterBase {
|
|
68107
68108
|
RichUtils.specialCharacters.LineBreak;
|
68108
68109
|
this.addRun(new ImportedTextRunInfo(this.importer.modelManager.model, this.importer.measurer, breakChar, this.importer.htmlImporterMaskedCharacterProperties.getBundleFrom(this.element, new fixed.FixedInterval(this.importer.currPosition, 1))));
|
68109
68110
|
}
|
68110
|
-
|
68111
|
+
isImportChildren() {
|
68111
68112
|
return false;
|
68112
68113
|
}
|
68113
68114
|
importAfter() {
|
@@ -68122,7 +68123,7 @@ class HtmlCenterTagImporter extends HtmlTagImporterBase {
|
|
68122
68123
|
}
|
68123
68124
|
importBefore() {
|
68124
68125
|
}
|
68125
|
-
|
68126
|
+
isImportChildren() {
|
68126
68127
|
return true;
|
68127
68128
|
}
|
68128
68129
|
importAfter() {
|
@@ -68137,7 +68138,7 @@ class HtmlCiteTagImporter extends HtmlTagImporterBase {
|
|
68137
68138
|
}
|
68138
68139
|
importBefore() {
|
68139
68140
|
}
|
68140
|
-
|
68141
|
+
isImportChildren() {
|
68141
68142
|
return true;
|
68142
68143
|
}
|
68143
68144
|
importAfter() {
|
@@ -68152,14 +68153,14 @@ class HtmlDivTagImporter extends HtmlTagImporterBase {
|
|
68152
68153
|
}
|
68153
68154
|
importBefore() {
|
68154
68155
|
if (!this.importer.prevRunIsParagraph && this.importer.importStarted)
|
68155
|
-
this.importer.addParagraphRun(
|
68156
|
+
this.importer.addParagraphRun(this.element);
|
68156
68157
|
}
|
68157
|
-
|
68158
|
+
isImportChildren() {
|
68158
68159
|
return true;
|
68159
68160
|
}
|
68160
68161
|
importAfter() {
|
68161
68162
|
if (!this.importer.prevRunIsParagraph)
|
68162
|
-
this.importer.addParagraphRun(
|
68163
|
+
this.importer.addParagraphRun(this.element);
|
68163
68164
|
}
|
68164
68165
|
}
|
68165
68166
|
|
@@ -68171,7 +68172,7 @@ class HtmlEmTagImporter extends HtmlTagImporterBase {
|
|
68171
68172
|
}
|
68172
68173
|
importBefore() {
|
68173
68174
|
}
|
68174
|
-
|
68175
|
+
isImportChildren() {
|
68175
68176
|
return true;
|
68176
68177
|
}
|
68177
68178
|
importAfter() {
|
@@ -68186,7 +68187,7 @@ class HtmlITagImporter extends HtmlTagImporterBase {
|
|
68186
68187
|
}
|
68187
68188
|
importBefore() {
|
68188
68189
|
}
|
68189
|
-
|
68190
|
+
isImportChildren() {
|
68190
68191
|
return true;
|
68191
68192
|
}
|
68192
68193
|
importAfter() {
|
@@ -68215,7 +68216,7 @@ class HtmlImgTagImporter extends HtmlTagImporterBase {
|
|
68215
68216
|
const cacheInfo = this.importer.modelManager.model.cache.imageCache.createUnloadedByBase64OrUrl(imageElement.src, originalSize);
|
68216
68217
|
this.addRun(new ImportedInlinePictureRunInfo(this.importer.charPropsBundle, InlinePictureInfo.defaultInfo(cacheInfo), actualSize));
|
68217
68218
|
}
|
68218
|
-
|
68219
|
+
isImportChildren() {
|
68219
68220
|
return false;
|
68220
68221
|
}
|
68221
68222
|
importAfter() {
|
@@ -68226,24 +68227,27 @@ class HtmlImgTagImporter extends HtmlTagImporterBase {
|
|
68226
68227
|
|
68227
68228
|
|
68228
68229
|
|
68229
|
-
|
68230
|
-
|
68231
68230
|
class HtmlLiTagImporter extends HtmlTagImporterBase {
|
68232
68231
|
elementTag() {
|
68233
68232
|
return 'LI';
|
68234
68233
|
}
|
68235
|
-
importBefore() {
|
68236
|
-
|
68234
|
+
importBefore() {
|
68235
|
+
const firstChild = this.element.childNodes[0];
|
68236
|
+
this.element.innerHTML = this.element.innerHTML.trim();
|
68237
|
+
if (this.isListElement(firstChild))
|
68238
|
+
this.importer.addParagraphRun(this.element, this.importer.currListInfo);
|
68239
|
+
}
|
68240
|
+
isImportChildren() {
|
68237
68241
|
return true;
|
68238
68242
|
}
|
68239
68243
|
importAfter() {
|
68240
68244
|
const lastChild = utils_list.ListUtils.last([...this.element.childNodes]);
|
68241
|
-
if (!
|
68242
|
-
|
68243
|
-
|
68244
|
-
|
68245
|
-
|
68246
|
-
|
68245
|
+
if (!this.importer.prevRunIsParagraph && !this.isListElement(lastChild))
|
68246
|
+
this.importer.addParagraphRun(this.element, this.importer.currListInfo);
|
68247
|
+
}
|
68248
|
+
isListElement(elem) {
|
68249
|
+
const tagName = LevelInfo.getElementTag(elem);
|
68250
|
+
return tagName === 'OL' || tagName === 'UL';
|
68247
68251
|
}
|
68248
68252
|
}
|
68249
68253
|
|
@@ -68389,13 +68393,14 @@ class ParagraphListPropertiesUtils {
|
|
68389
68393
|
return utils_list.ListUtils.accumulate(lists, 0, (acc, list, index) => acc + (list == mainParentListElement ? index : 0));
|
68390
68394
|
}
|
68391
68395
|
importListLevelIndex() {
|
68396
|
+
var _a;
|
68392
68397
|
if (this.msoListAttr && this.msoListAttr.length)
|
68393
68398
|
return parseInt(this.msoListAttr[0].replace(/mso-list:\s*\w*\s*level/gi, '')) - 1;
|
68394
68399
|
let listLevelIndex = 0;
|
68395
|
-
let parentListItemElement =
|
68400
|
+
let parentListItemElement = ParagraphListPropertiesUtils.getParentListElement((_a = this.parentListElement) === null || _a === void 0 ? void 0 : _a.parentElement);
|
68396
68401
|
while (parentListItemElement) {
|
68397
68402
|
listLevelIndex++;
|
68398
|
-
parentListItemElement =
|
68403
|
+
parentListItemElement = ParagraphListPropertiesUtils.getParentListElement(parentListItemElement === null || parentListItemElement === void 0 ? void 0 : parentListItemElement.parentElement);
|
68399
68404
|
}
|
68400
68405
|
return listLevelIndex;
|
68401
68406
|
}
|
@@ -68467,8 +68472,16 @@ class ParagraphListPropertiesUtils {
|
|
68467
68472
|
static getListText(listTextElement) {
|
68468
68473
|
return listTextElement ? utils_string.StringUtils.trim((listTextElement.nodeValue || dom.DomUtils.getInnerText(listTextElement)).split(" ")[0]) : "";
|
68469
68474
|
}
|
68470
|
-
static getParentListElement(
|
68471
|
-
|
68475
|
+
static getParentListElement(element) {
|
68476
|
+
const targetElementTags = ['UL', 'OL'];
|
68477
|
+
const exceptionElementTags = ['BODY', 'DIV', 'P'];
|
68478
|
+
while (element = element === null || element === void 0 ? void 0 : element.parentElement) {
|
68479
|
+
if (exceptionElementTags.includes(element.tagName))
|
68480
|
+
return null;
|
68481
|
+
if (targetElementTags.includes(element.tagName))
|
68482
|
+
return element;
|
68483
|
+
}
|
68484
|
+
return null;
|
68472
68485
|
}
|
68473
68486
|
static removeSomeHtml(element, listTextElement, listText) {
|
68474
68487
|
if (element.childNodes.length == 1)
|
@@ -68508,6 +68521,7 @@ class HtmlListTagImporterBase extends HtmlTagImporterBase {
|
|
68508
68521
|
this._ignored = false;
|
68509
68522
|
}
|
68510
68523
|
importBefore() {
|
68524
|
+
this.importer.addCurrLevelParagraphRunIfNeeded();
|
68511
68525
|
const listIndex = this.importer.listIndex;
|
68512
68526
|
const parentList = utils_list.ListUtils.last(this.importer.listInfos);
|
68513
68527
|
const listLevel = parentList
|
@@ -68521,7 +68535,7 @@ class HtmlListTagImporterBase extends HtmlTagImporterBase {
|
|
68521
68535
|
const displayFormat = ParagraphListPropertiesUtils.importDisplayFormatStringByParentListFormat(listFormat, parentList === null || parentList === void 0 ? void 0 : parentList.listFormat, listLevel);
|
68522
68536
|
this.importer.listInfos.push(new ImportedParagraphListInfo(listIndex, listLevel, listFormat, listFormat == NumberingFormat.Bullet ? numbering_list_NumberingType.Bullet : numbering_list_NumberingType.MultiLevel, displayFormat, null));
|
68523
68537
|
}
|
68524
|
-
|
68538
|
+
isImportChildren() {
|
68525
68539
|
return true;
|
68526
68540
|
}
|
68527
68541
|
importAfter() {
|
@@ -68545,36 +68559,39 @@ class HtmlOlTagImporter extends HtmlListTagImporterBase {
|
|
68545
68559
|
|
68546
68560
|
|
68547
68561
|
|
68548
|
-
|
68549
68562
|
class HtmlPTagImporter extends HtmlTagImporterBase {
|
68550
68563
|
constructor() {
|
68551
68564
|
super(...arguments);
|
68552
68565
|
this.listInfo = null;
|
68553
|
-
this.
|
68554
|
-
this.generateParagraph = true;
|
68566
|
+
this.importChildren = false;
|
68555
68567
|
}
|
68556
68568
|
elementTag() {
|
68557
68569
|
return "P";
|
68558
68570
|
}
|
68559
68571
|
importBefore() {
|
68572
|
+
this.importer.addCurrLevelParagraphRunIfNeeded();
|
68573
|
+
this.element.innerHTML = this.element.innerHTML.trim();
|
68560
68574
|
let emptyParagraphMatches = this.element.outerHTML.match(/^<([^\s >]+)(\s[^>]*)?> <\/\1>/gi);
|
68561
|
-
if (!(emptyParagraphMatches
|
68562
|
-
|
68563
|
-
|
68564
|
-
if (htmlListInfo && !this.element.nextSibling)
|
68565
|
-
this.generateParagraph = false;
|
68566
|
-
else
|
68567
|
-
this.listInfo = htmlListInfo !== null && htmlListInfo !== void 0 ? htmlListInfo : this.importer.paragraphListpropertiesUtils.import(this.element, new fixed.FixedInterval(this.importer.currPosition, 0));
|
68568
|
-
}
|
68569
|
-
this.importChilds = true;
|
68575
|
+
if (!(emptyParagraphMatches === null || emptyParagraphMatches === void 0 ? void 0 : emptyParagraphMatches.length)) {
|
68576
|
+
this.listInfo = this.getListInfo();
|
68577
|
+
this.importChildren = true;
|
68570
68578
|
}
|
68571
68579
|
}
|
68572
|
-
|
68573
|
-
return this.
|
68580
|
+
isImportChildren() {
|
68581
|
+
return this.importChildren;
|
68574
68582
|
}
|
68575
68583
|
importAfter() {
|
68576
|
-
|
68577
|
-
|
68584
|
+
this.importer.addParagraphRun(this.element, this.listInfo);
|
68585
|
+
}
|
68586
|
+
getListInfo() {
|
68587
|
+
var _a, _b;
|
68588
|
+
if (!utils_string.StringUtils.trim(dom.DomUtils.getInnerText(this.element)) || ((_b = (_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.closest('ul,ol,li')) === null || _b === void 0 ? void 0 : _b.tagName) !== 'LI')
|
68589
|
+
return null;
|
68590
|
+
if (!this.importer.currListItemLevelInfo)
|
68591
|
+
return this.importer.paragraphListPropertiesUtils.import(this.element, new fixed.FixedInterval(this.importer.currPosition, 0));
|
68592
|
+
if (!this.importer.currListItemLevelInfo.tagImporter.paragraphWasAddedBefore)
|
68593
|
+
return this.importer.currListInfo;
|
68594
|
+
return null;
|
68578
68595
|
}
|
68579
68596
|
}
|
68580
68597
|
class HtmlH1TagImporter extends HtmlPTagImporter {
|
@@ -68616,7 +68633,7 @@ class HtmlPreTagImporter extends HtmlTagImporterBase {
|
|
68616
68633
|
}
|
68617
68634
|
importBefore() {
|
68618
68635
|
}
|
68619
|
-
|
68636
|
+
isImportChildren() {
|
68620
68637
|
return true;
|
68621
68638
|
}
|
68622
68639
|
importAfter() {
|
@@ -68649,7 +68666,7 @@ class HtmlSpanTagImporter extends HtmlTagImporterBase {
|
|
68649
68666
|
this.importChilds = false;
|
68650
68667
|
}
|
68651
68668
|
}
|
68652
|
-
|
68669
|
+
isImportChildren() {
|
68653
68670
|
return this.importChilds;
|
68654
68671
|
}
|
68655
68672
|
importAfter() {
|
@@ -68755,11 +68772,11 @@ class HtmlTableTagImporter extends HtmlTagImporterBase {
|
|
68755
68772
|
const lastTableInfo = utils_list.ListUtils.last(this.importer.importedTablesInfo);
|
68756
68773
|
if (lastTableInfo && utils_list.ListUtils.last(utils_list.ListUtils.last(lastTableInfo.rows).cells).endPosition == this.importer.currPosition ||
|
68757
68774
|
!this.importer.prevRunIsParagraph)
|
68758
|
-
this.importer.addParagraphRun(
|
68775
|
+
this.importer.addParagraphRun(this.element);
|
68759
68776
|
utils_list.ListUtils.last(this.importer.levelInfo).allowInsertRuns = false;
|
68760
68777
|
this.element.innerHTML = this.element.innerHTML.replace(/<td([^>]*mso-cell-special:\s*placeholder[^>]*)>[\s\S]*?<\/td>/gi, "<td$1></td>");
|
68761
68778
|
}
|
68762
|
-
|
68779
|
+
isImportChildren() {
|
68763
68780
|
return true;
|
68764
68781
|
}
|
68765
68782
|
importAfter() {
|
@@ -68818,7 +68835,7 @@ class HtmlTbodyTagImporter extends HtmlTagImporterBase {
|
|
68818
68835
|
}
|
68819
68836
|
importBefore() {
|
68820
68837
|
}
|
68821
|
-
|
68838
|
+
isImportChildren() {
|
68822
68839
|
return true;
|
68823
68840
|
}
|
68824
68841
|
importAfter() {
|
@@ -68845,7 +68862,7 @@ class HtmlTrTagImporter extends HtmlTagImporterBase {
|
|
68845
68862
|
this.rowElement = this.element;
|
68846
68863
|
this.gridBeforeInfo = HtmlTrTagImporter.importGridBefore(this.rowElement);
|
68847
68864
|
}
|
68848
|
-
|
68865
|
+
isImportChildren() {
|
68849
68866
|
return true;
|
68850
68867
|
}
|
68851
68868
|
importAfter() {
|
@@ -68913,7 +68930,7 @@ class HtmlTdTagImporter extends HtmlTagImporterBase {
|
|
68913
68930
|
HtmlTdTagImporter.addVerticalMergedCells(this.importer, this.getClosestImporterByTagName(HtmlTableTagImporter.tagName), this.rowImporter);
|
68914
68931
|
this.startPosition = this.importer.currPosition;
|
68915
68932
|
}
|
68916
|
-
|
68933
|
+
isImportChildren() {
|
68917
68934
|
return true;
|
68918
68935
|
}
|
68919
68936
|
importAfter() {
|
@@ -68931,7 +68948,7 @@ class HtmlTdTagImporter extends HtmlTagImporterBase {
|
|
68931
68948
|
const lastImportedRun = this.importer.getLastImportedRun();
|
68932
68949
|
if (!lastImportedRun || !this.importer.prevRunIsParagraph ||
|
68933
68950
|
this.importer.currPosition - lastImportedRun.runLength < this.startPosition) {
|
68934
|
-
this.importer.addParagraphRun(
|
68951
|
+
this.importer.addParagraphRun(this.element, null, true);
|
68935
68952
|
}
|
68936
68953
|
this.rowImporter.cells.push(new ImportedTableCellInfo(preferredWidth, this.startPosition, this.importer.currPosition, columnSpan, rowSpan, props, true));
|
68937
68954
|
}
|
@@ -69030,7 +69047,7 @@ class HtmlTextNodeImporter extends HtmlTagImporterBase {
|
|
69030
69047
|
this.addRun(new ImportedTextRunInfo(this.importer.modelManager.model, this.importer.measurer, lines[i], this.importer.htmlImporterMaskedCharacterProperties.getBundleFrom(this.element, new fixed.FixedInterval(this.importer.currPosition, lines[i].length))));
|
69031
69048
|
}
|
69032
69049
|
if (i < lines.length - 1)
|
69033
|
-
this.importer.addParagraphRun(
|
69050
|
+
this.importer.addParagraphRun(this.element.parentElement || this.element.parentNode);
|
69034
69051
|
}
|
69035
69052
|
}
|
69036
69053
|
else {
|
@@ -69038,7 +69055,7 @@ class HtmlTextNodeImporter extends HtmlTagImporterBase {
|
|
69038
69055
|
}
|
69039
69056
|
}
|
69040
69057
|
}
|
69041
|
-
|
69058
|
+
isImportChildren() {
|
69042
69059
|
return false;
|
69043
69060
|
}
|
69044
69061
|
importAfter() {
|
@@ -69053,7 +69070,7 @@ class HtmlTtTagImporter extends HtmlTagImporterBase {
|
|
69053
69070
|
}
|
69054
69071
|
importBefore() {
|
69055
69072
|
}
|
69056
|
-
|
69073
|
+
isImportChildren() {
|
69057
69074
|
return true;
|
69058
69075
|
}
|
69059
69076
|
importAfter() {
|
@@ -69079,8 +69096,8 @@ class HtmlUndefinedTagImporter extends HtmlTagImporterBase {
|
|
69079
69096
|
importBefore() {
|
69080
69097
|
Log.print(LogSource.HtmlImporter, "HtmlUndefinedTagImporter.importBefore undefined tag", this.element);
|
69081
69098
|
}
|
69082
|
-
|
69083
|
-
return !!this.importer.
|
69099
|
+
isImportChildren() {
|
69100
|
+
return !!this.importer.currElementChildren.length;
|
69084
69101
|
}
|
69085
69102
|
importAfter() {
|
69086
69103
|
}
|
@@ -69625,8 +69642,8 @@ class LevelInfo {
|
|
69625
69642
|
return this;
|
69626
69643
|
}
|
69627
69644
|
static getElementTag(elem) {
|
69628
|
-
const tag = elem.tagName;
|
69629
|
-
return tag ? tag.toUpperCase() :
|
69645
|
+
const tag = dom.DomUtils.isHTMLElementNode(elem) && elem.tagName;
|
69646
|
+
return tag ? tag.toUpperCase() : '';
|
69630
69647
|
}
|
69631
69648
|
}
|
69632
69649
|
class HtmlImportData {
|
@@ -69682,15 +69699,22 @@ class HtmlImporter {
|
|
69682
69699
|
this.tempFontInfoCache = new FontInfoCache(this.modelManager.model.cache.fontInfoCache.fontMeasurer);
|
69683
69700
|
this.htmlImporterMaskedCharacterProperties =
|
69684
69701
|
new HtmlImporterMaskedCharacterProperties(this, this.loadFontInfos, this.tempFontInfoCache, !modelManager.richOptions.fonts.limitedFonts);
|
69685
|
-
this.
|
69702
|
+
this.paragraphListPropertiesUtils = new ParagraphListPropertiesUtils(this, this.htmlImporterMaskedCharacterProperties);
|
69686
69703
|
this.tagImporters = {};
|
69687
69704
|
for (let importerConst of HtmlImporter.importers)
|
69688
69705
|
this.tagImporters[new importerConst(this).elementTag()] = importerConst;
|
69689
69706
|
}
|
69690
69707
|
get currElement() { return utils_list.ListUtils.last(this.levelInfo).element; }
|
69691
69708
|
;
|
69692
|
-
get
|
69709
|
+
get currElementChildren() { return utils_list.ListUtils.last(this.levelInfo).childElements; }
|
69693
69710
|
;
|
69711
|
+
get prevLevelInfo() { return this.levelInfo[this.levelInfo.length - 2]; }
|
69712
|
+
get currLevelInfo() { return utils_list.ListUtils.last(this.levelInfo); }
|
69713
|
+
get currListItemLevelInfo() { return utils_list.ListUtils.reverseElementBy(this.levelInfo, (levelInfo) => { var _a; return ((_a = levelInfo.tagImporter) === null || _a === void 0 ? void 0 : _a.elementTag()) === 'LI'; }); }
|
69714
|
+
get currListInfo() {
|
69715
|
+
const currListItemLevelInfo = this.currListItemLevelInfo;
|
69716
|
+
return currListItemLevelInfo && !currListItemLevelInfo.tagImporter.paragraphWasAddedBefore ? utils_list.ListUtils.last(this.listInfos) : null;
|
69717
|
+
}
|
69694
69718
|
get subDocument() { return this.subDocPosition.subDocument; }
|
69695
69719
|
import() {
|
69696
69720
|
this.importStarted = false;
|
@@ -69717,7 +69741,7 @@ class HtmlImporter {
|
|
69717
69741
|
return insertedInterval;
|
69718
69742
|
}
|
69719
69743
|
convertChildElements(preserveLineBreaks = false) {
|
69720
|
-
for (let element of this.
|
69744
|
+
for (let element of this.currElementChildren)
|
69721
69745
|
this.convertElement(element, preserveLineBreaks);
|
69722
69746
|
}
|
69723
69747
|
getSortedTables() {
|
@@ -69739,18 +69763,18 @@ class HtmlImporter {
|
|
69739
69763
|
importer.enablePreserveLineBreaks = preserveLineBreaks;
|
69740
69764
|
if (importer.isAllowed())
|
69741
69765
|
importer.importBefore();
|
69742
|
-
if (importer.
|
69766
|
+
if (importer.isImportChildren())
|
69743
69767
|
this.convertChildElements(preserveLineBreaks || importer.shouldPreserveLineBreaksOnChilds());
|
69744
69768
|
if (importer.isAllowed())
|
69745
69769
|
importer.importAfter();
|
69746
69770
|
this.levelInfo.pop();
|
69747
69771
|
}
|
69748
69772
|
putDownParentPropertiesToChild() {
|
69749
|
-
if (!this.
|
69773
|
+
if (!this.currElementChildren)
|
69750
69774
|
return;
|
69751
69775
|
const element = this.currElement;
|
69752
69776
|
const missTag = HtmlImporter.MapMissTablePropertiesByTagNames[utils_list.ListUtils.last(this.levelInfo).tagImporter.elementTag()];
|
69753
|
-
utils_list.ListUtils.forEach(this.
|
69777
|
+
utils_list.ListUtils.forEach(this.currElementChildren, (childElement) => {
|
69754
69778
|
const childElemStyle = this.getStyles(childElement);
|
69755
69779
|
if (!Object.keys(childElemStyle).length)
|
69756
69780
|
return;
|
@@ -69786,19 +69810,26 @@ class HtmlImporter {
|
|
69786
69810
|
}
|
69787
69811
|
addRun(run, forceAdd = false) {
|
69788
69812
|
if (forceAdd || utils_list.ListUtils.last(this.levelInfo).allowInsertRuns) {
|
69813
|
+
const isParagraph = run.runType == RunType.ParagraphRun || run.runType == RunType.SectionRun;
|
69789
69814
|
this.importedRunsInfo.push(run);
|
69790
69815
|
this.currPosition += run.runLength;
|
69791
|
-
this.prevRunIsParagraph =
|
69816
|
+
this.prevRunIsParagraph = isParagraph;
|
69792
69817
|
this.importStarted = true;
|
69818
|
+
if (isParagraph && this.currListItemLevelInfo)
|
69819
|
+
this.currListItemLevelInfo.tagImporter.paragraphWasAddedBefore = true;
|
69793
69820
|
}
|
69794
69821
|
}
|
69795
|
-
addParagraphRun(
|
69822
|
+
addParagraphRun(element, listInfo = null, isTableCellTag = false) {
|
69796
69823
|
const htmlProperties = new HtmlImporterMaskedParagraphProperties();
|
69797
69824
|
const properties = htmlProperties.import(this.modelManager.model.colorProvider, element, isTableCellTag);
|
69798
69825
|
const tabs = HtmlImporterTabStops.import(element);
|
69799
69826
|
this.removeAllTrailingLineBreaks();
|
69800
69827
|
this.addRun(new ImportedParagraphRunInfo(listInfo, this.charPropsBundle, properties, tabs));
|
69801
69828
|
}
|
69829
|
+
addCurrLevelParagraphRunIfNeeded() {
|
69830
|
+
if (this.currLevelInfo.element.previousSibling && !this.prevRunIsParagraph)
|
69831
|
+
this.addParagraphRun(this.currLevelInfo.element, this.currListInfo);
|
69832
|
+
}
|
69802
69833
|
removeAllTrailingLineBreaks() {
|
69803
69834
|
const last = this.importedRunsInfo.length - 1;
|
69804
69835
|
for (let i = last; i >= last - 1; i--) {
|
@@ -69873,10 +69904,6 @@ class HtmlImporter {
|
|
69873
69904
|
html = html.replace(/<font[^>]*>([^<>]+)<\/font>/gi, '$1');
|
69874
69905
|
html = html.replace(/<span\s*><span\s*>([^<>]+)<\/span><\/span>/ig, '$1');
|
69875
69906
|
html = html.replace(/<span>([^<>]+)<\/span>/gi, '$1');
|
69876
|
-
html = html.replace(/\s*(<li[\S\s]*?>)\s*/gi, '$1');
|
69877
|
-
html = html.replace(/\s*(<\/li>)\s*/gi, '$1');
|
69878
|
-
html = html.replace(/<li([^>]*)>([^<>]+)<\/li>/gi, '<li$1><p>$2</p></li>');
|
69879
|
-
html = html.replace(/<li([^>]*)>(([^<>]*)<(?!p)[\s\S]*?)<\/li>/gi, '<li$1><p>$2</p></li>');
|
69880
69907
|
html = html.replace(/<caption([^>]*)>[\s\S]*?<\/caption>/gi, '');
|
69881
69908
|
var array = html.match(/<[^>]*style\s*=\s*[^>]*>/gi);
|
69882
69909
|
if (array && array.length > 0) {
|
@@ -69908,6 +69935,8 @@ class HtmlImporter {
|
|
69908
69935
|
html = html.replace(/<u>([\s\S]*?)<\/u>/gi, '<span style="text-decoration: underline">$1</span>');
|
69909
69936
|
html = html.replace(/<s>([\s\S]*?)<\/s>/gi, '<span style="text-decoration: line-through">$1</span>');
|
69910
69937
|
html = html.replace(/<\/([^\s>]+)(\s[^>]*)?><br><\/([^\s>]+)(\s[^>]*)?>/gi, '');
|
69938
|
+
html = html.replace(/\s*(<([ph]\d?|ol|ul|li))/gi, '$1');
|
69939
|
+
html = html.replace(/(<\/([ph]\d?|ol|ul|li)>)\s*/gi, '$1');
|
69911
69940
|
html = this.extractBodyContent(html);
|
69912
69941
|
Log.print(LogSource.HtmlImporter, "convertHtml", () => html);
|
69913
69942
|
return html;
|
@@ -69931,7 +69960,7 @@ HtmlImporter.MapMissTablePropertiesByTagNames = new MapCreator()
|
|
69931
69960
|
.add("TH", true)
|
69932
69961
|
.get();
|
69933
69962
|
HtmlImporter.MapShorthandProperty = new MapCreator()
|
69934
|
-
.add("background",
|
69963
|
+
.add("background", false)
|
69935
69964
|
.add("border", true)
|
69936
69965
|
.add("borderImage", true)
|
69937
69966
|
.add("borderTop", true)
|
@@ -112843,7 +112872,7 @@ class DivInputEditor extends InputEditorBase {
|
|
112843
112872
|
return super.getEditableDocumentText().replace(/\s/g, " ");
|
112844
112873
|
}
|
112845
112874
|
getEditableDocumentContent() {
|
112846
|
-
const htmlItems = this.inputElement.cloneNode(true).
|
112875
|
+
const htmlItems = this.inputElement.cloneNode(true).childNodes;
|
112847
112876
|
if (htmlItems.length)
|
112848
112877
|
return htmlItems;
|
112849
112878
|
return this.inputElement.innerText;
|
@@ -112985,9 +113014,9 @@ class IFrameInputEditor extends InputEditorBase {
|
|
112985
113014
|
}
|
112986
113015
|
}
|
112987
113016
|
getEditableDocumentContent() {
|
112988
|
-
const
|
112989
|
-
if (
|
112990
|
-
return
|
113017
|
+
const items = this.editableDocument.body.cloneNode(true).childNodes;
|
113018
|
+
if (items.length)
|
113019
|
+
return items;
|
112991
113020
|
return this.editableDocument.body.innerText;
|
112992
113021
|
}
|
112993
113022
|
selectEditableDocumentContent() {
|
@@ -113182,7 +113211,7 @@ class InputController {
|
|
113182
113211
|
else {
|
113183
113212
|
const _fragment = document.createDocumentFragment();
|
113184
113213
|
_fragment.appendChild(result);
|
113185
|
-
this.setEditableDocumentContent(_fragment.
|
113214
|
+
this.setEditableDocumentContent(_fragment.childNodes);
|
113186
113215
|
}
|
113187
113216
|
this.selectEditableDocumentContent();
|
113188
113217
|
}
|
@@ -143663,7 +143692,7 @@ class ClientRichEdit {
|
|
143663
143692
|
this.contextMenuSettings = settings.contextMenuSettings;
|
143664
143693
|
this.fullScreenHelper = new FullScreenHelper(element);
|
143665
143694
|
if (true)
|
143666
|
-
external_DevExpress_config_default()(JSON.parse(atob('
|
143695
|
+
external_DevExpress_config_default()(JSON.parse(atob('eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFYWkdXQzFTVkdFeU1IbFVPRGh0YzAxNmRsQTJaeUlLZlE9PS5GYjZ4U0JwU3BSVHBWajZ0dWtlQTJZaU1WVW5tb0ZoSDJKV3Ryak5iN3p6VlNrNzhKa294RVFKOW9rVlErYnh0SzM1WWlFZkpEWGJnNktrYVA1ZEljcnp0ZHlsOFlGL2ltc3BIWkY5aWlaeGtVK0FXbFVrV1RUb2c0ZnZDbWlxMTl2MWhIdz09In0=')));
|
143667
143696
|
this.prepareElement(element, settings);
|
143668
143697
|
this.initDefaultFontsAndStyles();
|
143669
143698
|
this.initBars(settings.ribbon, settings.fonts);
|