devexpress-richedit 24.1.1-alpha-24085-0102 → 24.1.3

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 (210) 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 +3 -1
  7. package/bin/webpack.config.js +1 -1
  8. package/dist/dx.richedit.css +1 -0
  9. package/dist/dx.richedit.d.ts +17 -10
  10. package/dist/dx.richedit.js +53229 -51846
  11. package/dist/dx.richedit.min.js +2 -2
  12. package/index.d.ts +1 -1
  13. package/index.js +1 -1
  14. package/lib/client/bars/ribbon.js +2 -1
  15. package/lib/client/bars/rich-edit-ribbon/ribbon-items-data.js +2 -1
  16. package/lib/client/client-rich-edit.js +4 -3
  17. package/lib/client/commands/client-command-manager.js +2 -1
  18. package/lib/client/commands/commands.js +3 -0
  19. package/lib/client/commands/download-document-command.d.ts +3 -0
  20. package/lib/client/commands/download-document-command.js +13 -2
  21. package/lib/client/commands/export-document-command.js +4 -4
  22. package/lib/client/commands/mail-merge-command.js +7 -4
  23. package/lib/client/commands/open-document-command.d.ts +2 -1
  24. package/lib/client/commands/open-document-command.js +17 -12
  25. package/lib/client/default-localization.js +2 -1
  26. package/lib/client/dialogs/finish-and-merge-dialog.js +1 -0
  27. package/lib/client/document-processor/processor.d.ts +9 -2
  28. package/lib/client/document-processor/processor.js +18 -6
  29. package/lib/client/formats/docx/export/data.d.ts +4 -0
  30. package/lib/client/formats/docx/export/data.js +12 -0
  31. package/lib/client/formats/docx/export/exporter.d.ts +2 -0
  32. package/lib/client/formats/docx/export/exporter.js +15 -0
  33. package/lib/client/formats/docx/export/exporters/base/sections.js +5 -0
  34. package/lib/client/formats/docx/export/exporters/note-properties.d.ts +18 -0
  35. package/lib/client/formats/docx/export/exporters/note-properties.js +83 -0
  36. package/lib/client/formats/docx/export/exporters/settings.d.ts +2 -0
  37. package/lib/client/formats/docx/export/exporters/settings.js +11 -0
  38. package/lib/client/formats/docx/export/exporters/sub-document/base-sub-document.d.ts +15 -1
  39. package/lib/client/formats/docx/export/exporters/sub-document/base-sub-document.js +85 -3
  40. package/lib/client/formats/docx/export/exporters/sub-document/header-footer-sub-document-exporter.d.ts +2 -2
  41. package/lib/client/formats/docx/export/exporters/sub-document/header-footer-sub-document-exporter.js +2 -2
  42. package/lib/client/formats/docx/export/exporters/sub-document/main-sub-document.d.ts +2 -2
  43. package/lib/client/formats/docx/export/exporters/sub-document/main-sub-document.js +2 -2
  44. package/lib/client/formats/docx/export/exporters/sub-document/note-sub-document-exporter.d.ts +37 -0
  45. package/lib/client/formats/docx/export/exporters/sub-document/note-sub-document-exporter.js +71 -0
  46. package/lib/client/formats/docx/export/exporters/sub-document/text-box-content-exporter.d.ts +2 -2
  47. package/lib/client/formats/docx/export/exporters/sub-document/text-box-content-exporter.js +2 -2
  48. package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-properties-destination.d.ts +16 -0
  49. package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-properties-destination.js +48 -0
  50. package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-reference-destination.d.ts +5 -0
  51. package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-reference-destination.js +9 -0
  52. package/lib/client/formats/docx/import/destination/notes/endnotes/endnotes-destination.d.ts +5 -0
  53. package/lib/client/formats/docx/import/destination/notes/endnotes/endnotes-destination.js +39 -0
  54. package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-properties-destination.d.ts +18 -0
  55. package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-properties-destination.js +49 -0
  56. package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-reference-destination.d.ts +5 -0
  57. package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-reference-destination.js +9 -0
  58. package/lib/client/formats/docx/import/destination/notes/footnotes/footnotes-destination.d.ts +5 -0
  59. package/lib/client/formats/docx/import/destination/notes/footnotes/footnotes-destination.js +39 -0
  60. package/lib/client/formats/docx/import/destination/notes/note-destination.d.ts +18 -0
  61. package/lib/client/formats/docx/import/destination/notes/note-destination.js +45 -0
  62. package/lib/client/formats/docx/import/destination/notes/note-properties-destination.d.ts +32 -0
  63. package/lib/client/formats/docx/import/destination/notes/note-properties-destination.js +81 -0
  64. package/lib/client/formats/docx/import/destination/notes/note-reference-destination.d.ts +8 -0
  65. package/lib/client/formats/docx/import/destination/notes/note-reference-destination.js +21 -0
  66. package/lib/client/formats/docx/import/destination/notes/note-self-reference-destination.d.ts +5 -0
  67. package/lib/client/formats/docx/import/destination/notes/note-self-reference-destination.js +12 -0
  68. package/lib/client/formats/docx/import/destination/notes/note-separator-destination.d.ts +8 -0
  69. package/lib/client/formats/docx/import/destination/notes/note-separator-destination.js +20 -0
  70. package/lib/client/formats/docx/import/destination/paragraph-properties/paragraph-numbering-reference-destination.js +1 -1
  71. package/lib/client/formats/docx/import/destination/runs/run-destination.js +11 -5
  72. package/lib/client/formats/docx/import/destination/section/section-destination.js +5 -2
  73. package/lib/client/formats/docx/import/destination/settings/settings.js +4 -0
  74. package/lib/client/formats/docx/import/importer.d.ts +2 -0
  75. package/lib/client/formats/docx/import/importer.js +26 -0
  76. package/lib/client/formats/docx/import/importers/character-importer.d.ts +3 -0
  77. package/lib/client/formats/docx/import/importers/character-importer.js +12 -1
  78. package/lib/client/formats/docx/import/importers/end-notes-importer.d.ts +3 -4
  79. package/lib/client/formats/docx/import/importers/end-notes-importer.js +8 -3
  80. package/lib/client/formats/docx/import/importers/foot-notes-importer.d.ts +3 -5
  81. package/lib/client/formats/docx/import/importers/foot-notes-importer.js +8 -5
  82. package/lib/client/formats/docx/import/importers/notes-importer.d.ts +8 -0
  83. package/lib/client/formats/docx/import/importers/notes-importer.js +7 -0
  84. package/lib/client/formats/docx/translation-table/translation-tables.d.ts +7 -0
  85. package/lib/client/formats/docx/translation-table/translation-tables.js +27 -0
  86. package/lib/client/formats/docx/utils/constants.d.ts +2 -0
  87. package/lib/client/formats/docx/utils/constants.js +2 -0
  88. package/lib/client/model-api/formats/enum.d.ts +1 -0
  89. package/lib/client/model-api/formats/enum.js +1 -0
  90. package/lib/client/model-api/formats/exporter.d.ts +3 -4
  91. package/lib/client/model-api/formats/exporter.js +9 -6
  92. package/lib/client/model-api/formats/importer.js +2 -0
  93. package/lib/client/model-api/sub-document.d.ts +6 -2
  94. package/lib/client/model-api/sub-document.js +37 -35
  95. package/lib/client/model-api/table/table-borders.d.ts +1 -1
  96. package/lib/client/public/commands/enum.d.ts +1 -0
  97. package/lib/client/public/commands/enum.js +1 -0
  98. package/lib/client/public/document-processor.d.ts +3 -1
  99. package/lib/client/public/document-processor.js +2 -2
  100. package/lib/client/public/ribbon/creator.js +1 -0
  101. package/lib/client/public/ribbon/item-ids.d.ts +1 -0
  102. package/lib/client/public/ribbon/item-ids.js +1 -0
  103. package/lib/client/public/ribbon/items/select-box.d.ts +2 -0
  104. package/lib/client/public/ribbon/items/select-box.js +7 -0
  105. package/lib/client/public/rich-edit.d.ts +2 -1
  106. package/lib/client/public/rich-edit.js +16 -9
  107. package/lib/client/public/utils.d.ts +4 -0
  108. package/lib/client/public/utils.js +15 -0
  109. package/lib/client/ribbon/i-toolbar-item-options.d.ts +1 -0
  110. package/lib/common/canvas/canvas-manager.js +1 -0
  111. package/lib/common/canvas/picture-renderer.d.ts +1 -1
  112. package/lib/common/canvas/renderes/common/document-renderer.d.ts +1 -1
  113. package/lib/common/canvas/renderes/common/document-renderer.js +6 -2
  114. package/lib/common/canvas/renderes/view-manager.js +3 -1
  115. package/lib/common/clipboard-content-inserter.js +2 -1
  116. package/lib/common/commands/client-command.d.ts +3 -1
  117. package/lib/common/commands/client-command.js +2 -0
  118. package/lib/common/commands/document/print-document-on-client-command.js +1 -1
  119. package/lib/common/commands/text/clipboard-commands.js +7 -5
  120. package/lib/common/document-format.d.ts +2 -0
  121. package/lib/common/document-format.js +2 -0
  122. package/lib/common/formats/document-importer-errors.d.ts +3 -1
  123. package/lib/common/formats/document-importer-errors.js +2 -0
  124. package/lib/common/formats/file-name-helper.d.ts +1 -0
  125. package/lib/common/formats/file-name-helper.js +7 -1
  126. package/lib/common/formats/html/export/get-html.d.ts +4 -0
  127. package/lib/common/formats/html/export/get-html.js +12 -0
  128. package/lib/common/formats/html/export/html-builder.d.ts +16 -0
  129. package/lib/common/formats/html/export/html-builder.js +102 -0
  130. package/lib/common/formats/html/export/html-document-exporter.d.ts +13 -0
  131. package/lib/common/formats/html/export/html-document-exporter.js +29 -0
  132. package/lib/common/formats/html/export/html-export.d.ts +37 -0
  133. package/lib/common/{html-export.js → formats/html/export/html-export.js} +226 -289
  134. package/lib/common/formats/html/import/html-document-importer.d.ts +15 -0
  135. package/lib/common/formats/html/import/html-document-importer.js +84 -0
  136. package/lib/common/formats/html/import/html-importer.d.ts +1 -0
  137. package/lib/common/formats/html/import/html-importer.js +34 -9
  138. package/lib/common/formats/html/import/insert-html.d.ts +4 -0
  139. package/lib/common/formats/html/import/insert-html.js +5 -0
  140. package/lib/common/formats/html/import/utils/paragraph-properties-utils.d.ts +1 -0
  141. package/lib/common/formats/html/import/utils/paragraph-properties-utils.js +17 -4
  142. package/lib/common/formats/i-document-exporter.d.ts +14 -0
  143. package/lib/common/formats/rtf/export/exporter.d.ts +1 -1
  144. package/lib/common/formats/rtf/export/exporter.js +1 -1
  145. package/lib/common/formats/rtf/importer-in-subdocument.d.ts +1 -1
  146. package/lib/common/formats/rtf/importer-in-subdocument.js +1 -1
  147. package/lib/common/formats/txt/txt-exporter.js +2 -1
  148. package/lib/common/input-controller.d.ts +2 -1
  149. package/lib/common/input-controller.js +5 -2
  150. package/lib/common/interfaces/i-rich-edit-core.d.ts +2 -0
  151. package/lib/common/layout/main-structures/layout-boxes/layout-anchored-picture-box.d.ts +2 -1
  152. package/lib/common/layout/main-structures/layout-boxes/layout-anchored-picture-box.js +4 -3
  153. package/lib/common/layout/main-structures/layout-boxes/layout-picture-box.d.ts +2 -1
  154. package/lib/common/layout/main-structures/layout-boxes/layout-picture-box.js +5 -4
  155. package/lib/common/layout/main-structures/layout-page.d.ts +1 -0
  156. package/lib/common/layout/main-structures/layout-page.js +5 -2
  157. package/lib/common/layout-formatter/box/generator/box-infos-generator.d.ts +1 -0
  158. package/lib/common/layout-formatter/box/generator/box-infos-generator.js +12 -2
  159. package/lib/common/layout-formatter/floating/page-anchored-object-holder.d.ts +5 -3
  160. package/lib/common/layout-formatter/floating/page-anchored-object-holder.js +7 -4
  161. package/lib/common/layout-formatter/formatter/base-formatter.js +0 -1
  162. package/lib/common/layout-formatter/formatter/main-formatter.js +1 -0
  163. package/lib/common/layout-formatter/managers/formatter-manager.d.ts +6 -2
  164. package/lib/common/layout-formatter/managers/formatter-manager.js +3 -1
  165. package/lib/common/layout-formatter/row/size-engine/row-sizes-manager.js +20 -4
  166. package/lib/common/measurer/measurer.js +2 -1
  167. package/lib/common/model/chunk.d.ts +1 -0
  168. package/lib/common/model/chunk.js +27 -2
  169. package/lib/common/model/document-model.d.ts +4 -0
  170. package/lib/common/model/document-model.js +4 -1
  171. package/lib/common/model/enums.d.ts +3 -1
  172. package/lib/common/model/enums.js +2 -0
  173. package/lib/common/model/footnotes/footnote.d.ts +46 -0
  174. package/lib/common/model/footnotes/footnote.js +100 -0
  175. package/lib/common/model/json/importers/sub-document/json-sub-document-importer.js +3 -3
  176. package/lib/common/model/json/importers/sub-document/run-importers.d.ts +6 -0
  177. package/lib/common/model/json/importers/sub-document/run-importers.js +9 -0
  178. package/lib/common/model/model-checks/position.d.ts +2 -1
  179. package/lib/common/model/model-checks/position.js +11 -2
  180. package/lib/common/model/numbering-lists/numbering-helper.d.ts +2 -1
  181. package/lib/common/model/numbering-lists/numbering-helper.js +3 -0
  182. package/lib/common/model/paragraph/paragraph-style.d.ts +1 -0
  183. package/lib/common/model/paragraph/paragraph-style.js +6 -2
  184. package/lib/common/model/properties-merger/paragraph-properties-merger.js +1 -1
  185. package/lib/common/model/runs/run-base.d.ts +1 -0
  186. package/lib/common/model/runs/simple-runs.d.ts +8 -2
  187. package/lib/common/model/runs/simple-runs.js +12 -6
  188. package/lib/common/model/section/section-properties.d.ts +3 -0
  189. package/lib/common/model/special-characters.d.ts +3 -0
  190. package/lib/common/model/special-characters.js +3 -0
  191. package/lib/common/model/sub-document-infos.d.ts +18 -0
  192. package/lib/common/model/sub-document-infos.js +39 -0
  193. package/lib/common/model/sub-document.d.ts +2 -0
  194. package/lib/common/model/sub-document.js +18 -16
  195. package/lib/common/mouse-handler/touch-handler/touch-handler-state-base.d.ts +1 -0
  196. package/lib/common/mouse-handler/touch-handler/touch-handler-state-base.js +21 -13
  197. package/lib/common/processor.d.ts +2 -0
  198. package/lib/common/rich-edit-core.d.ts +6 -2
  199. package/lib/common/rich-edit-core.js +20 -1
  200. package/lib/common/selection/selection-intervals-info.js +1 -1
  201. package/lib/common/ui/ruler/controls/divisions.js +2 -1
  202. package/lib/common/ui/ruler/controls/indent/first-line.js +4 -3
  203. package/lib/common/ui/ruler/controls/indent/left.js +5 -4
  204. package/lib/common/ui/ruler/ruler.js +2 -1
  205. package/lib/common/utils/_license.d.ts +1 -0
  206. package/lib/common/utils/_license.js +2 -0
  207. package/lib/common/utils/size-utils.d.ts +3 -0
  208. package/lib/common/utils/size-utils.js +17 -4
  209. package/package.json +4 -4
  210. package/lib/common/html-export.d.ts +0 -32
