devexpress-richedit 24.1.4-build-24183-0102 → 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 +139 -80
- package/dist/dx.richedit.min.js +1 -1
- package/lib/client/client-rich-edit.js +2 -2
- package/lib/common/formats/html/import/html-document-importer.js +1 -1
- package/lib/common/formats/html/import/html-importer.d.ts +14 -5
- package/lib/common/formats/html/import/html-importer.js +59 -18
- 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 +3 -2
- 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/model/fonts/loader.js +1 -1
- 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() {
|
@@ -68206,7 +68207,8 @@ class HtmlImgTagImporter extends HtmlTagImporterBase {
|
|
68206
68207
|
importBefore() {
|
68207
68208
|
const imageElement = this.importer.currElement;
|
68208
68209
|
const originalSize = new geometry_size.Size(imageElement.naturalWidth, imageElement.naturalHeight);
|
68209
|
-
const
|
68210
|
+
const styleSize = new geometry_size.Size(parseFloat(imageElement.style.width), parseFloat(imageElement.style.height));
|
68211
|
+
const actualSize = new geometry_size.Size(imageElement.width || styleSize.width, imageElement.height || styleSize.height);
|
68210
68212
|
if (originalSize.width !== undefined && originalSize.height !== undefined)
|
68211
68213
|
originalSize.applyConverter(unit_converter/* UnitConverter */.u.pixelsToTwips);
|
68212
68214
|
if (actualSize.width !== undefined && actualSize.height !== undefined)
|
@@ -68214,7 +68216,7 @@ class HtmlImgTagImporter extends HtmlTagImporterBase {
|
|
68214
68216
|
const cacheInfo = this.importer.modelManager.model.cache.imageCache.createUnloadedByBase64OrUrl(imageElement.src, originalSize);
|
68215
68217
|
this.addRun(new ImportedInlinePictureRunInfo(this.importer.charPropsBundle, InlinePictureInfo.defaultInfo(cacheInfo), actualSize));
|
68216
68218
|
}
|
68217
|
-
|
68219
|
+
isImportChildren() {
|
68218
68220
|
return false;
|
68219
68221
|
}
|
68220
68222
|
importAfter() {
|
@@ -68225,24 +68227,27 @@ class HtmlImgTagImporter extends HtmlTagImporterBase {
|
|
68225
68227
|
|
68226
68228
|
|
68227
68229
|
|
68228
|
-
|
68229
|
-
|
68230
68230
|
class HtmlLiTagImporter extends HtmlTagImporterBase {
|
68231
68231
|
elementTag() {
|
68232
68232
|
return 'LI';
|
68233
68233
|
}
|
68234
|
-
importBefore() {
|
68235
|
-
|
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() {
|
68236
68241
|
return true;
|
68237
68242
|
}
|
68238
68243
|
importAfter() {
|
68239
68244
|
const lastChild = utils_list.ListUtils.last([...this.element.childNodes]);
|
68240
|
-
if (!
|
68241
|
-
|
68242
|
-
|
68243
|
-
|
68244
|
-
|
68245
|
-
|
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';
|
68246
68251
|
}
|
68247
68252
|
}
|
68248
68253
|
|
@@ -68388,13 +68393,14 @@ class ParagraphListPropertiesUtils {
|
|
68388
68393
|
return utils_list.ListUtils.accumulate(lists, 0, (acc, list, index) => acc + (list == mainParentListElement ? index : 0));
|
68389
68394
|
}
|
68390
68395
|
importListLevelIndex() {
|
68396
|
+
var _a;
|
68391
68397
|
if (this.msoListAttr && this.msoListAttr.length)
|
68392
68398
|
return parseInt(this.msoListAttr[0].replace(/mso-list:\s*\w*\s*level/gi, '')) - 1;
|
68393
68399
|
let listLevelIndex = 0;
|
68394
|
-
let parentListItemElement =
|
68400
|
+
let parentListItemElement = ParagraphListPropertiesUtils.getParentListElement((_a = this.parentListElement) === null || _a === void 0 ? void 0 : _a.parentElement);
|
68395
68401
|
while (parentListItemElement) {
|
68396
68402
|
listLevelIndex++;
|
68397
|
-
parentListItemElement =
|
68403
|
+
parentListItemElement = ParagraphListPropertiesUtils.getParentListElement(parentListItemElement === null || parentListItemElement === void 0 ? void 0 : parentListItemElement.parentElement);
|
68398
68404
|
}
|
68399
68405
|
return listLevelIndex;
|
68400
68406
|
}
|
@@ -68466,8 +68472,16 @@ class ParagraphListPropertiesUtils {
|
|
68466
68472
|
static getListText(listTextElement) {
|
68467
68473
|
return listTextElement ? utils_string.StringUtils.trim((listTextElement.nodeValue || dom.DomUtils.getInnerText(listTextElement)).split(" ")[0]) : "";
|
68468
68474
|
}
|
68469
|
-
static getParentListElement(
|
68470
|
-
|
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;
|
68471
68485
|
}
|
68472
68486
|
static removeSomeHtml(element, listTextElement, listText) {
|
68473
68487
|
if (element.childNodes.length == 1)
|
@@ -68507,6 +68521,7 @@ class HtmlListTagImporterBase extends HtmlTagImporterBase {
|
|
68507
68521
|
this._ignored = false;
|
68508
68522
|
}
|
68509
68523
|
importBefore() {
|
68524
|
+
this.importer.addCurrLevelParagraphRunIfNeeded();
|
68510
68525
|
const listIndex = this.importer.listIndex;
|
68511
68526
|
const parentList = utils_list.ListUtils.last(this.importer.listInfos);
|
68512
68527
|
const listLevel = parentList
|
@@ -68520,7 +68535,7 @@ class HtmlListTagImporterBase extends HtmlTagImporterBase {
|
|
68520
68535
|
const displayFormat = ParagraphListPropertiesUtils.importDisplayFormatStringByParentListFormat(listFormat, parentList === null || parentList === void 0 ? void 0 : parentList.listFormat, listLevel);
|
68521
68536
|
this.importer.listInfos.push(new ImportedParagraphListInfo(listIndex, listLevel, listFormat, listFormat == NumberingFormat.Bullet ? numbering_list_NumberingType.Bullet : numbering_list_NumberingType.MultiLevel, displayFormat, null));
|
68522
68537
|
}
|
68523
|
-
|
68538
|
+
isImportChildren() {
|
68524
68539
|
return true;
|
68525
68540
|
}
|
68526
68541
|
importAfter() {
|
@@ -68544,36 +68559,39 @@ class HtmlOlTagImporter extends HtmlListTagImporterBase {
|
|
68544
68559
|
|
68545
68560
|
|
68546
68561
|
|
68547
|
-
|
68548
68562
|
class HtmlPTagImporter extends HtmlTagImporterBase {
|
68549
68563
|
constructor() {
|
68550
68564
|
super(...arguments);
|
68551
68565
|
this.listInfo = null;
|
68552
|
-
this.
|
68553
|
-
this.generateParagraph = true;
|
68566
|
+
this.importChildren = false;
|
68554
68567
|
}
|
68555
68568
|
elementTag() {
|
68556
68569
|
return "P";
|
68557
68570
|
}
|
68558
68571
|
importBefore() {
|
68572
|
+
this.importer.addCurrLevelParagraphRunIfNeeded();
|
68573
|
+
this.element.innerHTML = this.element.innerHTML.trim();
|
68559
68574
|
let emptyParagraphMatches = this.element.outerHTML.match(/^<([^\s >]+)(\s[^>]*)?> <\/\1>/gi);
|
68560
|
-
if (!(emptyParagraphMatches
|
68561
|
-
|
68562
|
-
|
68563
|
-
if (htmlListInfo && !this.element.nextSibling)
|
68564
|
-
this.generateParagraph = false;
|
68565
|
-
else
|
68566
|
-
this.listInfo = htmlListInfo !== null && htmlListInfo !== void 0 ? htmlListInfo : this.importer.paragraphListpropertiesUtils.import(this.element, new fixed.FixedInterval(this.importer.currPosition, 0));
|
68567
|
-
}
|
68568
|
-
this.importChilds = true;
|
68575
|
+
if (!(emptyParagraphMatches === null || emptyParagraphMatches === void 0 ? void 0 : emptyParagraphMatches.length)) {
|
68576
|
+
this.listInfo = this.getListInfo();
|
68577
|
+
this.importChildren = true;
|
68569
68578
|
}
|
68570
68579
|
}
|
68571
|
-
|
68572
|
-
return this.
|
68580
|
+
isImportChildren() {
|
68581
|
+
return this.importChildren;
|
68573
68582
|
}
|
68574
68583
|
importAfter() {
|
68575
|
-
|
68576
|
-
|
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;
|
68577
68595
|
}
|
68578
68596
|
}
|
68579
68597
|
class HtmlH1TagImporter extends HtmlPTagImporter {
|
@@ -68615,7 +68633,7 @@ class HtmlPreTagImporter extends HtmlTagImporterBase {
|
|
68615
68633
|
}
|
68616
68634
|
importBefore() {
|
68617
68635
|
}
|
68618
|
-
|
68636
|
+
isImportChildren() {
|
68619
68637
|
return true;
|
68620
68638
|
}
|
68621
68639
|
importAfter() {
|
@@ -68648,7 +68666,7 @@ class HtmlSpanTagImporter extends HtmlTagImporterBase {
|
|
68648
68666
|
this.importChilds = false;
|
68649
68667
|
}
|
68650
68668
|
}
|
68651
|
-
|
68669
|
+
isImportChildren() {
|
68652
68670
|
return this.importChilds;
|
68653
68671
|
}
|
68654
68672
|
importAfter() {
|
@@ -68754,11 +68772,11 @@ class HtmlTableTagImporter extends HtmlTagImporterBase {
|
|
68754
68772
|
const lastTableInfo = utils_list.ListUtils.last(this.importer.importedTablesInfo);
|
68755
68773
|
if (lastTableInfo && utils_list.ListUtils.last(utils_list.ListUtils.last(lastTableInfo.rows).cells).endPosition == this.importer.currPosition ||
|
68756
68774
|
!this.importer.prevRunIsParagraph)
|
68757
|
-
this.importer.addParagraphRun(
|
68775
|
+
this.importer.addParagraphRun(this.element);
|
68758
68776
|
utils_list.ListUtils.last(this.importer.levelInfo).allowInsertRuns = false;
|
68759
68777
|
this.element.innerHTML = this.element.innerHTML.replace(/<td([^>]*mso-cell-special:\s*placeholder[^>]*)>[\s\S]*?<\/td>/gi, "<td$1></td>");
|
68760
68778
|
}
|
68761
|
-
|
68779
|
+
isImportChildren() {
|
68762
68780
|
return true;
|
68763
68781
|
}
|
68764
68782
|
importAfter() {
|
@@ -68817,7 +68835,7 @@ class HtmlTbodyTagImporter extends HtmlTagImporterBase {
|
|
68817
68835
|
}
|
68818
68836
|
importBefore() {
|
68819
68837
|
}
|
68820
|
-
|
68838
|
+
isImportChildren() {
|
68821
68839
|
return true;
|
68822
68840
|
}
|
68823
68841
|
importAfter() {
|
@@ -68844,7 +68862,7 @@ class HtmlTrTagImporter extends HtmlTagImporterBase {
|
|
68844
68862
|
this.rowElement = this.element;
|
68845
68863
|
this.gridBeforeInfo = HtmlTrTagImporter.importGridBefore(this.rowElement);
|
68846
68864
|
}
|
68847
|
-
|
68865
|
+
isImportChildren() {
|
68848
68866
|
return true;
|
68849
68867
|
}
|
68850
68868
|
importAfter() {
|
@@ -68912,7 +68930,7 @@ class HtmlTdTagImporter extends HtmlTagImporterBase {
|
|
68912
68930
|
HtmlTdTagImporter.addVerticalMergedCells(this.importer, this.getClosestImporterByTagName(HtmlTableTagImporter.tagName), this.rowImporter);
|
68913
68931
|
this.startPosition = this.importer.currPosition;
|
68914
68932
|
}
|
68915
|
-
|
68933
|
+
isImportChildren() {
|
68916
68934
|
return true;
|
68917
68935
|
}
|
68918
68936
|
importAfter() {
|
@@ -68930,7 +68948,7 @@ class HtmlTdTagImporter extends HtmlTagImporterBase {
|
|
68930
68948
|
const lastImportedRun = this.importer.getLastImportedRun();
|
68931
68949
|
if (!lastImportedRun || !this.importer.prevRunIsParagraph ||
|
68932
68950
|
this.importer.currPosition - lastImportedRun.runLength < this.startPosition) {
|
68933
|
-
this.importer.addParagraphRun(
|
68951
|
+
this.importer.addParagraphRun(this.element, null, true);
|
68934
68952
|
}
|
68935
68953
|
this.rowImporter.cells.push(new ImportedTableCellInfo(preferredWidth, this.startPosition, this.importer.currPosition, columnSpan, rowSpan, props, true));
|
68936
68954
|
}
|
@@ -69029,7 +69047,7 @@ class HtmlTextNodeImporter extends HtmlTagImporterBase {
|
|
69029
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))));
|
69030
69048
|
}
|
69031
69049
|
if (i < lines.length - 1)
|
69032
|
-
this.importer.addParagraphRun(
|
69050
|
+
this.importer.addParagraphRun(this.element.parentElement || this.element.parentNode);
|
69033
69051
|
}
|
69034
69052
|
}
|
69035
69053
|
else {
|
@@ -69037,7 +69055,7 @@ class HtmlTextNodeImporter extends HtmlTagImporterBase {
|
|
69037
69055
|
}
|
69038
69056
|
}
|
69039
69057
|
}
|
69040
|
-
|
69058
|
+
isImportChildren() {
|
69041
69059
|
return false;
|
69042
69060
|
}
|
69043
69061
|
importAfter() {
|
@@ -69052,7 +69070,7 @@ class HtmlTtTagImporter extends HtmlTagImporterBase {
|
|
69052
69070
|
}
|
69053
69071
|
importBefore() {
|
69054
69072
|
}
|
69055
|
-
|
69073
|
+
isImportChildren() {
|
69056
69074
|
return true;
|
69057
69075
|
}
|
69058
69076
|
importAfter() {
|
@@ -69078,8 +69096,8 @@ class HtmlUndefinedTagImporter extends HtmlTagImporterBase {
|
|
69078
69096
|
importBefore() {
|
69079
69097
|
Log.print(LogSource.HtmlImporter, "HtmlUndefinedTagImporter.importBefore undefined tag", this.element);
|
69080
69098
|
}
|
69081
|
-
|
69082
|
-
return !!this.importer.
|
69099
|
+
isImportChildren() {
|
69100
|
+
return !!this.importer.currElementChildren.length;
|
69083
69101
|
}
|
69084
69102
|
importAfter() {
|
69085
69103
|
}
|
@@ -69599,6 +69617,10 @@ class HtmlImporterTabStops {
|
|
69599
69617
|
|
69600
69618
|
|
69601
69619
|
|
69620
|
+
|
69621
|
+
|
69622
|
+
|
69623
|
+
|
69602
69624
|
|
69603
69625
|
|
69604
69626
|
|
@@ -69620,8 +69642,8 @@ class LevelInfo {
|
|
69620
69642
|
return this;
|
69621
69643
|
}
|
69622
69644
|
static getElementTag(elem) {
|
69623
|
-
const tag = elem.tagName;
|
69624
|
-
return tag ? tag.toUpperCase() :
|
69645
|
+
const tag = dom.DomUtils.isHTMLElementNode(elem) && elem.tagName;
|
69646
|
+
return tag ? tag.toUpperCase() : '';
|
69625
69647
|
}
|
69626
69648
|
}
|
69627
69649
|
class HtmlImportData {
|
@@ -69631,7 +69653,7 @@ class HtmlImportData {
|
|
69631
69653
|
}
|
69632
69654
|
}
|
69633
69655
|
class HtmlImporter {
|
69634
|
-
constructor(modelManager, measurer, subDocPosition, initElements, charPropsBundle) {
|
69656
|
+
constructor(modelManager, measurer, subDocPosition, initElements, charPropsBundle, formatImagesImporter) {
|
69635
69657
|
this.fieldsId = 0;
|
69636
69658
|
this.listIndex = 0;
|
69637
69659
|
this.listInfos = [];
|
@@ -69672,19 +69694,27 @@ class HtmlImporter {
|
|
69672
69694
|
this.measurer = measurer;
|
69673
69695
|
this.currPosition = this.subDocPosition.position;
|
69674
69696
|
this.levelInfo = [new LevelInfo(null, initElements, true)];
|
69697
|
+
this.formatImagesImporter = formatImagesImporter;
|
69675
69698
|
this.loadFontInfos = [];
|
69676
69699
|
this.tempFontInfoCache = new FontInfoCache(this.modelManager.model.cache.fontInfoCache.fontMeasurer);
|
69677
69700
|
this.htmlImporterMaskedCharacterProperties =
|
69678
69701
|
new HtmlImporterMaskedCharacterProperties(this, this.loadFontInfos, this.tempFontInfoCache, !modelManager.richOptions.fonts.limitedFonts);
|
69679
|
-
this.
|
69702
|
+
this.paragraphListPropertiesUtils = new ParagraphListPropertiesUtils(this, this.htmlImporterMaskedCharacterProperties);
|
69680
69703
|
this.tagImporters = {};
|
69681
69704
|
for (let importerConst of HtmlImporter.importers)
|
69682
69705
|
this.tagImporters[new importerConst(this).elementTag()] = importerConst;
|
69683
69706
|
}
|
69684
69707
|
get currElement() { return utils_list.ListUtils.last(this.levelInfo).element; }
|
69685
69708
|
;
|
69686
|
-
get
|
69709
|
+
get currElementChildren() { return utils_list.ListUtils.last(this.levelInfo).childElements; }
|
69687
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
|
+
}
|
69688
69718
|
get subDocument() { return this.subDocPosition.subDocument; }
|
69689
69719
|
import() {
|
69690
69720
|
this.importStarted = false;
|
@@ -69705,11 +69735,13 @@ class HtmlImporter {
|
|
69705
69735
|
insertedInterval = new fixed.FixedInterval(this.subDocPosition.position, 0);
|
69706
69736
|
for (let info of this.loadFontInfos)
|
69707
69737
|
this.modelManager.modelManipulator.font.loadFontInfo(info.fontInfo, info.subDocument, [info.applyNewFontOnIntervalsAfterLoad], this.measurer);
|
69738
|
+
if (this.formatImagesImporter)
|
69739
|
+
this.registerImageRuns();
|
69708
69740
|
});
|
69709
69741
|
return insertedInterval;
|
69710
69742
|
}
|
69711
69743
|
convertChildElements(preserveLineBreaks = false) {
|
69712
|
-
for (let element of this.
|
69744
|
+
for (let element of this.currElementChildren)
|
69713
69745
|
this.convertElement(element, preserveLineBreaks);
|
69714
69746
|
}
|
69715
69747
|
getSortedTables() {
|
@@ -69731,18 +69763,18 @@ class HtmlImporter {
|
|
69731
69763
|
importer.enablePreserveLineBreaks = preserveLineBreaks;
|
69732
69764
|
if (importer.isAllowed())
|
69733
69765
|
importer.importBefore();
|
69734
|
-
if (importer.
|
69766
|
+
if (importer.isImportChildren())
|
69735
69767
|
this.convertChildElements(preserveLineBreaks || importer.shouldPreserveLineBreaksOnChilds());
|
69736
69768
|
if (importer.isAllowed())
|
69737
69769
|
importer.importAfter();
|
69738
69770
|
this.levelInfo.pop();
|
69739
69771
|
}
|
69740
69772
|
putDownParentPropertiesToChild() {
|
69741
|
-
if (!this.
|
69773
|
+
if (!this.currElementChildren)
|
69742
69774
|
return;
|
69743
69775
|
const element = this.currElement;
|
69744
69776
|
const missTag = HtmlImporter.MapMissTablePropertiesByTagNames[utils_list.ListUtils.last(this.levelInfo).tagImporter.elementTag()];
|
69745
|
-
utils_list.ListUtils.forEach(this.
|
69777
|
+
utils_list.ListUtils.forEach(this.currElementChildren, (childElement) => {
|
69746
69778
|
const childElemStyle = this.getStyles(childElement);
|
69747
69779
|
if (!Object.keys(childElemStyle).length)
|
69748
69780
|
return;
|
@@ -69778,19 +69810,26 @@ class HtmlImporter {
|
|
69778
69810
|
}
|
69779
69811
|
addRun(run, forceAdd = false) {
|
69780
69812
|
if (forceAdd || utils_list.ListUtils.last(this.levelInfo).allowInsertRuns) {
|
69813
|
+
const isParagraph = run.runType == RunType.ParagraphRun || run.runType == RunType.SectionRun;
|
69781
69814
|
this.importedRunsInfo.push(run);
|
69782
69815
|
this.currPosition += run.runLength;
|
69783
|
-
this.prevRunIsParagraph =
|
69816
|
+
this.prevRunIsParagraph = isParagraph;
|
69784
69817
|
this.importStarted = true;
|
69818
|
+
if (isParagraph && this.currListItemLevelInfo)
|
69819
|
+
this.currListItemLevelInfo.tagImporter.paragraphWasAddedBefore = true;
|
69785
69820
|
}
|
69786
69821
|
}
|
69787
|
-
addParagraphRun(
|
69822
|
+
addParagraphRun(element, listInfo = null, isTableCellTag = false) {
|
69788
69823
|
const htmlProperties = new HtmlImporterMaskedParagraphProperties();
|
69789
69824
|
const properties = htmlProperties.import(this.modelManager.model.colorProvider, element, isTableCellTag);
|
69790
69825
|
const tabs = HtmlImporterTabStops.import(element);
|
69791
69826
|
this.removeAllTrailingLineBreaks();
|
69792
69827
|
this.addRun(new ImportedParagraphRunInfo(listInfo, this.charPropsBundle, properties, tabs));
|
69793
69828
|
}
|
69829
|
+
addCurrLevelParagraphRunIfNeeded() {
|
69830
|
+
if (this.currLevelInfo.element.previousSibling && !this.prevRunIsParagraph)
|
69831
|
+
this.addParagraphRun(this.currLevelInfo.element, this.currListInfo);
|
69832
|
+
}
|
69794
69833
|
removeAllTrailingLineBreaks() {
|
69795
69834
|
const last = this.importedRunsInfo.length - 1;
|
69796
69835
|
for (let i = last; i >= last - 1; i--) {
|
@@ -69811,6 +69850,28 @@ class HtmlImporter {
|
|
69811
69850
|
return ColumnCalculator.findMinimalColumnSize(section.sectionProperties)
|
69812
69851
|
.applyConverter(unit_converter/* UnitConverter */.u.pixelsToTwips);
|
69813
69852
|
}
|
69853
|
+
registerImageRuns() {
|
69854
|
+
let importedRunsInfoIndex = -1;
|
69855
|
+
this.subDocument.chunks.forEach((chunk) => {
|
69856
|
+
chunk.textRuns.forEach((run) => {
|
69857
|
+
if (run instanceof InlinePictureRun) {
|
69858
|
+
importedRunsInfoIndex = this.findIndexImportedInlinePictureRunInfo(run.info.publicAPIID, ++importedRunsInfoIndex);
|
69859
|
+
const subDocPos = new SubDocumentPosition(this.subDocument, run.startOffset);
|
69860
|
+
const importedRunsInfo = this.importedRunsInfo[importedRunsInfoIndex];
|
69861
|
+
const options = ImageLoadingOptions.initByActualSize(importedRunsInfo.actualSize);
|
69862
|
+
const importerData = new FormatImagesImporterData(subDocPos, options, run);
|
69863
|
+
this.formatImagesImporter.registerImageRun(importerData);
|
69864
|
+
}
|
69865
|
+
});
|
69866
|
+
});
|
69867
|
+
}
|
69868
|
+
findIndexImportedInlinePictureRunInfo(publicAPIID, startIndex = 0) {
|
69869
|
+
for (let i = startIndex, runInfo; runInfo = this.importedRunsInfo[i]; i++) {
|
69870
|
+
if (runInfo instanceof ImportedInlinePictureRunInfo && runInfo.picInfo.publicAPIID === publicAPIID)
|
69871
|
+
return i;
|
69872
|
+
}
|
69873
|
+
return -1;
|
69874
|
+
}
|
69814
69875
|
static convertHtml(html) {
|
69815
69876
|
Log.print(LogSource.HtmlImporter, "convertHtml", () => html);
|
69816
69877
|
html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
|
@@ -69843,10 +69904,6 @@ class HtmlImporter {
|
|
69843
69904
|
html = html.replace(/<font[^>]*>([^<>]+)<\/font>/gi, '$1');
|
69844
69905
|
html = html.replace(/<span\s*><span\s*>([^<>]+)<\/span><\/span>/ig, '$1');
|
69845
69906
|
html = html.replace(/<span>([^<>]+)<\/span>/gi, '$1');
|
69846
|
-
html = html.replace(/\s*(<li[\S\s]*?>)\s*/gi, '$1');
|
69847
|
-
html = html.replace(/\s*(<\/li>)\s*/gi, '$1');
|
69848
|
-
html = html.replace(/<li([^>]*)>([^<>]+)<\/li>/gi, '<li$1><p>$2</p></li>');
|
69849
|
-
html = html.replace(/<li([^>]*)>(([^<>]*)<(?!p)[\s\S]*?)<\/li>/gi, '<li$1><p>$2</p></li>');
|
69850
69907
|
html = html.replace(/<caption([^>]*)>[\s\S]*?<\/caption>/gi, '');
|
69851
69908
|
var array = html.match(/<[^>]*style\s*=\s*[^>]*>/gi);
|
69852
69909
|
if (array && array.length > 0) {
|
@@ -69878,6 +69935,8 @@ class HtmlImporter {
|
|
69878
69935
|
html = html.replace(/<u>([\s\S]*?)<\/u>/gi, '<span style="text-decoration: underline">$1</span>');
|
69879
69936
|
html = html.replace(/<s>([\s\S]*?)<\/s>/gi, '<span style="text-decoration: line-through">$1</span>');
|
69880
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');
|
69881
69940
|
html = this.extractBodyContent(html);
|
69882
69941
|
Log.print(LogSource.HtmlImporter, "convertHtml", () => html);
|
69883
69942
|
return html;
|
@@ -69901,7 +69960,7 @@ HtmlImporter.MapMissTablePropertiesByTagNames = new MapCreator()
|
|
69901
69960
|
.add("TH", true)
|
69902
69961
|
.get();
|
69903
69962
|
HtmlImporter.MapShorthandProperty = new MapCreator()
|
69904
|
-
.add("background",
|
69963
|
+
.add("background", false)
|
69905
69964
|
.add("border", true)
|
69906
69965
|
.add("borderImage", true)
|
69907
69966
|
.add("borderTop", true)
|
@@ -69977,7 +70036,7 @@ class HtmlDocumentImporter {
|
|
69977
70036
|
const measurer = new Measurer('');
|
69978
70037
|
const position = new SubDocumentPosition(this.documentModel.mainSubDocument, 0);
|
69979
70038
|
const initElements = container.childNodes;
|
69980
|
-
new HtmlImporter(this.modelManager, measurer, position, initElements, charPropsBundle).import();
|
70039
|
+
new HtmlImporter(this.modelManager, measurer, position, initElements, charPropsBundle, this.formatImagesImporter).import();
|
69981
70040
|
this.removeLastParagraph();
|
69982
70041
|
}
|
69983
70042
|
finally {
|
@@ -89414,7 +89473,7 @@ class ControlFontsLoader {
|
|
89414
89473
|
const xhr = new XMLHttpRequest();
|
89415
89474
|
xhr.onload = (_e) => {
|
89416
89475
|
const contentType = xhr.getResponseHeader("Content-Type");
|
89417
|
-
if (contentType
|
89476
|
+
if (contentType !== 'text/html') {
|
89418
89477
|
const fontSource = xhr.response;
|
89419
89478
|
if (xhr.status >= 400 || !fontSource) {
|
89420
89479
|
if (fontInfo.next())
|
@@ -112813,7 +112872,7 @@ class DivInputEditor extends InputEditorBase {
|
|
112813
112872
|
return super.getEditableDocumentText().replace(/\s/g, " ");
|
112814
112873
|
}
|
112815
112874
|
getEditableDocumentContent() {
|
112816
|
-
const htmlItems = this.inputElement.cloneNode(true).
|
112875
|
+
const htmlItems = this.inputElement.cloneNode(true).childNodes;
|
112817
112876
|
if (htmlItems.length)
|
112818
112877
|
return htmlItems;
|
112819
112878
|
return this.inputElement.innerText;
|
@@ -112955,9 +113014,9 @@ class IFrameInputEditor extends InputEditorBase {
|
|
112955
113014
|
}
|
112956
113015
|
}
|
112957
113016
|
getEditableDocumentContent() {
|
112958
|
-
const
|
112959
|
-
if (
|
112960
|
-
return
|
113017
|
+
const items = this.editableDocument.body.cloneNode(true).childNodes;
|
113018
|
+
if (items.length)
|
113019
|
+
return items;
|
112961
113020
|
return this.editableDocument.body.innerText;
|
112962
113021
|
}
|
112963
113022
|
selectEditableDocumentContent() {
|
@@ -113152,7 +113211,7 @@ class InputController {
|
|
113152
113211
|
else {
|
113153
113212
|
const _fragment = document.createDocumentFragment();
|
113154
113213
|
_fragment.appendChild(result);
|
113155
|
-
this.setEditableDocumentContent(_fragment.
|
113214
|
+
this.setEditableDocumentContent(_fragment.childNodes);
|
113156
113215
|
}
|
113157
113216
|
this.selectEditableDocumentContent();
|
113158
113217
|
}
|
@@ -143633,7 +143692,7 @@ class ClientRichEdit {
|
|
143633
143692
|
this.contextMenuSettings = settings.contextMenuSettings;
|
143634
143693
|
this.fullScreenHelper = new FullScreenHelper(element);
|
143635
143694
|
if (true)
|
143636
|
-
external_DevExpress_config_default()(JSON.parse(atob('
|
143695
|
+
external_DevExpress_config_default()(JSON.parse(atob('eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFYWkdXQzFTVkdFeU1IbFVPRGh0YzAxNmRsQTJaeUlLZlE9PS5GYjZ4U0JwU3BSVHBWajZ0dWtlQTJZaU1WVW5tb0ZoSDJKV3Ryak5iN3p6VlNrNzhKa294RVFKOW9rVlErYnh0SzM1WWlFZkpEWGJnNktrYVA1ZEljcnp0ZHlsOFlGL2ltc3BIWkY5aWlaeGtVK0FXbFVrV1RUb2c0ZnZDbWlxMTl2MWhIdz09In0=')));
|
143637
143696
|
this.prepareElement(element, settings);
|
143638
143697
|
this.initDefaultFontsAndStyles();
|
143639
143698
|
this.initBars(settings.ribbon, settings.fonts);
|