devexpress-richedit 24.1.4-build-24186-1015 → 24.1.5-build-24204-0102

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.
Files changed (66) hide show
  1. package/bin/gulpfile.js +1 -1
  2. package/bin/index-custom.js +1 -1
  3. package/bin/localization-builder.js +1 -1
  4. package/bin/nspell-index.js +1 -1
  5. package/bin/nspell.webpack.config.js +1 -1
  6. package/bin/webpack-externals.js +1 -1
  7. package/bin/webpack.config.js +1 -1
  8. package/dist/dx.richedit.d.ts +1 -1
  9. package/dist/dx.richedit.js +106 -77
  10. package/dist/dx.richedit.min.js +2 -2
  11. package/index.d.ts +1 -1
  12. package/index.js +1 -1
  13. package/lib/client/client-rich-edit.js +2 -2
  14. package/lib/common/formats/html/import/html-importer.d.ts +9 -4
  15. package/lib/common/formats/html/import/html-importer.js +27 -15
  16. package/lib/common/formats/html/import/importers/a.d.ts +1 -1
  17. package/lib/common/formats/html/import/importers/a.js +1 -1
  18. package/lib/common/formats/html/import/importers/b.d.ts +1 -1
  19. package/lib/common/formats/html/import/importers/b.js +1 -1
  20. package/lib/common/formats/html/import/importers/base.d.ts +2 -1
  21. package/lib/common/formats/html/import/importers/base.js +1 -0
  22. package/lib/common/formats/html/import/importers/br.d.ts +1 -1
  23. package/lib/common/formats/html/import/importers/br.js +1 -1
  24. package/lib/common/formats/html/import/importers/center.d.ts +1 -1
  25. package/lib/common/formats/html/import/importers/center.js +1 -1
  26. package/lib/common/formats/html/import/importers/cite.d.ts +1 -1
  27. package/lib/common/formats/html/import/importers/cite.js +1 -1
  28. package/lib/common/formats/html/import/importers/div.d.ts +1 -1
  29. package/lib/common/formats/html/import/importers/div.js +3 -3
  30. package/lib/common/formats/html/import/importers/em.d.ts +1 -1
  31. package/lib/common/formats/html/import/importers/em.js +1 -1
  32. package/lib/common/formats/html/import/importers/font.d.ts +1 -1
  33. package/lib/common/formats/html/import/importers/font.js +1 -1
  34. package/lib/common/formats/html/import/importers/i.d.ts +1 -1
  35. package/lib/common/formats/html/import/importers/i.js +1 -1
  36. package/lib/common/formats/html/import/importers/img.d.ts +1 -1
  37. package/lib/common/formats/html/import/importers/img.js +1 -1
  38. package/lib/common/formats/html/import/importers/li.d.ts +2 -1
  39. package/lib/common/formats/html/import/importers/li.js +13 -10
  40. package/lib/common/formats/html/import/importers/list-base.d.ts +1 -1
  41. package/lib/common/formats/html/import/importers/list-base.js +2 -1
  42. package/lib/common/formats/html/import/importers/p.d.ts +3 -3
  43. package/lib/common/formats/html/import/importers/p.js +19 -16
  44. package/lib/common/formats/html/import/importers/pre.d.ts +1 -1
  45. package/lib/common/formats/html/import/importers/pre.js +1 -1
  46. package/lib/common/formats/html/import/importers/span.d.ts +1 -1
  47. package/lib/common/formats/html/import/importers/span.js +1 -1
  48. package/lib/common/formats/html/import/importers/table.d.ts +1 -1
  49. package/lib/common/formats/html/import/importers/table.js +2 -2
  50. package/lib/common/formats/html/import/importers/tbody.d.ts +1 -1
  51. package/lib/common/formats/html/import/importers/tbody.js +1 -1
  52. package/lib/common/formats/html/import/importers/td.d.ts +1 -1
  53. package/lib/common/formats/html/import/importers/td.js +2 -2
  54. package/lib/common/formats/html/import/importers/text-node.d.ts +1 -1
  55. package/lib/common/formats/html/import/importers/text-node.js +2 -2
  56. package/lib/common/formats/html/import/importers/tr.d.ts +1 -1
  57. package/lib/common/formats/html/import/importers/tr.js +1 -1
  58. package/lib/common/formats/html/import/importers/tt.d.ts +1 -1
  59. package/lib/common/formats/html/import/importers/tt.js +1 -1
  60. package/lib/common/formats/html/import/importers/undefined.d.ts +1 -1
  61. package/lib/common/formats/html/import/importers/undefined.js +2 -2
  62. package/lib/common/formats/html/import/utils/paragraph-list-properties-utils.js +13 -4
  63. package/lib/common/input-controller.d.ts +8 -8
  64. package/lib/common/input-controller.js +5 -5
  65. package/lib/common/rich-utils/html-utils.d.ts +1 -1
  66. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * DevExpress WebRichEdit (index.d.ts)