@@ -1,162 +1,52 @@
1
- import { RichEditUnit } from './utils/unit-converter';
2
- import { LayoutPictureBox } from './layout/main-structures/layout-boxes/layout-picture-box';
3
- import { BorderLineStyle } from './model/borders/enums';
4
- import { CharacterProperties } from './model/character/character-properties';
5
- import { CharacterFormattingScript, UnderlineType } from './model/character/enums';
6
- import { ColorHelper } from './model/color/color';
7
- import { Field } from './model/fields/field';
8
- import { NumberingFormat } from './model/numbering-lists/list-level-properties';
9
- import { NumberingType } from './model/numbering-lists/numbering-list';
10
- import { ParagraphAlignment, ParagraphFirstLineIndent, ParagraphLineSpacingType } from './model/paragraph/paragraph-properties';
11
- import { RichUtils } from './model/rich-utils';
12
- import { RunType } from './model/runs/run-type';
13
- import { Table } from './model/tables/main-structures/table';
14
- import { TableCellPropertiesMergerShadingInfo, TableCellVerticalAlignmentMerger } from './model/tables/properties-mergers/table-cell-properties-merger';
15
- import { TablePropertiesMergerBorderHorizontal, TablePropertiesMergerBorderVertical, TablePropertiesMergerCellSpacing, TablePropertiesMergerIndent } from './model/tables/properties-mergers/table-properties-merger';
16
- import { ConditionalTableStyleFormatting, TableCellMergingState, TableCellVerticalAlignment } from './model/tables/secondary-structures/table-base-structures';
17
- import { TableWidthUnitType } from './model/tables/secondary-structures/table-units';
18
- import { HtmlConverter } from './rich-utils/html-converter';
19
1
  import { UnitConverter } from '@devexpress/utils/lib/class/unit-converter';