3
- * Version: 24.1.4
3
+ * Version: 24.1.5
4
4
  * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
5
5
  * License: https://www.devexpress.com/Support/EULAs
6
6
  */
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * DevExpress WebRichEdit (index.js)
3
- * Version: 24.1.4
3
+ * Version: 24.1.5
4
4
  * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
5
5
  * License: https://www.devexpress.com/Support/EULAs
6
6
  */
@@ -53,8 +53,8 @@ export class ClientRichEdit {
53
53
  this.rawDataSource = settings.rawDataSource;
54
54
  this.contextMenuSettings = settings.contextMenuSettings;
55
55
  this.fullScreenHelper = new FullScreenHelper(element);
56
- if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFUbHhVemQxYzBSQ01HVlpTbDlrVGkxb2FYaGtVU0lLZlE9PS5INTlJcG94ZC90cWdVcE1leVdhamhubjl2NnFtMkFrQmc2MW0yU05ZUHIreFBrdnRLUm04Wm4rU08rUVQ3NEt3MVpWQ0pGeEJYV1dJRlNyRG1EZlVqYmV6N2RzTnpJbTR6S1A5M2l4amVQR0Jnb2o4eG9VSmZvNldmZzNMblpTUlNLcHFpZz09In0=")
57
- config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFUbHhVemQxYzBSQ01HVlpTbDlrVGkxb2FYaGtVU0lLZlE9PS5INTlJcG94ZC90cWdVcE1leVdhamhubjl2NnFtMkFrQmc2MW0yU05ZUHIreFBrdnRLUm04Wm4rU08rUVQ3NEt3MVpWQ0pGeEJYV1dJRlNyRG1EZlVqYmV6N2RzTnpJbTR6S1A5M2l4amVQR0Jnb2o4eG9VSmZvNldmZzNMblpTUlNLcHFpZz09In0=")));
56
+ if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFYWkdXQzFTVkdFeU1IbFVPRGh0YzAxNmRsQTJaeUlLZlE9PS5GYjZ4U0JwU3BSVHBWajZ0dWtlQTJZaU1WVW5tb0ZoSDJKV3Ryak5iN3p6VlNrNzhKa294RVFKOW9rVlErYnh0SzM1WWlFZkpEWGJnNktrYVA1ZEljcnp0ZHlsOFlGL2ltc3BIWkY5aWlaeGtVK0FXbFVrV1RUb2c0ZnZDbWlxMTl2MWhIdz09In0=")
57
+ config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFYWkdXQzFTVkdFeU1IbFVPRGh0YzAxNmRsQTJaeUlLZlE9PS5GYjZ4U0JwU3BSVHBWajZ0dWtlQTJZaU1WVW5tb0ZoSDJKV3Ryak5iN3p6VlNrNzhKa294RVFKOW9rVlErYnh0SzM1WWlFZkpEWGJnNktrYVA1ZEljcnp0ZHlsOFlGL2ltc3BIWkY5aWlaeGtVK0FXbFVrV1RUb2c0ZnZDbWlxMTl2MWhIdz09In0=")));
58
58
  this.prepareElement(element, settings);
59
59
  this.initDefaultFontsAndStyles();
60
60
  this.initBars(settings.ribbon, settings.fonts);
@@ -20,7 +20,7 @@ export declare class LevelInfo {
20
20
  allowInsertRuns: boolean;
21
21
  constructor(element: HTMLElement, childElements: HTMLElement[], allowInsertRuns: boolean);
22
22
  initTagImporter(importer: HtmlImporter): this;
23
- static getElementTag(elem: HTMLElement): string;
23
+ static getElementTag(elem: HTMLElement | ChildNode): string;
24
24
  }
25
25
  export declare class HtmlImportData {
26
26
  runsInfo: RunInfo[];
@@ -30,18 +30,22 @@ export declare class HtmlImportData {
30
30
  export declare class HtmlImporter {
31
31
  currPosition: number;
32
32
  htmlImporterMaskedCharacterProperties: HtmlImporterMaskedCharacterProperties;
33
- paragraphListpropertiesUtils: ParagraphListPropertiesUtils;
33
+ paragraphListPropertiesUtils: ParagraphListPropertiesUtils;
34
34
  private importedRunsInfo;
35
35
  importedTablesInfo: TableInfo[];
36
36
  loadFontInfos: LoadFontInfo[];
37
37
  tempFontInfoCache: FontInfoCache;
38
38
  get currElement(): HTMLElement;
39
- get currElementChilds(): HTMLElement[];
39
+ get currElementChildren(): HTMLElement[];
40
40
  levelInfo: LevelInfo[];
41
+ get prevLevelInfo(): LevelInfo;
42
+ get currLevelInfo(): LevelInfo;
43
+ get currListItemLevelInfo(): LevelInfo | null;
41
44
  fieldsId: number;
42
45
  prevRunIsParagraph: boolean;
43
46
  listIndex: number;
44
47
  listInfos: ImportedParagraphListInfo[];
48
+ get currListInfo(): ImportedParagraphListInfo;
45
49
  importStarted: boolean;
46
50
  modelManager: IModelManager;
47
51
  private subDocPosition;
@@ -59,7 +63,8 @@ export declare class HtmlImporter {
59
63
  private putDownParentPropertiesToChild;
60
64
  private getStyles;
61
65
  addRun(run: RunInfo, forceAdd?: boolean): void;
62
- addParagraphRun(listInfo: ImportedParagraphListInfo, element: HTMLElement, isTableCellTag?: boolean): void;
66
+ addParagraphRun(element: HTMLElement, listInfo?: ImportedParagraphListInfo, isTableCellTag?: boolean): void;
67
+ addCurrLevelParagraphRunIfNeeded(): void;
63
68
  removeAllTrailingLineBreaks(): void;
64
69
  getLastImportedRun(): RunInfo;
65
70
  columnSize(): Size;
@@ -57,8 +57,8 @@ export class LevelInfo {
57
57
  return this;
58
58
  }
59
59
  static getElementTag(elem) {
60
- const tag = elem.tagName;
61
- return tag ? tag.toUpperCase() : "";
60
+ const tag = DomUtils.isHTMLElementNode(elem) && elem.tagName;
61
+ return tag ? tag.toUpperCase() : '';
62
62
  }
63
63
  }
64
64
  export class HtmlImportData {
@@ -114,15 +114,22 @@ export class HtmlImporter {
114
114
  this.tempFontInfoCache = new FontInfoCache(this.modelManager.model.cache.fontInfoCache.fontMeasurer);
115
115
  this.htmlImporterMaskedCharacterProperties =
116
116
  new HtmlImporterMaskedCharacterProperties(this, this.loadFontInfos, this.tempFontInfoCache, !modelManager.richOptions.fonts.limitedFonts);
117
- this.paragraphListpropertiesUtils = new ParagraphListPropertiesUtils(this, this.htmlImporterMaskedCharacterProperties);
117
+ this.paragraphListPropertiesUtils = new ParagraphListPropertiesUtils(this, this.htmlImporterMaskedCharacterProperties);
118
118
  this.tagImporters = {};
119
119
  for (let importerConst of HtmlImporter.importers)
120
120
  this.tagImporters[new importerConst(this).elementTag()] = importerConst;
121
121
  }
122
122
  get currElement() { return ListUtils.last(this.levelInfo).element; }
123
123
  ;
124
- get currElementChilds() { return ListUtils.last(this.levelInfo).childElements; }
124
+ get currElementChildren() { return ListUtils.last(this.levelInfo).childElements; }
125
125
  ;
126
+ get prevLevelInfo() { return this.levelInfo[this.levelInfo.length - 2]; }
127
+ get currLevelInfo() { return ListUtils.last(this.levelInfo); }
128
+ get currListItemLevelInfo() { return ListUtils.reverseElementBy(this.levelInfo, (levelInfo) => { var _a; return ((_a = levelInfo.tagImporter) === null || _a === void 0 ? void 0 : _a.elementTag()) === 'LI'; }); }
129
+ get currListInfo() {
130
+ const currListItemLevelInfo = this.currListItemLevelInfo;
131
+ return currListItemLevelInfo && !currListItemLevelInfo.tagImporter.paragraphWasAddedBefore ? ListUtils.last(this.listInfos) : null;
132
+ }
126
133
  get subDocument() { return this.subDocPosition.subDocument; }
127
134
  import() {
128
135
  this.importStarted = false;
@@ -149,7 +156,7 @@ export class HtmlImporter {
149
156
  return insertedInterval;
150
157
  }
151
158
  convertChildElements(preserveLineBreaks = false) {
152
- for (let element of this.currElementChilds)
159
+ for (let element of this.currElementChildren)
153
160
  this.convertElement(element, preserveLineBreaks);
154
161
  }
155
162
  getSortedTables() {
@@ -171,18 +178,18 @@ export class HtmlImporter {
171
178
  importer.enablePreserveLineBreaks = preserveLineBreaks;
172
179
  if (importer.isAllowed())
173
180
  importer.importBefore();
174
- if (importer.isImportChilds())
181
+ if (importer.isImportChildren())
175
182
  this.convertChildElements(preserveLineBreaks || importer.shouldPreserveLineBreaksOnChilds());
176
183
  if (importer.isAllowed())
177
184
  importer.importAfter();
178
185
  this.levelInfo.pop();
179
186
  }
180
187
  putDownParentPropertiesToChild() {
181
- if (!this.currElementChilds)
188
+ if (!this.currElementChildren)
182
189
  return;
183
190
  const element = this.currElement;
184
191
  const missTag = HtmlImporter.MapMissTablePropertiesByTagNames[ListUtils.last(this.levelInfo).tagImporter.elementTag()];
185
- ListUtils.forEach(this.currElementChilds, (childElement) => {
192
+ ListUtils.forEach(this.currElementChildren, (childElement) => {
186
193
  const childElemStyle = this.getStyles(childElement);
187
194
  if (!Object.keys(childElemStyle).length)
188
195
  return;
@@ -218,19 +225,26 @@ export class HtmlImporter {
218
225
  }
219
226
  addRun(run, forceAdd = false) {
220
227
  if (forceAdd || ListUtils.last(this.levelInfo).allowInsertRuns) {
228
+ const isParagraph = run.runType == RunType.ParagraphRun || run.runType == RunType.SectionRun;
221
229
  this.importedRunsInfo.push(run);
222
230
  this.currPosition += run.runLength;
223
- this.prevRunIsParagraph = run.runType == RunType.ParagraphRun || run.runType == RunType.SectionRun;
231
+ this.prevRunIsParagraph = isParagraph;
224
232
  this.importStarted = true;
233
+ if (isParagraph && this.currListItemLevelInfo)
234
+ this.currListItemLevelInfo.tagImporter.paragraphWasAddedBefore = true;
225
235
  }
226
236
  }
227
- addParagraphRun(listInfo, element, isTableCellTag = false) {
237
+ addParagraphRun(element, listInfo = null, isTableCellTag = false) {
228
238
  const htmlProperties = new HtmlImporterMaskedParagraphProperties();
229
239
  const properties = htmlProperties.import(this.modelManager.model.colorProvider, element, isTableCellTag);
230
240
  const tabs = HtmlImporterTabStops.import(element);
231
241
  this.removeAllTrailingLineBreaks();
232
242
  this.addRun(new ImportedParagraphRunInfo(listInfo, this.charPropsBundle, properties, tabs));
233
243
  }
244
+ addCurrLevelParagraphRunIfNeeded() {
245
+ if (this.currLevelInfo.element.previousSibling && !this.prevRunIsParagraph)
246
+ this.addParagraphRun(this.currLevelInfo.element, this.currListInfo);
247
+ }
234
248
  removeAllTrailingLineBreaks() {
235
249
  const last = this.importedRunsInfo.length - 1;
236
250
  for (let i = last; i >= last - 1; i--) {
@@ -305,10 +319,6 @@ export class HtmlImporter {
305
319
  html = html.replace(/<font[^>]*>([^<>]+)<\/font>/gi, '$1');
306
320
  html = html.replace(/<span\s*><span\s*>([^<>]+)<\/span><\/span>/ig, '$1');
307
321
  html = html.replace(/<span>([^<>]+)<\/span>/gi, '$1');
308
- html = html.replace(/\s*(<li[\S\s]*?>)\s*/gi, '$1');
309
- html = html.replace(/\s*(<\/li>)\s*/gi, '$1');
310
- html = html.replace(/<li([^>]*)>([^<>]+)<\/li>/gi, '<li$1><p>$2</p></li>');
311
- html = html.replace(/<li([^>]*)>(([^<>]*)<(?!p)[\s\S]*?)<\/li>/gi, '<li$1><p>$2</p></li>');
312
322
  html = html.replace(/<caption([^>]*)>[\s\S]*?<\/caption>/gi, '');
313
323
  var array = html.match(/<[^>]*style\s*=\s*[^>]*>/gi);
314
324
  if (array && array.length > 0) {
@@ -340,6 +350,8 @@ export class HtmlImporter {
340
350
  html = html.replace(/<u>([\s\S]*?)<\/u>/gi, '<span style="text-decoration: underline">$1</span>');
341
351
  html = html.replace(/<s>([\s\S]*?)<\/s>/gi, '<span style="text-decoration: line-through">$1</span>');
342
352
  html = html.replace(/<\/([^\s>]+)(\s[^>]*)?><br><\/([^\s>]+)(\s[^>]*)?>/gi, '');
353
+ html = html.replace(/\s*(<([ph]\d?|ol|ul|li))/gi, '$1');
354
+ html = html.replace(/(<\/([ph]\d?|ol|ul|li)>)\s*/gi, '$1');
343
355
  html = this.extractBodyContent(html);
344
356
  Log.print(LogSource.HtmlImporter, "convertHtml", () => html);
345
357
  return html;
@@ -363,7 +375,7 @@ HtmlImporter.MapMissTablePropertiesByTagNames = new MapCreator()
363
375
  .add("TH", true)
364
376
  .get();
365
377
  HtmlImporter.MapShorthandProperty = new MapCreator()
366
- .add("background", true)
378
+ .add("background", false)
367
379
  .add("border", true)
368
380
  .add("borderImage", true)
369
381
  .add("borderTop", true)
@@ -2,7 +2,7 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlATagImporter extends HtmlTagImporterBase {
3
3
  elementTag(): string;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
7
  isAllowed(): boolean;
8
8
  }
@@ -24,7 +24,7 @@ export class HtmlATagImporter extends HtmlTagImporterBase {
24
24
  this.addRun(new ImportedTextRunInfo(this.importer.modelManager.model, this.importer.measurer, codeText, this.importer.htmlImporterMaskedCharacterProperties.getBundleFrom(this.element, new FixedInterval(this.importer.currPosition, codeText.length))));
25
25
  this.addRun(new ImportedFieldCodeEndRunInfo(this.importer.charPropsBundle, this.importer.fieldsId));
26
26
  }
27
- isImportChilds() {
27
+ isImportChildren() {
28
28
  return true;
29
29
  }
30
30
  importAfter() {
@@ -2,6 +2,6 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlBTagImporter extends HtmlTagImporterBase {
3
3
  elementTag(): string;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
7
  }
@@ -5,7 +5,7 @@ export class HtmlBTagImporter extends HtmlTagImporterBase {
5
5
  }
6
6
  importBefore() {
7
7
  }
8
- isImportChilds() {
8
+ isImportChildren() {
9
9
  return true;
10
10
  }
11
11
  importAfter() {
@@ -3,12 +3,13 @@ import { RunInfo } from '../containers/runs';
3
3
  import { HtmlImporter } from '../html-importer';
4
4
  export declare abstract class HtmlTagImporterBase {
5
5
  enablePreserveLineBreaks: boolean;
6
+ paragraphWasAddedBefore: boolean;
6
7
  protected importer: HtmlImporter;
7
8
  get colorProvider(): ColorProvider;
8
9
  constructor(importer: HtmlImporter);
9
10
  protected getClosestImporterByTagName(tagName: string): HtmlTagImporterBase;
10
11
  abstract importBefore(): any;
11
- abstract isImportChilds(): boolean;
12
+ abstract isImportChildren(): boolean;
12
13
  abstract importAfter(): any;
13
14
  abstract elementTag(): string;
14
15
  shouldPreserveLineBreaksOnChilds(): boolean;
@@ -2,6 +2,7 @@ import { ListUtils } from '@devexpress/utils/lib/utils/list';
2
2
  export class HtmlTagImporterBase {
3
3
  constructor(importer) {
4
4
  this.enablePreserveLineBreaks = false;
5
+ this.paragraphWasAddedBefore = false;
5
6
  this.importer = importer;
6
7
  }
7
8
  get colorProvider() { return this.importer.modelManager.model.colorProvider; }
@@ -2,6 +2,6 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlBrTagImporter extends HtmlTagImporterBase {
3
3
  elementTag(): string;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
7
  }
@@ -12,7 +12,7 @@ export class HtmlBrTagImporter extends HtmlTagImporterBase {
12
12
  RichUtils.specialCharacters.LineBreak;
13
13
  this.addRun(new ImportedTextRunInfo(this.importer.modelManager.model, this.importer.measurer, breakChar, this.importer.htmlImporterMaskedCharacterProperties.getBundleFrom(this.element, new FixedInterval(this.importer.currPosition, 1))));
14
14
  }
15
- isImportChilds() {
15
+ isImportChildren() {
16
16
  return false;
17
17
  }
18
18
  importAfter() {
@@ -2,6 +2,6 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlCenterTagImporter extends HtmlTagImporterBase {
3
3
  elementTag(): string;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
7
  }
@@ -5,7 +5,7 @@ export class HtmlCenterTagImporter extends HtmlTagImporterBase {
5
5
  }
6
6
  importBefore() {
7
7
  }
8
- isImportChilds() {
8
+ isImportChildren() {
9
9
  return true;
10
10
  }
11
11
  importAfter() {
@@ -2,6 +2,6 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlCiteTagImporter extends HtmlTagImporterBase {
3
3
  elementTag(): string;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
7
  }
@@ -5,7 +5,7 @@ export class HtmlCiteTagImporter extends HtmlTagImporterBase {
5
5
  }
6
6
  importBefore() {
7
7
  }
8
- isImportChilds() {
8
+ isImportChildren() {
9
9
  return true;
10
10
  }
11
11
  importAfter() {
@@ -2,6 +2,6 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlDivTagImporter extends HtmlTagImporterBase {
3
3
  elementTag(): string;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
7
  }
@@ -5,13 +5,13 @@ export class HtmlDivTagImporter extends HtmlTagImporterBase {
5
5
  }
6
6
  importBefore() {
7
7
  if (!this.importer.prevRunIsParagraph && this.importer.importStarted)
8
- this.importer.addParagraphRun(null, this.element);
8
+ this.importer.addParagraphRun(this.element);
9
9
  }
10
- isImportChilds() {
10
+ isImportChildren() {
11
11
  return true;
12
12
  }
13
13
  importAfter() {
14
14
  if (!this.importer.prevRunIsParagraph)
15
- this.importer.addParagraphRun(null, this.element);
15
+ this.importer.addParagraphRun(this.element);
16
16
  }
17
17
  }
@@ -2,6 +2,6 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlEmTagImporter extends HtmlTagImporterBase {
3
3
  elementTag(): string;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
7
  }
@@ -5,7 +5,7 @@ export class HtmlEmTagImporter extends HtmlTagImporterBase {
5
5
  }
6
6
  importBefore() {
7
7
  }
8
- isImportChilds() {
8
+ isImportChildren() {
9
9
  return true;
10
10
  }
11
11
  importAfter() {
@@ -2,6 +2,6 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlFontTagImporter extends HtmlTagImporterBase {
3
3
  elementTag(): string;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
7
  }
@@ -5,7 +5,7 @@ export class HtmlFontTagImporter extends HtmlTagImporterBase {
5
5
  }
6
6
  importBefore() {
7
7
  }
8
- isImportChilds() {
8
+ isImportChildren() {
9
9
  return true;
10
10
  }
11
11
  importAfter() {
@@ -2,6 +2,6 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlITagImporter extends HtmlTagImporterBase {
3
3
  elementTag(): string;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
7
  }
@@ -5,7 +5,7 @@ export class HtmlITagImporter extends HtmlTagImporterBase {
5
5
  }
6
6
  importBefore() {
7
7
  }
8
- isImportChilds() {
8
+ isImportChildren() {
9
9
  return true;
10
10
  }
11
11
  importAfter() {
@@ -2,6 +2,6 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlImgTagImporter extends HtmlTagImporterBase {
3
3
  elementTag(): string;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
7
  }
@@ -19,7 +19,7 @@ export class HtmlImgTagImporter extends HtmlTagImporterBase {
19
19
  const cacheInfo = this.importer.modelManager.model.cache.imageCache.createUnloadedByBase64OrUrl(imageElement.src, originalSize);
20
20
  this.addRun(new ImportedInlinePictureRunInfo(this.importer.charPropsBundle, InlinePictureInfo.defaultInfo(cacheInfo), actualSize));
21
21
  }
22
- isImportChilds() {
22
+ isImportChildren() {
23
23
  return false;
24
24
  }
25
25
  importAfter() {
@@ -2,6 +2,7 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlLiTagImporter extends HtmlTagImporterBase {
3
3
  elementTag(): string;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
+ private isListElement;
7
8
  }
@@ -1,23 +1,26 @@
1
1
  import { ListUtils } from '@devexpress/utils/lib/utils/list';
2
2
  import { HtmlTagImporterBase } from './base';
3
- import { Errors } from '@devexpress/utils/lib/errors';
4
- import { DomUtils } from '@devexpress/utils/lib/utils/dom';
5
3
  import { LevelInfo } from '../html-importer';
6
4
  export class HtmlLiTagImporter extends HtmlTagImporterBase {
7
5
  elementTag() {
8
6
  return 'LI';
9
7
  }
10
- importBefore() { }
11
- isImportChilds() {
8
+ importBefore() {
9
+ const firstChild = this.element.childNodes[0];
10
+ this.element.innerHTML = this.element.innerHTML.trim();
11
+ if (this.isListElement(firstChild))
12
+ this.importer.addParagraphRun(this.element, this.importer.currListInfo);
13
+ }
14
+ isImportChildren() {
12
15
  return true;
13
16
  }
14
17
  importAfter() {
15
18
  const lastChild = ListUtils.last([...this.element.childNodes]);
16
- if (!DomUtils.isHTMLElementNode(lastChild) || LevelInfo.getElementTag(lastChild) !== 'UL' && LevelInfo.getElementTag(lastChild) !== 'OL') {
17
- const listInfo = ListUtils.last(this.importer.listInfos);
18
- if (!listInfo)
19
- throw new Error(Errors.InternalException);
20
- this.importer.addParagraphRun(listInfo, this.element);
21
- }
19
+ if (!this.importer.prevRunIsParagraph && !this.isListElement(lastChild))
20
+ this.importer.addParagraphRun(this.element, this.importer.currListInfo);
21
+ }
22
+ isListElement(elem) {
23
+ const tagName = LevelInfo.getElementTag(elem);
24
+ return tagName === 'OL' || tagName === 'UL';
22
25
  }
23
26
  }
@@ -2,6 +2,6 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare abstract class HtmlListTagImporterBase extends HtmlTagImporterBase {
3
3
  private _ignored;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
7
  }
@@ -10,6 +10,7 @@ export class HtmlListTagImporterBase extends HtmlTagImporterBase {
10
10
  this._ignored = false;
11
11
  }
12
12
  importBefore() {
13
+ this.importer.addCurrLevelParagraphRunIfNeeded();
13
14
  const listIndex = this.importer.listIndex;
14
15
  const parentList = ListUtils.last(this.importer.listInfos);
15
16
  const listLevel = parentList
@@ -23,7 +24,7 @@ export class HtmlListTagImporterBase extends HtmlTagImporterBase {
23
24
  const displayFormat = ParagraphListPropertiesUtils.importDisplayFormatStringByParentListFormat(listFormat, parentList === null || parentList === void 0 ? void 0 : parentList.listFormat, listLevel);
24
25
  this.importer.listInfos.push(new ImportedParagraphListInfo(listIndex, listLevel, listFormat, listFormat == NumberingFormat.Bullet ? NumberingType.Bullet : NumberingType.MultiLevel, displayFormat, null));
25
26
  }
26
- isImportChilds() {
27
+ isImportChildren() {
27
28
  return true;
28
29
  }
29
30
  importAfter() {
@@ -1,12 +1,12 @@
1
1
  import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlPTagImporter extends HtmlTagImporterBase {
3
3
  private listInfo;
4
- private importChilds;
5
- private generateParagraph;
4
+ private importChildren;
6
5
  elementTag(): string;
7
6
  importBefore(): void;
8
- isImportChilds(): boolean;
7
+ isImportChildren(): boolean;
9
8
  importAfter(): void;
9
+ private getListInfo;
10
10
  }
11
11
  export declare class HtmlH1TagImporter extends HtmlPTagImporter {
12
12
  elementTag(): string;
@@ -2,36 +2,39 @@ import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
2
2
  import { DomUtils } from '@devexpress/utils/lib/utils/dom';
3
3
  import { StringUtils } from '@devexpress/utils/lib/utils/string';
4
4
  import { HtmlTagImporterBase } from './base';
5
- import { ListUtils } from '@devexpress/utils/lib/utils/list';
6
5
  export class HtmlPTagImporter extends HtmlTagImporterBase {
7
6
  constructor() {
8
7
  super(...arguments);
9
8
  this.listInfo = null;
10
- this.importChilds = false;
11
- this.generateParagraph = true;
9
+ this.importChildren = false;
12
10
  }
13
11
  elementTag() {
14
12
  return "P";
15
13
  }
16
14
  importBefore() {
15
+ this.importer.addCurrLevelParagraphRunIfNeeded();
16
+ this.element.innerHTML = this.element.innerHTML.trim();
17
17
  let emptyParagraphMatches = this.element.outerHTML.match(/^<([^\s >]+)(\s[^>]*)?>&nbsp;<\/\1>/gi);
18
- if (!(emptyParagraphMatches && emptyParagraphMatches.length)) {
19
- if (StringUtils.trim(DomUtils.getInnerText(this.element))) {
20
- const htmlListInfo = ListUtils.last(this.importer.listInfos);
21
- if (htmlListInfo && !this.element.nextSibling)
22
- this.generateParagraph = false;
23
- else
24
- this.listInfo = htmlListInfo !== null && htmlListInfo !== void 0 ? htmlListInfo : this.importer.paragraphListpropertiesUtils.import(this.element, new FixedInterval(this.importer.currPosition, 0));
25
- }
26
- this.importChilds = true;
18
+ if (!(emptyParagraphMatches === null || emptyParagraphMatches === void 0 ? void 0 : emptyParagraphMatches.length)) {
19
+ this.listInfo = this.getListInfo();
20
+ this.importChildren = true;
27
21
  }
28
22
  }
29
- isImportChilds() {
30
- return this.importChilds;
23
+ isImportChildren() {
24
+ return this.importChildren;
31
25
  }
32
26
  importAfter() {
33
- if (this.generateParagraph)
34
- this.importer.addParagraphRun(this.listInfo, this.element);
27
+ this.importer.addParagraphRun(this.element, this.listInfo);
28
+ }
29
+ getListInfo() {
30
+ var _a, _b;
31
+ if (!StringUtils.trim(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')
32
+ return null;
33
+ if (!this.importer.currListItemLevelInfo)
34
+ return this.importer.paragraphListPropertiesUtils.import(this.element, new FixedInterval(this.importer.currPosition, 0));
35
+ if (!this.importer.currListItemLevelInfo.tagImporter.paragraphWasAddedBefore)
36
+ return this.importer.currListInfo;
37
+ return null;
35
38
  }
36
39
  }
37
40
  export class HtmlH1TagImporter extends HtmlPTagImporter {
@@ -2,7 +2,7 @@ import { HtmlTagImporterBase } from './base';
2
2
  export declare class HtmlPreTagImporter extends HtmlTagImporterBase {
3
3
  elementTag(): string;
4
4
  importBefore(): void;
5
- isImportChilds(): boolean;
5
+ isImportChildren(): boolean;
6
6
  importAfter(): void;
7
7
  shouldPreserveLineBreaksOnChilds(): boolean;
8
8
  }
@@ -5,7 +5,7 @@ export class HtmlPreTagImporter extends HtmlTagImporterBase {
5
5
  }
6
6
  importBefore() {
7
7
  }
8
- isImportChilds() {
8
+ isImportChildren() {
9
9
  return true;
10
10
  }
11
11
  importAfter() {
@@ -3,6 +3,6 @@ export declare class HtmlSpanTagImporter extends HtmlTagImporterBase {
3
3
  private importChilds;
4
4
  elementTag(): string;
5
5
  importBefore(): void;
6
- isImportChilds(): boolean;
6
+ isImportChildren(): boolean;
7
7
  importAfter(): void;
8
8
  }
@@ -20,7 +20,7 @@ export class HtmlSpanTagImporter extends HtmlTagImporterBase {
20
20
  this.importChilds = false;
21
21
  }
22
22
  }
23
- isImportChilds() {
23
+ isImportChildren() {
24
24
  return this.importChilds;
25
25
  }
26
26
  importAfter() {
@@ -5,7 +5,7 @@ export declare class HtmlTableTagImporter extends HtmlTagImporterBase {
5
5
  static tagName: string;
6
6
  elementTag(): string;
7
7
  importBefore(): void;
8
- isImportChilds(): boolean;
8
+ isImportChildren(): boolean;
9
9
  importAfter(): void;
10
10
  private getTableProperties;
11
11
  private getTableWidth;