20
2
  import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
21
3
  import { ColorUtils } from '@devexpress/utils/lib/utils/color';
22
4
  import { EncodeUtils } from '@devexpress/utils/lib/utils/encode';
23
5
  import { SearchUtils } from '@devexpress/utils/lib/utils/search';
24
6
  import { StringUtils } from '@devexpress/utils/lib/utils/string';
25
- export class HtmlBuilder {
26
- constructor() {
27
- this.childElements = [];
28
- this.callbacks = [];
29
- }
30
- _getHtmlString() {
31
- return this.childElements.map(x => {
32
- if (typeof x === 'string')
33
- return x;
34
- return x.outerHTML;
35
- }).join('');
36
- }
37
- isEmpty() {
38
- return this.callbacks.length === 0 && this.childElements.length === 0;
39
- }
40
- clear() {
41
- this._currentElement = null;
42
- this.callbacks = [];
43
- this.childElements = [];
44
- return this;
45
- }
46
- startChild(tagName, namespaceUri) {
47
- const element = (namespaceUri) ? document.createElementNS(namespaceUri, tagName) : document.createElement(tagName);
48
- if (this._currentElement)
49
- this._currentElement.appendChild(element);
50
- else {
51
- this.childElements.push(element);
52
- }
53
- this._currentElement = element;
54
- return this;
55
- }
56
- configure(config) {
57
- config(this._currentElement);
58
- return this;
59
- }
60
- addCallback(callback) {
61
- this.callbacks.push(callback);
62
- }
63
- assignFrom(builder) {
64
- if (!builder)
65
- return this;
66
- if (typeof builder === "string") {
67
- this.addElement(builder);
68
- return this;
69
- }
70
- builder.callbacks.forEach((callback) => {
71
- callback(this);
72
- });
73
- builder.childElements.forEach((el) => {
74
- this.addElement(el);
75
- });
76
- builder.clear();
77
- return this;
78
- }
79
- addElement(element) {
80
- if (!element)
81
- return this;
82
- if (!this._currentElement) {
83
- this.childElements.push(element);
84
- return this;
85
- }
86
- if (typeof element === 'string')
87
- this._currentElement.innerHTML += element;
88
- else if (this._currentElement)
89
- this._currentElement.appendChild(element);
90
- else
91
- this._currentElement = element;
92
- return this;
93
- }
94
- endChild(tagName) {
95
- let currentElement = this._currentElement;
96
- while (currentElement.tagName.toLowerCase() !== tagName.toLowerCase()) {
97
- currentElement = currentElement.parentElement;
98
- }
99
- this._currentElement = currentElement.parentElement;
100
- return this;
101
- }
102
- }
7
+ import { RichEditUnit } from '../../../utils/unit-converter';
8
+ import { LayoutPictureBox } from '../../../layout/main-structures/layout-boxes/layout-picture-box';
9
+ import { BorderLineStyle } from '../../../model/borders/enums';
10
+ import { CharacterProperties } from '../../../model/character/character-properties';
11
+ import { CharacterFormattingScript, UnderlineType } from '../../../model/character/enums';
12
+ import { ColorHelper } from '../../../model/color/color';
13
+ import { Field } from '../../../model/fields/field';
14
+ import { NumberingFormat } from '../../../model/numbering-lists/list-level-properties';
15
+ import { NumberingType } from '../../../model/numbering-lists/numbering-list';
16
+ import { ParagraphAlignment, ParagraphFirstLineIndent, ParagraphLineSpacingType, } from '../../../model/paragraph/paragraph-properties';
17
+ import { RichUtils } from '../../../model/rich-utils';
18
+ import { RunType } from '../../../model/runs/run-type';
19
+ import { Table } from '../../../model/tables/main-structures/table';
20
+ import { TableCellPropertiesMergerShadingInfo, TableCellVerticalAlignmentMerger, } from '../../../model/tables/properties-mergers/table-cell-properties-merger';
21
+ import { TablePropertiesMergerBorderHorizontal, TablePropertiesMergerBorderVertical, TablePropertiesMergerCellSpacing, TablePropertiesMergerIndent, } from '../../../model/tables/properties-mergers/table-properties-merger';
22
+ import { ConditionalTableStyleFormatting, TableCellMergingState, TableCellVerticalAlignment, } from '../../../model/tables/secondary-structures/table-base-structures';
23
+ import { TableWidthUnitType } from '../../../model/tables/secondary-structures/table-units';
24
+ import { HtmlConverter } from '../../../rich-utils/html-converter';
25
+ import { HtmlBuilder } from './html-builder';
26
+ import { isDefined } from '@devexpress/utils/lib/utils/common';
103
27
  export class HtmlExporter {
104
- constructor(control) {
28
+ constructor(exportModelOptions) {
105
29
  this.rangeCopy = null;
106
- this.control = control;
30
+ this.exportModelOptions = exportModelOptions;
107
31
  }
108
- get colorProvider() { return this.control.modelManager.model.colorProvider; }
32
+ get modelManager() { return this.exportModelOptions.modelManager; }
33
+ get colorProvider() { return this.modelManager.model.colorProvider; }
34
+ get unitConverter() { return this.exportModelOptions.uiUnitConverter; }
35
+ get documentRenderer() { return this.exportModelOptions.pictureRenderer; }
36
+ get lastMaxNumPages() { return this.exportModelOptions.lastMaxNumPages; }
37
+ ;
38
+ get pageIndex() { return this.exportModelOptions.pageIndex; }
39
+ ;
109
40
  getHtmlElementsByInterval(model, subDocument, interval, guidLabel) {
110
41
  if (interval.length === 0)
111
42
  return;
112
- const unitConverter = this.control.uiUnitConverter;
113
- const unitTypeToString = unitConverter.getUnits() == RichEditUnit.Centimeter ? "cm" : "in";
43
+ const unitTypeToString = this.unitConverter.getUnits() == RichEditUnit.Centimeter ? "cm" : "in";
114
44
  const iterator = subDocument.getConstRunIterator(interval);
115
45
  let remainLength = interval.length;
116
46
  let currentPosition = interval.start;
117
- const renderer = this.control.viewManager.renderer;
118
47
  let resultBuilder = new HtmlBuilder();
119
- const paragraphsInInterval = subDocument.getParagraphsByInterval(interval);
120
- const paragraphs = [];
121
- for (let i = 0, paragraphInInterval; paragraphInInterval = paragraphsInInterval[i]; i++) {
122
- if (interval.containsWithIntervalEnd(paragraphInInterval.getEndPosition()))
123
- paragraphs.push(paragraphInInterval);
124
- }
125
- const listsInInterval = [];
126
- for (let i = 0, paragraph; paragraph = paragraphs[i]; i++) {
127
- if (paragraph.isInList()) {
128
- const paragraphNumberingListIndex = paragraph.getNumberingListIndex();
129
- const paragraphListLevelIndex = paragraph.getListLevelIndex();
130
- const paragraphStart = paragraph.startLogPosition.value;
131
- const paragraphEnd = paragraph.getEndPosition();
132
- let existingItem = null;
133
- for (let j = 0; j < listsInInterval.length; j++) {
134
- if (listsInInterval[j].numberingListIndex == paragraphNumberingListIndex && listsInInterval[j].listLevelIndex == paragraphListLevelIndex)
135
- existingItem = listsInInterval[j];
136
- }
137
- if (existingItem && (paragraphListLevelIndex == 0 || existingItem.end == paragraphStart
138
- || listsInInterval[listsInInterval.length - 1].listLevelIndex > paragraphListLevelIndex)) {
139
- existingItem.end = paragraphEnd;
140
- }
141
- else {
142
- listsInInterval.push({
143
- numberingListIndex: paragraphNumberingListIndex, listLevelIndex: paragraphListLevelIndex,
144
- start: paragraphStart, end: paragraphEnd
145
- });
146
- }
147
- let listLevelIndex = paragraphListLevelIndex;
148
- while (listLevelIndex > 0) {
149
- let parentItem = null;
150
- for (let j = 0; j < listsInInterval.length; j++) {
151
- if (listsInInterval[j].listLevelIndex == listLevelIndex - 1)
152
- parentItem = listsInInterval[j];
153
- }
154
- if (parentItem)
155
- parentItem.end = paragraphEnd;
156
- listLevelIndex--;
157
- }
158
- }
159
- }
48
+ const paragraphs = this.getParagraphsByInterval(subDocument, interval);
49
+ const lists = this.getListsByParagraphs(paragraphs);
160
50
  let isInsideFieldCode = false;
161
51
  let fieldDeep = 0;
162
52
  let isInsideHyperlink = false;
@@ -166,53 +56,6 @@ export class HtmlExporter {
166
56
  while (iterator.moveNext()) {
167
57
  const tableCell = Table.getTableCellByPosition(subDocument.tables, iterator.currentInterval().start);
168
58
  const isContinueMergingCell = tableCell && tableCell.verticalMerging === TableCellMergingState.Continue;
169
- let listToStartIndex = -1;
170
- const listsToEndIndices = [];
171
- if (!tableCell) {
172
- if (listsInInterval.length) {
173
- const currentPosition = iterator.currentInterval().start;
174
- for (let i = 0; i < listsInInterval.length; i++) {
175
- if (listsInInterval[i].start == currentPosition)
176
- listToStartIndex = i;
177
- if (listsInInterval[i].end == iterator.currentInterval().end)
178
- listsToEndIndices.push(i);
179
- }
180
- if (listToStartIndex < 0 && currentPosition == interval.start) {
181
- const firstParagraph = subDocument.getParagraphByPosition(currentPosition);
182
- if (firstParagraph.getNumberingListIndex() == listsInInterval[0].numberingListIndex)
183
- listToStartIndex = 0;
184
- }
185
- }
186
- if (listToStartIndex > -1) {
187
- const numberingList = model.numberingLists[listsInInterval[listToStartIndex].numberingListIndex];
188
- let listFormatType = "";
189
- switch (numberingList.levels[listsInInterval[listToStartIndex].listLevelIndex].getListLevelProperties().format) {
190
- case NumberingFormat.Bullet:
191
- listFormatType = "disc";
192
- break;
193
- case NumberingFormat.Decimal:
194
- listFormatType = "decimal";
195
- break;
196
- case NumberingFormat.LowerLetter:
197
- listFormatType = "lower-alpha";
198
- break;
199
- case NumberingFormat.UpperLetter:
200
- listFormatType = "upper-alpha";
201
- break;
202
- case NumberingFormat.LowerRoman:
203
- listFormatType = "lower-roman";
204
- break;
205
- case NumberingFormat.UpperRoman:
206
- listFormatType = "upper-roman";
207
- break;
208
- default:
209
- break;
210
- }
211
- resultBuilder
212
- .startChild(numberingList.getListType() != NumberingType.Bullet ? "ol" : "ul")
213
- .configure((e) => e.style.cssText = "list-style-type:" + listFormatType);
214
- }
215
- }
216
59
  const run = iterator.currentRun;
217
60
  const isRunInEmptyParagraph = run.paragraph.length === 1;
218
61
  if (paragraphs.length && (run.getType() != RunType.ParagraphRun || isRunInEmptyParagraph)) {
@@ -221,60 +64,27 @@ export class HtmlExporter {
221
64
  const currentParagraph = paragraphs[paragraphToStartIndex];
222
65
  paragraphs.splice(paragraphToStartIndex, 1);
223
66
  if (tableCell) {
224
- let parentRow = tableCell.parentRow;
225
- let parentTable = parentRow.parentTable;
226
- let paragraphStartPosition = currentParagraph.startLogPosition.value;
227
- if (parentTable.getStartPosition() == paragraphStartPosition) {
228
- if (parentTable.parentCell) {
229
- let parentCell = parentTable.parentCell;
230
- while (parentCell) {
231
- let currentParentRow = parentCell.parentRow;
232
- let currentParentTable = currentParentRow.parentTable;
233
- if (currentParentTable.getStartPosition() == paragraphStartPosition)
234
- resultBuilder
235
- .startChild('table')
236
- .configure((e) => e.style.cssText = this.getTableStyle(model, currentParentTable))
237
- .startChild('tbody');
238
- if (currentParentRow.getStartPosition() == paragraphStartPosition) {
239
- resultBuilder.startChild('tr');
240
- if (currentParentRow.gridBefore > 0)
241
- resultBuilder
242
- .startChild('td')
243
- .configure((el) => {
244
- el.style.cssText = "mso-cell-special:placeholder";
245
- el.setAttribute('colspan', currentParentRow.gridBefore.toString());
246
- el.innerHTML = "&nbsp;";
247
- })
248
- .endChild('td');
249
- }
250
- if (parentCell.startParagraphPosition.value == paragraphStartPosition) {
251
- resultBuilder
252
- .startChild('td')
253
- .configure((el) => {
254
- el.style.cssText = this.getCellStyle(model, parentCell);
255
- if (parentCell.columnSpan > 1) {
256
- el.setAttribute('colspan', parentCell.columnSpan.toString());
257
- }
258
- });
259
- }
260
- parentCell = currentParentTable.parentCell;
261
- }
262
- }
67
+ const row = tableCell.parentRow;
68
+ const table = row.parentTable;
69
+ const paragraphStartPosition = currentParagraph.startLogPosition.value;
70
+ if (table.getStartPosition() == paragraphStartPosition) {
71
+ if (table.parentCell)
72
+ this.addParentTableRecursively(model, resultBuilder, table.parentCell, paragraphStartPosition);
263
73
  resultBuilder
264
74
  .startChild('table')
265
75
  .configure((el) => {
266
- el.style.cssText = this.getTableStyle(model, parentTable);
76
+ el.style.cssText = this.getTableStyle(model, table);
267
77
  })
268
78
  .startChild('tbody');
269
79
  }
270
- if (parentRow.getStartPosition() == paragraphStartPosition) {
80
+ if (row.getStartPosition() == paragraphStartPosition) {
271
81
  resultBuilder.startChild('tr');
272
- if (parentRow.gridBefore > 0) {
82
+ if (row.gridBefore > 0) {
273
83
  resultBuilder
274
84
  .startChild('td')
275
85
  .configure((el) => {
276
86
  el.style.cssText = "mso-cell-special:placeholder";
277
- el.setAttribute('colspan', parentRow.gridBefore.toString());
87
+ el.setAttribute('colspan', row.gridBefore.toString());
278
88
  el.innerHTML = "&nbsp;";
279
89
  })
280
90
  .endChild('td');
@@ -283,18 +93,18 @@ export class HtmlExporter {
283
93
  if (tableCell.startParagraphPosition.value == paragraphStartPosition && !isContinueMergingCell) {
284
94
  let rowSpan = 1;
285
95
  if (tableCell.verticalMerging === TableCellMergingState.Restart) {
286
- let rowIndex = parentTable.rows.indexOf(parentRow);
287
- let cellIndex = parentRow.cells.indexOf(tableCell);
288
- for (let i = rowIndex + 1, row; row = parentTable.rows[i]; i++) {
96
+ let rowIndex = table.rows.indexOf(row);
97
+ let cellIndex = row.cells.indexOf(tableCell);
98
+ for (let i = rowIndex + 1, row; row = table.rows[i]; i++) {
289
99
  let nextRowCellIndex = cellIndex;
290
- if (row.cells.length != parentRow.cells.length) {
100
+ if (row.cells.length != row.cells.length) {
291
101
  let extraCellsCount = 0;
292
- let isNextRowLonger = row.cells.length > parentRow.cells.length;
293
- let shorterRow = isNextRowLonger ? parentRow : row;
102
+ let isNextRowLonger = row.cells.length > row.cells.length;
103
+ let shorterRow = isNextRowLonger ? row : row;
294
104
  for (let j = 0; (j < cellIndex) && (j < shorterRow.cells.length); j++) {
295
105
  extraCellsCount += shorterRow.cells[j].columnSpan - 1;
296
106
  if (!isNextRowLonger)
297
- extraCellsCount -= parentRow.cells[j].columnSpan - 1;
107
+ extraCellsCount -= row.cells[j].columnSpan - 1;
298
108
  }
299
109
  nextRowCellIndex += (isNextRowLonger ? 1 : -1) * extraCellsCount;
300
110
  }
@@ -316,13 +126,14 @@ export class HtmlExporter {
316
126
  });
317
127
  }
318
128
  }
129
+ this.startList(model, subDocument, interval, resultBuilder, lists, iterator.currentInterval().start);
319
130
  if (!isContinueMergingCell) {
320
131
  const maskedParagraphProperties = currentParagraph.getParagraphMergedProperties();
321
132
  let paragraphStyle = "";
322
133
  const firstLineIndentType = maskedParagraphProperties.firstLineIndentType;
323
134
  if (firstLineIndentType != ParagraphFirstLineIndent.None) {
324
135
  paragraphStyle += "text-indent: " + (firstLineIndentType == ParagraphFirstLineIndent.Hanging ? "-" : "") +
325
- unitConverter.twipsToUI(maskedParagraphProperties.firstLineIndent) + unitTypeToString + ";";
136
+ this.unitConverter.twipsToUI(maskedParagraphProperties.firstLineIndent) + unitTypeToString + ";";
326
137
  }
327
138
  if (maskedParagraphProperties.alignment !== undefined) {
328
139
  paragraphStyle += "text-align: ";
@@ -349,7 +160,7 @@ export class HtmlExporter {
349
160
  }
350
161
  }
351
162
  if (maskedParagraphProperties.lineSpacingType != ParagraphLineSpacingType.Single) {
352
- const lineSpacingInUI = unitConverter.twipsToUI(maskedParagraphProperties.lineSpacing) + unitTypeToString + ";";
163
+ const lineSpacingInUI = this.unitConverter.twipsToUI(maskedParagraphProperties.lineSpacing) + unitTypeToString + ";";
353
164
  paragraphStyle += "line-height: ";
354
165
  switch (maskedParagraphProperties.lineSpacingType) {
355
166
  case ParagraphLineSpacingType.AtLeast:
@@ -374,11 +185,11 @@ export class HtmlExporter {
374
185
  if (ColorUtils.getAlpha(maskedParagraphProperties.shadingInfo.getActualColor(this.colorProvider)) > 0)
375
186
  paragraphStyle += "background: " + ColorHelper.getCssStringInternal(maskedParagraphProperties.shadingInfo.getActualColor(this.colorProvider)) + ";";
376
187
  if (maskedParagraphProperties.leftIndent)
377
- paragraphStyle += "margin-left: " + unitConverter.twipsToUI(maskedParagraphProperties.leftIndent) + unitTypeToString + ";";
188
+ paragraphStyle += "margin-left: " + this.unitConverter.twipsToUI(maskedParagraphProperties.leftIndent) + unitTypeToString + ";";
378
189
  if (maskedParagraphProperties.rightIndent)
379
- paragraphStyle += "margin-right: " + unitConverter.twipsToUI(maskedParagraphProperties.rightIndent) + unitTypeToString + ";";
380
- paragraphStyle += "margin-top: " + unitConverter.twipsToUI(maskedParagraphProperties.spacingBefore) + unitTypeToString + ";";
381
- paragraphStyle += "margin-bottom: " + unitConverter.twipsToUI(maskedParagraphProperties.spacingAfter) + unitTypeToString + ";";
190
+ paragraphStyle += "margin-right: " + this.unitConverter.twipsToUI(maskedParagraphProperties.rightIndent) + unitTypeToString + ";";
191
+ paragraphStyle += "margin-top: " + this.unitConverter.twipsToUI(maskedParagraphProperties.spacingBefore) + unitTypeToString + ";";
192
+ paragraphStyle += "margin-bottom: " + this.unitConverter.twipsToUI(maskedParagraphProperties.spacingAfter) + unitTypeToString + ";";
382
193
  const topBorderStyle = this.getBorderCssString(maskedParagraphProperties.topBorder);
383
194
  if (topBorderStyle)
384
195
  paragraphStyle += "border-top:" + topBorderStyle + ";";
@@ -396,17 +207,15 @@ export class HtmlExporter {
396
207
  paragraphStyle += HtmlConverter.getCssRules(charProps, charProps.textColor.toRgb(this.colorProvider), false, false, false)
397
208
  .join(";");
398
209
  }
399
- if (currentParagraph.isInList() && !tableCell)
210
+ if (currentParagraph.isInList())
400
211
  resultBuilder.startChild('li');
401
212
  resultBuilder
402
213
  .startChild('p')
403
214
  .configure((e) => {
404
- if (paragraphStyle) {
215
+ if (paragraphStyle)
405
216
  e.style.cssText = paragraphStyle;
406
- }
407
- if (isRunInEmptyParagraph) {
217
+ if (isRunInEmptyParagraph)
408
218
  e.innerHTML = "&nbsp;";
409
- }
410
219
  });
411
220
  }
412
221
  }
@@ -418,6 +227,10 @@ export class HtmlExporter {
418
227
  case RunType.ParagraphRun:
419
228
  if (!isContinueMergingCell) {
420
229
  html.addCallback((builder) => builder.endChild('p'));
230
+ if (run.paragraph.isInList()) {
231
+ html.addCallback((builder) => builder.endChild('li'));
232
+ html.addCallback((builder) => this.endList(model, builder, lists, iterator.currentInterval().end));
233
+ }
421
234
  let paragraphEndPosition = run.paragraph.getEndPosition();
422
235
  if (tableCell) {
423
236
  let parentRow = tableCell.parentRow;
@@ -453,10 +266,11 @@ export class HtmlExporter {
453
266
  case RunType.AnchoredPictureRun: {
454
267
  const picRun = run;
455
268
  const charMergProps = run.getCharacterMergedProperties();
456
- const pictureBox = new LayoutPictureBox(charMergProps, charMergProps.getLayoutColorInfo(this.colorProvider), picRun.cacheInfo, picRun.getActualSize().applyConverter(UnitConverter.twipsToPixels));
269
+ const pictureBox = new LayoutPictureBox(charMergProps, charMergProps.getLayoutColorInfo(this.colorProvider), picRun.cacheInfo, picRun.getActualSize().applyConverter(UnitConverter.twipsToPixels), picRun.info.nonVisualDrawingProperties.description);
270
+ const { cacheInfo, hyperlinkTip, description } = pictureBox;
457
271
  innerHtml
458
272
  .clear()
459
- .addElement(renderer.renderPicture(pictureBox));
273
+ .addElement(this.documentRenderer.renderPictureBoxContent(pictureBox.createSize(), cacheInfo, hyperlinkTip, description));
460
274
  break;
461
275
  }
462
276
  case RunType.InlineTextBoxRun:
@@ -507,14 +321,14 @@ export class HtmlExporter {
507
321
  let currentField = subDocument.fields[Field.normedBinaryIndexOf(subDocument.fields, currentPosition)];
508
322
  if (currentField) {
509
323
  let codeText = StringUtils.trim(subDocument.getText(currentField.getCodeInterval()).split("\\")[0]).toUpperCase();
510
- if (codeText == "NUMPAGES")
324
+ if (codeText == "NUMPAGES" && isDefined(this.lastMaxNumPages))
511
325
  innerHtml
512
326
  .clear()
513
- .addElement(this.control.layout.lastMaxNumPages.toString());
514
- else if (codeText == "PAGE")
327
+ .addElement(this.lastMaxNumPages.toString());
328
+ else if (codeText == "PAGE" && isDefined(this.pageIndex))
515
329
  innerHtml
516
330
  .clear()
517
- .addElement((this.control.selection.pageIndex + 1).toString());
331
+ .addElement((this.pageIndex + 1).toString());
518
332
  }
519
333
  break;
520
334
  default:
@@ -540,7 +354,7 @@ export class HtmlExporter {
540
354
  }
541
355
  if (html.isEmpty() && !innerHtml.isEmpty()) {
542
356
  const characterProperties = run.getCharacterMergedProperties();
543
- const boxStyle = "white-space:pre;" + HtmlConverter.getCssRules(characterProperties, characterProperties.textColor.toRgb(this.colorProvider), run.getType() == RunType.TextRun, false, false).
357
+ const boxStyle = HtmlConverter.getCssRules(characterProperties, characterProperties.textColor.toRgb(this.colorProvider), run.getType() == RunType.TextRun, false, false).
544
358
  join(";");
545
359
  html
546
360
  .startChild('span')
@@ -594,22 +408,18 @@ export class HtmlExporter {
594
408
  }
595
409
  }
596
410
  resultBuilder.assignFrom(html);
597
- if (listsToEndIndices.length) {
598
- for (let i = listsToEndIndices.length - 1; i >= 0; i--)
599
- resultBuilder.endChild(model.numberingLists[listsInInterval[listsToEndIndices[i]].numberingListIndex].getListType() != NumberingType.Bullet ? "ol" : "ul");
600
- }
601
411
  currentPosition += length;
602
412
  remainLength -= length;
603
413
  }
604
- if (/^<td[^>]*>/gi.test(resultBuilder._getHtmlString())) {
414
+ if (/^<td[^>]*>/gi.test(resultBuilder.getHtmlString())) {
605
415
  const builder = new HtmlBuilder();
606
416
  builder.startChild('tr');
607
417
  builder.assignFrom(resultBuilder);
608
418
  resultBuilder = builder;
609
419
  }
610
- if (/<\/td>$/gi.test(resultBuilder._getHtmlString()))
420
+ if (/<\/td>$/gi.test(resultBuilder.getHtmlString()))
611
421
  resultBuilder.endChild("tr");
612
- if (/^<tr[^>]*>/gi.test(resultBuilder._getHtmlString())) {
422
+ if (/^<tr[^>]*>/gi.test(resultBuilder.getHtmlString())) {
613
423
  const builder = new HtmlBuilder();
614
424
  builder
615
425
  .startChild('table')
@@ -620,7 +430,7 @@ export class HtmlExporter {
620
430
  .assignFrom(resultBuilder);
621
431
  resultBuilder = builder;
622
432
  }
623
- if (/<\/tr>$/gi.test(resultBuilder._getHtmlString()))
433
+ if (/<\/tr>$/gi.test(resultBuilder.getHtmlString()))
624
434
  resultBuilder
625
435
  .endChild('tbody')
626
436
  .endChild('table');
@@ -634,32 +444,159 @@ export class HtmlExporter {
634
444
  .endChild('span');
635
445
  return resultBuilder;
636
446
  }
447
+ getParagraphsByInterval(subDocument, interval) {
448
+ const paragraphsInInterval = subDocument.getParagraphsByInterval(interval);
449
+ const paragraphs = [];
450
+ for (let i = 0, paragraphInInterval; paragraphInInterval = paragraphsInInterval[i]; i++) {
451
+ if (interval.containsWithIntervalEnd(paragraphInInterval.getEndPosition()))
452
+ paragraphs.push(paragraphInInterval);
453
+ }
454
+ return paragraphs;
455
+ }
456
+ getListsByParagraphs(paragraphs) {
457
+ const listsInInterval = [];
458
+ for (let i = 0, paragraph; paragraph = paragraphs[i]; i++) {
459
+ if (paragraph.isInList()) {
460
+ const paragraphNumberingListIndex = paragraph.getNumberingListIndex();
461
+ const paragraphListLevelIndex = paragraph.getListLevelIndex();
462
+ const paragraphStart = paragraph.startLogPosition.value;
463
+ const paragraphEnd = paragraph.getEndPosition();
464
+ let existingItem = null;
465
+ for (let j = 0; j < listsInInterval.length; j++) {
466
+ if (listsInInterval[j].numberingListIndex === paragraphNumberingListIndex
467
+ && listsInInterval[j].listLevelIndex === paragraphListLevelIndex) {
468
+ existingItem = listsInInterval[j];
469
+ }
470
+ }
471
+ if (existingItem && (paragraphListLevelIndex === 0 || existingItem.end == paragraphStart
472
+ || listsInInterval[listsInInterval.length - 1].listLevelIndex > paragraphListLevelIndex)) {
473
+ existingItem.end = paragraphEnd;
474
+ }
475
+ else {
476
+ listsInInterval.push({
477
+ numberingListIndex: paragraphNumberingListIndex,
478
+ listLevelIndex: paragraphListLevelIndex,
479
+ start: paragraphStart,
480
+ end: paragraphEnd,
481
+ });
482
+ }
483
+ let listLevelIndex = paragraphListLevelIndex;
484
+ while (listLevelIndex > 0) {
485
+ let parentItem = null;
486
+ for (let j = 0; j < listsInInterval.length; j++) {
487
+ if (listsInInterval[j].listLevelIndex == listLevelIndex - 1)
488
+ parentItem = listsInInterval[j];
489
+ }
490
+ if (parentItem)
491
+ parentItem.end = paragraphEnd;
492
+ listLevelIndex--;
493
+ }
494
+ }
495
+ }
496
+ return listsInInterval;
497
+ }
498
+ addParentTableRecursively(model, builder, parentCell, paragraphStartPosition) {
499
+ const parentRow = parentCell.parentRow;
500
+ const parentTable = parentRow.parentTable;
501
+ if (parentTable.parentCell)
502
+ this.addParentTableRecursively(model, builder, parentTable.parentCell, paragraphStartPosition);
503
+ if (parentTable.getStartPosition() === paragraphStartPosition) {
504
+ builder
505
+ .startChild('table')
506
+ .configure(e => e.style.cssText = this.getTableStyle(model, parentTable))
507
+ .startChild('tbody');
508
+ }
509
+ if (parentRow.getStartPosition() === paragraphStartPosition) {
510
+ builder.startChild('tr');
511
+ if (parentRow.gridBefore > 0) {
512
+ builder
513
+ .startChild('td')
514
+ .configure(el => {
515
+ el.style.cssText = 'mso-cell-special:placeholder';
516
+ el.setAttribute('colspan', parentRow.gridBefore.toString());
517
+ el.innerHTML = '&nbsp;';
518
+ })
519
+ .endChild('td');
520
+ }
521
+ }
522
+ if (parentCell.startParagraphPosition.value === paragraphStartPosition) {
523
+ builder
524
+ .startChild('td')
525
+ .configure((el) => {
526
+ el.style.cssText = this.getCellStyle(model, parentCell);
527
+ if (parentCell.columnSpan > 1)
528
+ el.setAttribute('colspan', parentCell.columnSpan.toString());
529
+ });
530
+ }
531
+ }
532
+ startList(model, subDocument, interval, builder, lists, position) {
533
+ if (!lists.length)
534
+ return;
535
+ let listIndex = lists.findIndex((list) => list.start === position);
536
+ if (listIndex < 0 && position === interval.start) {
537
+ const firstParagraph = subDocument.getParagraphByPosition(position);
538
+ if (firstParagraph.getNumberingListIndex() === lists[0].numberingListIndex)
539
+ listIndex = 0;
540
+ }
541
+ if (listIndex > -1) {
542
+ const numberingList = model.numberingLists[lists[listIndex].numberingListIndex];
543
+ const numberingListFormat = numberingList.levels[lists[listIndex].listLevelIndex].getListLevelProperties().format;
544
+ const numberingListType = numberingList.getListType();
545
+ let listFormatType = "";
546
+ switch (numberingListFormat) {
547
+ case NumberingFormat.Bullet:
548
+ listFormatType = "disc";
549
+ break;
550
+ case NumberingFormat.Decimal:
551
+ listFormatType = "decimal";
552
+ break;
553
+ case NumberingFormat.LowerLetter:
554
+ listFormatType = "lower-alpha";
555
+ break;
556
+ case NumberingFormat.UpperLetter:
557
+ listFormatType = "upper-alpha";
558
+ break;
559
+ case NumberingFormat.LowerRoman:
560
+ listFormatType = "lower-roman";
561
+ break;
562
+ case NumberingFormat.UpperRoman:
563
+ listFormatType = "upper-roman";
564
+ break;
565
+ default:
566
+ break;
567
+ }
568
+ builder
569
+ .startChild(numberingListType !== NumberingType.Bullet ? "ol" : "ul")
570
+ .configure((e) => e.style.cssText = "list-style-type:" + listFormatType);
571
+ }
572
+ }
573
+ endList(model, builder, lists, endPosition) {
574
+ for (let i = lists.length - 1; i >= 0; i--) {
575
+ if (lists[i].end === endPosition) {
576
+ const listType = model.numberingLists[lists[i].numberingListIndex].getListType();
577
+ lists.splice(i, 1);
578
+ builder.endChild(listType != NumberingType.Bullet ? "ol" : "ul");
579
+ }
580
+ }
581
+ }
637
582
  getHtmlText(text) {
638
- let result = new HtmlBuilder();
583
+ const result = new HtmlBuilder();
639
584
  for (let i = 0; i < text.length; i++) {
640
585
  const char = text.charAt(i);
641
- if (char == RichUtils.specialCharacters.PageBreak)
642
- result.addCallback((builder) => {
643
- builder
644
- .startChild('br')
645
- .configure((el) => {
646
- el.style.cssText = "page-break-before:always";
647
- })
648
- .endChild('br');
649
- });
650
- else if (char == RichUtils.specialCharacters.LineBreak)
651
- result.addCallback((builder) => {
652
- builder
653
- .startChild('br')
654
- .endChild('br');
655
- });
656
- else {
657
- result.addCallback((builder) => {
658
- builder.configure((el) => {
659
- el.innerHTML += EncodeUtils.encodeHtml(text.substr(i));
586
+ switch (char) {
587
+ case RichUtils.specialCharacters.PageBreak:
588
+ case RichUtils.specialCharacters.ColumnBreak:
589
+ case RichUtils.specialCharacters.SectionMark:
590
+ result.addCallback((builder) => builder.addBreak("break-before:always"));
591
+ break;
592
+ case RichUtils.specialCharacters.LineBreak:
593
+ result.addCallback((builder) => builder.addBreak());
594
+ break;
595
+ default:
596
+ result.addCallback((builder) => {
597
+ builder.configure((el) => el.innerHTML += EncodeUtils.encodeHtml(text.substring(i)));
660
598
  });
661
- });
662
- break;
599
+ return result;
663
600
  }
664
601
  }
665
602
  return result;
@@ -693,7 +630,7 @@ export class HtmlExporter {
693
630
  default:
694
631
  break;
695
632
  }
696
- const rgba = this.control.modelManager.model.colorProvider.getRgbaFromModelColor(borderInfo.color);
633
+ const rgba = this.colorProvider.getRgbaFromModelColor(borderInfo.color);
697
634
  if (ColorUtils.getAlpha(rgba) > 0)
698
635
  borderStyle += " " + ColorHelper.getCssStringInternal(rgba);
699
636
  }