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
@@ -0,0 +1,15 @@
1
+ import { RichOptions } from "../../../model/options/rich-options";
2
+ import { MaskedCharacterPropertiesBundle } from "../../../rich-utils/properties-bundle";
3
+ import { FormatImportCallback, FormatImportReject, IDocumentImporter } from "../../i-document-importer";
4
+ export declare class HtmlDocumentImporter implements IDocumentImporter {
5
+ private documentModel;
6
+ private modelManager;
7
+ private formatImagesImporter;
8
+ importFromFile(blob: Blob, modelOptions: RichOptions, callback: FormatImportCallback, reject: FormatImportReject): void;
9
+ importFromString(text: string, modelOptions: RichOptions, callback: FormatImportCallback, reject: FormatImportReject, charPropsBundle?: MaskedCharacterPropertiesBundle): void;
10
+ private init;
11
+ private fillModel;
12
+ private createMaskedCharacterPropertiesBundle;
13
+ private createContainer;
14
+ private removeLastParagraph;
15
+ }
@@ -0,0 +1,84 @@
1
+ import { EmptyBatchUpdatableObject } from "@devexpress/utils/lib/class/batch-updatable";
2
+ import { ModelChecker } from "../../../model/model-checks/check-all";
3
+ import { ModelCreatorOptions } from "../../../model/creator/options";
4
+ import { ModelCreator } from "../../../model/creator/creator";
5
+ import { MaskedCharacterProperties } from "../../../model/character/character-properties";
6
+ import { SubDocumentPosition } from "../../../model/sub-document";
7
+ import { ClientModelManager } from "../../../model-manager";
8
+ import { MaskedCharacterPropertiesBundle } from "../../../rich-utils/properties-bundle";
9
+ import { Measurer } from "../../../measurer/measurer";
10
+ import { DocumentImporterErrors } from "../../document-importer-errors";
11
+ import { FormatImagesImporter } from "../../utils/images-import";
12
+ import { HtmlImporter } from "./html-importer";
13
+ export class HtmlDocumentImporter {
14
+ importFromFile(blob, modelOptions, callback, reject) {
15
+ this.init(modelOptions);
16
+ const reader = new FileReader();
17
+ reader.onload = () => {
18
+ this.importFromString(reader.result, modelOptions, callback, reject);
19
+ };
20
+ reader.onerror = (_ev) => {
21
+ reject(DocumentImporterErrors.HtmlFileReaderError);
22
+ };
23
+ reader.readAsText(blob);
24
+ }
25
+ importFromString(text, modelOptions, callback, reject, charPropsBundle) {
26
+ this.init(modelOptions);
27
+ try {
28
+ this.fillModel(text, charPropsBundle);
29
+ if (!new ModelChecker(this.documentModel).checkAll())
30
+ throw new Error();
31
+ }
32
+ catch (err) {
33
+ reject(DocumentImporterErrors.HtmlImportError);
34
+ return;
35
+ }
36
+ callback(this.documentModel, this.formatImagesImporter);
37
+ }
38
+ init(modelOptions) {
39
+ const options = new ModelCreatorOptions();
40
+ options.addSection = true;
41
+ options.addParagraph = true;
42
+ this.formatImagesImporter = new FormatImagesImporter();
43
+ this.documentModel = new ModelCreator(options).createModel(modelOptions).fillModel();
44
+ this.modelManager = new ClientModelManager(this.documentModel, modelOptions, new EmptyBatchUpdatableObject());
45
+ }
46
+ fillModel(text, charPropsBundle) {
47
+ const container = document.body.appendChild(this.createContainer());
48
+ try {
49
+ container.innerHTML = HtmlImporter.convertHtml(text);
50
+ charPropsBundle = charPropsBundle || this.createMaskedCharacterPropertiesBundle();
51
+ const measurer = new Measurer('');
52
+ const position = new SubDocumentPosition(this.documentModel.mainSubDocument, 0);
53
+ const initElements = container.childNodes;
54
+ new HtmlImporter(this.modelManager, measurer, position, initElements, charPropsBundle).import();
55
+ this.removeLastParagraph();
56
+ }
57
+ finally {
58
+ document.body.removeChild(container);
59
+ }
60
+ }
61
+ createMaskedCharacterPropertiesBundle() {
62
+ const maskedCharacterProperties = MaskedCharacterProperties.createDefault(this.documentModel);
63
+ const style = this.modelManager.model.stylesManager.getDefaultCharacterStyle();
64
+ return new MaskedCharacterPropertiesBundle(maskedCharacterProperties, style);
65
+ }
66
+ createContainer() {
67
+ const container = document.createElement('DIV');
68
+ container.id = 'import-container';
69
+ container.style.width = '0';
70
+ container.style.height = '0';
71
+ container.style.overflow = 'hidden';
72
+ return container;
73
+ }
74
+ removeLastParagraph() {
75
+ const lastParagraph = this.documentModel.mainSubDocument.getLastParagraph();
76
+ if (lastParagraph.length > 1)
77
+ return;
78
+ const section = this.documentModel.getSectionByPosition(lastParagraph.startLogPosition.value);
79
+ const lastChunk = this.documentModel.mainSubDocument.getLastChunk();
80
+ this.documentModel.mainSubDocument.paragraphs.pop();
81
+ section.setLength(this.documentModel.mainSubDocument, section.getLength() - lastParagraph.length);
82
+ lastChunk.removeRun(lastChunk.textRuns.length - 1);
83
+ }
84
+ }
@@ -62,6 +62,7 @@ export declare class HtmlImporter {
62
62
  getLastImportedRun(): RunInfo;
63
63
  columnSize(): Size;
64
64
  static convertHtml(html: string): string;
65
+ private static extractBodyContent;
65
66
  private static MapMissTablePropertiesByTagNames;
66
67
  private static MapShorthandProperty;
67
68
  }
@@ -177,7 +177,7 @@ export class HtmlImporter {
177
177
  const missTag = HtmlImporter.MapMissTablePropertiesByTagNames[ListUtils.last(this.levelInfo).tagImporter.elementTag()];
178
178
  ListUtils.forEach(this.currElementChilds, (childElement) => {
179
179
  const childElemStyle = this.getStyles(childElement);
180
- if (!childElemStyle)
180
+ if (!Object.keys(childElemStyle).length)
181
181
  return;
182
182
  for (var prop in this.getStyles(element)) {
183
183
  if (missTag && /^(border|background|marginLeft)/gi.test(prop))
@@ -189,13 +189,24 @@ export class HtmlImporter {
189
189
  });
190
190
  }
191
191
  getStyles(element) {
192
- var _a, _b, _c;
193
- return (_c = (_b = (_a = element.getAttribute) === null || _a === void 0 ? void 0 : _a.call(element, 'style')) === null || _b === void 0 ? void 0 : _b.split(';')) === null || _c === void 0 ? void 0 : _c.reduce((a, c) => {
194
- if (c) {
195
- const par = c.trim().split(':');
196
- a[par[0].trim()] = par[1].trim();
197
- }
198
- return a;
192
+ var _a;
193
+ const styleStr = (_a = element.getAttribute) === null || _a === void 0 ? void 0 : _a.call(element, 'style');
194
+ if (!styleStr)
195
+ return {};
196
+ const urlRegExp = new RegExp('url\\(.*?\\)', 'gi');
197
+ const urlKey = '$URL';
198
+ const urlValues = styleStr.match(urlRegExp);
199
+ return styleStr
200
+ .replace(urlRegExp, urlKey)
201
+ .split(';')
202
+ .reduceRight((res, style) => {
203
+ if (!style)
204
+ return res;
205
+ const colonIndex = style.indexOf(':');
206
+ const key = style.substring(0, colonIndex).trim();
207
+ const value = style.substring(colonIndex + 1).trim();
208
+ res[key] = value === urlKey ? urlValues.pop() : value;
209
+ return res;
199
210
  }, {});
200
211
  }
201
212
  addRun(run, forceAdd = false) {
@@ -265,6 +276,8 @@ export class HtmlImporter {
265
276
  html = html.replace(/<font[^>]*>([^<>]+)<\/font>/gi, '$1');
266
277
  html = html.replace(/<span\s*><span\s*>([^<>]+)<\/span><\/span>/ig, '$1');
267
278
  html = html.replace(/<span>([^<>]+)<\/span>/gi, '$1');
279
+ html = html.replace(/\s*(<li[\S\s]*?>)\s*/gi, '$1');
280
+ html = html.replace(/\s*(<\/li>)\s*/gi, '$1');
268
281
  html = html.replace(/<li([^>]*)>([^<>]+)<\/li>/gi, '<li$1><p>$2</p></li>');
269
282
  html = html.replace(/<li([^>]*)>(([^<>]*)<(?!p)[\s\S]*?)<\/li>/gi, '<li$1><p>$2</p></li>');
270
283
  html = html.replace(/<caption([^>]*)>[\s\S]*?<\/caption>/gi, '');
@@ -289,7 +302,7 @@ export class HtmlImporter {
289
302
  html = html.replace(val, val.replace(/\n/gi, "<p/>"));
290
303
  });
291
304
  }
292
- html = html.replace(/(\n+\s+)|(\s+\n+)/gi, ' ');
305
+ html = html.replace(/(\r*\n+\s+)|(\s+\r*\n+)/gi, ' ');
293
306
  html = html.replace(/\n+/gi, ' ');
294
307
  html = html.replace(/\n/gi, RichUtils.specialCharacters.LineBreak);
295
308
  html = html.replace(/(<\/(?!(p)+)(\s*[^>]*)?>)<\/td>/gi, '$1<p>&nbsp;</p></td>');
@@ -298,9 +311,21 @@ export class HtmlImporter {
298
311
  html = html.replace(/<u>([\s\S]*?)<\/u>/gi, '<span style="text-decoration: underline">$1</span>');
299
312
  html = html.replace(/<s>([\s\S]*?)<\/s>/gi, '<span style="text-decoration: line-through">$1</span>');
300
313
  html = html.replace(/<\/([^\s>]+)(\s[^>]*)?><br><\/([^\s>]+)(\s[^>]*)?>/gi, '');
314
+ html = this.extractBodyContent(html);
301
315
  Log.print(LogSource.HtmlImporter, "convertHtml", () => html);
302
316
  return html;
303
317
  }
318
+ static extractBodyContent(html) {
319
+ const startTagMatch = /<body[^>]*>\s*/i.exec(html);
320
+ let startIndex = 0;
321
+ if (startTagMatch)
322
+ startIndex = startTagMatch.index + startTagMatch[0].length;
323
+ const endTagMatch = /\s*<\/body[^>]*>\s*/i.exec(html);
324
+ let endIndex = html.length;
325
+ if (endTagMatch)
326
+ endIndex = endTagMatch.index;
327
+ return html.substring(startIndex, endIndex);
328
+ }
304
329
  }
305
330
  HtmlImporter.importers = null;
306
331
  HtmlImporter.MapMissTablePropertiesByTagNames = new MapCreator()
@@ -0,0 +1,4 @@
1
+ import { FixedInterval } from "@devexpress/utils/lib/intervals/fixed";
2
+ import { SubDocument } from "../../../model/sub-document";
3
+ import { IProcessor } from "../../../processor";
4
+ export declare function insertHtmlInSubDocument(processor: IProcessor, subDocument: SubDocument, position: number, htmlText: string, callback: (interval: FixedInterval) => void): void;
@@ -0,0 +1,5 @@
1
+ import { HtmlDocumentImporter } from "./html-document-importer";
2
+ import { getAfterInsertCallback, getAfterInsertReject } from "../../callback-helpers";
3
+ export function insertHtmlInSubDocument(processor, subDocument, position, htmlText, callback) {
4
+ new HtmlDocumentImporter().importFromString(htmlText, processor.modelManager.richOptions, getAfterInsertCallback(processor, subDocument, position, callback), getAfterInsertReject(callback));
5
+ }
@@ -11,6 +11,7 @@ export declare class HtmlImporterMaskedParagraphProperties {
11
11
  private importRightIndent;
12
12
  private importSpacingBefore;
13
13
  private importSpacingAfter;
14
+ private importBackColor;
14
15
  private importLineSpacing;
15
16
  private setSpacingAsMultiple;
16
17
  private importTopBorder;
@@ -1,11 +1,14 @@
1
- import { MapCreator } from '../../../../utils/map-creator';
2
- import { BorderLineStyle } from '../../../../model/borders/enums';
3
- import { MaskedParagraphProperties, ParagraphAlignment, ParagraphFirstLineIndent, ParagraphLineSpacingType, ParagraphPropertiesMask } from '../../../../model/paragraph/paragraph-properties';
4
- import { TableWidthUnit, TableWidthUnitType } from '../../../../model/tables/secondary-structures/table-units';
5
1
  import { Errors } from '@devexpress/utils/lib/errors';
6
2
  import { AttrUtils } from '@devexpress/utils/lib/utils/attr';
7
3
  import { DomUtils } from '@devexpress/utils/lib/utils/dom';
8
4
  import { MathUtils } from '@devexpress/utils/lib/utils/math';
5
+ import { ColorUtils } from '@devexpress/utils/lib/utils/color';
6
+ import { MapCreator } from '../../../../utils/map-creator';
7
+ import { BorderLineStyle } from '../../../../model/borders/enums';
8
+ import { MaskedParagraphProperties, ParagraphAlignment, ParagraphFirstLineIndent, ParagraphLineSpacingType, ParagraphPropertiesMask } from '../../../../model/paragraph/paragraph-properties';
9
+ import { TableWidthUnit, TableWidthUnitType } from '../../../../model/tables/secondary-structures/table-units';
10
+ import { ShadingInfo } from '../../../../model/shadings/shading-info';
11
+ import { ColorModelInfo } from '../../../../model/color/color-model-info';
9
12
  import { HtmlImportUtils } from './utils';
10
13
  export class HtmlImporterMaskedParagraphProperties {
11
14
  import(colorProvider, element, isTableCellTag) {
@@ -20,6 +23,7 @@ export class HtmlImporterMaskedParagraphProperties {
20
23
  this.importLineSpacing();
21
24
  this.importSpacingBefore();
22
25
  this.importSpacingAfter();
26
+ this.importBackColor();
23
27
  if (!isTableCellTag) {
24
28
  this.importTopBorder(colorProvider, calculatedStyle);
25
29
  this.importRightBorder(colorProvider, calculatedStyle);
@@ -74,6 +78,15 @@ export class HtmlImporterMaskedParagraphProperties {
74
78
  this.result.setUseValue(ParagraphPropertiesMask.UseSpacingAfter, true);
75
79
  }
76
80
  }
81
+ importBackColor() {
82
+ if (this.element.style.backgroundColor !== "") {
83
+ const backColor = ColorUtils.fromString(this.element.style.backgroundColor);
84
+ if (backColor) {
85
+ this.result.shadingInfo = ShadingInfo.createByColor(ColorModelInfo.makeByColor(backColor));
86
+ this.result.setUseValue(ParagraphPropertiesMask.UseShadingInfoIndex, true);
87
+ }
88
+ }
89
+ }
77
90
  importLineSpacing() {
78
91
  this.result.setUseValue(ParagraphPropertiesMask.UseLineSpacing, true);
79
92
  this.result.setUseValue(ParagraphPropertiesMask.UseBeforeAutoSpacing, true);
@@ -1,4 +1,18 @@
1
+ import { IPictureRenderer } from "../canvas/picture-renderer";
2
+ import { DocumentFormat } from "../document-format";
3
+ import { IModelManager } from "../model-manager";
4
+ import { IRichEditUnitConverter } from "../utils/unit-converter";
1
5
  export interface IDocumentExporter {
2
6
  exportToBlob(callback: (blob: Blob) => void): any;
3
7
  exportToBase64(callback: (base64: string) => void): any;
4
8
  }
9
+ export interface IExportModelOptions {
10
+ modelManager: IModelManager;
11
+ documentFormat: DocumentFormat;
12
+ pictureRenderer: IPictureRenderer;
13
+ uiUnitConverter: IRichEditUnitConverter;
14
+ sessionGuid: string;
15
+ clientGuid: string;
16
+ lastMaxNumPages?: number;
17
+ pageIndex?: number;
18
+ }
@@ -7,12 +7,12 @@ import { RtfExportHelper } from './helpers/rtf-export-helper';
7
7
  import { RtfBuilder } from './rtf-builder';
8
8
  import { RtfDocumentExporterOptions } from './rtf-document-exporter-options';
9
9
  export declare class RtfExporter implements IDocumentExporter {
10
- documentModel: DocumentModel;
11
10
  options: RtfDocumentExporterOptions;
12
11
  rtfExportHelper: RtfExportHelper;
13
12
  rtfBuilder: RtfBuilder;
14
13
  contentExporter: RtfContentExporter;
15
14
  private modelManipulator;
15
+ get documentModel(): DocumentModel;
16
16
  constructor(modelManipulator: ModelManipulator, options: RtfDocumentExporterOptions);
17
17
  exportToBlob(callback: (blob: Blob) => void): void;
18
18
  exportToBase64(callback: (base64: string) => void): void;
@@ -12,12 +12,12 @@ import { RtfExportHelper } from './helpers/rtf-export-helper';
12
12
  export class RtfExporter {
13
13
  constructor(modelManipulator, options) {
14
14
  this.modelManipulator = modelManipulator;
15
- this.documentModel = modelManipulator.model;
16
15
  this.options = options;
17
16
  this.rtfExportHelper = new RtfExportHelper();
18
17
  this.contentExporter = new RtfContentExporter(this.documentModel, options, this.rtfExportHelper);
19
18
  this.rtfBuilder = this.contentExporter.createRtfBuilder();
20
19
  }
20
+ get documentModel() { return this.modelManipulator.model; }
21
21
  exportToBlob(callback) {
22
22
  this.modelManipulator.picture.loader.ensureAllPicturesLoaded(this.options.ensurePictureLoadedTimeout, (_loaded) => {
23
23
  callback(new Blob([this.exportAsString()], { type: 'application/rtf' }));
@@ -1,6 +1,6 @@
1
+ import { FixedInterval } from "@devexpress/utils/lib/intervals/fixed";
1
2
  import { RichOptions } from "../../model/options/rich-options";
2
3
  import { SubDocument } from "../../model/sub-document";
3
4
  import { IProcessor } from "../../processor";
4
- import { FixedInterval } from "@devexpress/utils/lib/intervals/fixed";
5
5
  export declare function getRtfFromSubDocumentPublic(richOptions: RichOptions, subDocument: SubDocument, coreInterval: FixedInterval): string;
6
6
  export declare function insertRtfInSubDocumentPublic(processor: IProcessor, subDocument: SubDocument, position: number, rtf: string, callback: (interval: FixedInterval, isRtfValid: boolean) => void): void;
@@ -1,7 +1,7 @@
1
+ import { EmptyBatchUpdatableObject } from "@devexpress/utils/lib/class/batch-updatable";
1
2
  import { ClientModelManager } from "../../model-manager";
2
3
  import { RangeCopy } from "../../model/manipulators/range/create-range-copy-operation";
3
4
  import { SubDocumentIntervals } from "../../model/sub-document";
4
- import { EmptyBatchUpdatableObject } from "@devexpress/utils/lib/class/batch-updatable";
5
5
  import { RtfExporter } from "./export/exporter";
6
6
  import { RtfDocumentExporterOptions } from "./export/rtf-document-exporter-options";
7
7
  import { RtfImporterOptions } from "./import/importer-options";
@@ -1,5 +1,6 @@
1
1
  import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
2
2
  import { Base64Utils } from '@devexpress/utils/lib/utils/base64';
3
+ import { PlainTextMimeType } from '@devexpress/utils/lib/utils/mime-type';
3
4
  export class TxtExporter {
4
5
  constructor(modelManipulator, options) {
5
6
  this.modelManipulator = modelManipulator;
@@ -23,7 +24,7 @@ export class TxtExporter {
23
24
  text += '\r\n';
24
25
  text += this.model.mainSubDocument.getSimpleText(new FixedInterval(p.startLogPosition.value, p.length));
25
26
  });
26
- callback(new Blob([text], { type: 'text/plain' }));
27
+ callback(new Blob([text], { type: PlainTextMimeType }));
27
28
  });
28
29
  }
29
30
  }
@@ -1,8 +1,8 @@
1
1
  import { RangeCopy } from './model/manipulators/range/create-range-copy-operation';
2
2
  import { DomEventHandlersHolder } from '@devexpress/utils/lib/class/event-handlers-holder';
3
- import { HtmlBuilder } from './html-export';
4
3
  import { IEventManager } from './interfaces/i-event-manager';
5
4
  import { IRichEditControl } from './interfaces/i-rich-edit-core';
5
+ import { HtmlBuilder } from './formats/html/export/html-builder';
6
6
  export declare const INPUT_CLASS_NAME = "dxreInputTarget";
7
7
  export declare abstract class InputEditorBase<TInpElement extends HTMLElement> {
8
8
  eventManager: IEventManager;
@@ -130,6 +130,7 @@ export declare class InputController {
130
130
  inputEditor: InputEditorBase<HTMLElement>;
131
131
  private exporter;
132
132
  constructor(control: IRichEditControl, eventManager: IEventManager, parent: HTMLElement);
133
+ initExporter(): void;
133
134
  dispose(): void;
134
135
  private createInputEditor;
135
136
  getEditableDocument(): HTMLElement | Document;
@@ -16,8 +16,9 @@ import { PopupUtils } from '@devexpress/utils/lib/utils/popup';
16
16
  import { StringUtils } from '@devexpress/utils/lib/utils/string';
17
17
  import { ClipboardContentInserter } from './clipboard-content-inserter';
18
18
  import { RichEditClientCommand } from './commands/client-command';
19
- import { HtmlBuilder, HtmlExporter } from './html-export';
20
19
  import { ReadOnlyMode } from './interfaces/i-rich-edit-core';
20
+ import { HtmlExporter } from './formats/html/export/html-export';
21
+ import { HtmlBuilder } from './formats/html/export/html-builder';
21
22
  export const INPUT_CLASS_NAME = "dxreInputTarget";
22
23
  const EMPTY_KEYCODE = 229;
23
24
  const TAB_KEYCODE = 9;
@@ -716,7 +717,9 @@ export class InputController {
716
717
  constructor(control, eventManager, parent) {
717
718
  this.control = control;
718
719
  this.inputEditor = this.createInputEditor(parent, eventManager);
719
- this.exporter = new HtmlExporter(this.control);
720
+ }
721
+ initExporter() {
722
+ this.exporter = new HtmlExporter(this.control.getExportModelOptions());
720
723
  }
721
724
  dispose() {
722
725
  this.inputEditor.dispose();
@@ -36,6 +36,7 @@ import { SelectionModelChangesListener } from '../selection/selection-model-chan
36
36
  import { IRulerControl } from '../ui/ruler/ruler';
37
37
  import { SearchManager } from '../ui/search-manager';
38
38
  import { IControlOwner } from './i-control-owner';
39
+ import { IExportModelOptions } from '../formats/i-document-exporter';
39
40
  export interface IBarListener extends IEventListener {
40
41
  NotifyBarCommandExecuted(commandID: RichEditClientCommand, parameter: any): any;
41
42
  NotifyBarUpdateRequested(): any;
@@ -83,6 +84,7 @@ export interface IRichEditControl extends IBatchUpdatableObject, IDisposable, IR
83
84
  owner: IControlOwner;
84
85
  selectionModelChangesListener: SelectionModelChangesListener;
85
86
  pdfHelperFrame: PdfHelperFrame;
87
+ getExportModelOptions(initOptions?: Partial<IExportModelOptions>): IExportModelOptions;
86
88
  isClientMode(): boolean;
87
89
  createFieldRequestManager(): FieldRequestManager;
88
90
  initialize(sessionGuid: string, documentInfo: DocumentInfo, subDocumentsCounter: number, documentModel: DocumentModel): any;
@@ -10,7 +10,8 @@ import { LayoutBoxType } from './layout-box';
10
10
  export declare class LayoutAnchoredPictureBox extends LayoutAnchoredObjectBox implements ICloneable<LayoutAnchoredPictureBox> {
11
11
  cacheInfo: CacheImageInfo;
12
12
  isLoaded: boolean;
13
- constructor(characterProperties: CharacterProperties, colorInfo: LayoutCharacterPropertiesColorInfo, belongsToSubDocId: number, anchorInfo: AnchorInfo, shape: Shape, objectId: number, rotationInRadians: number, cacheInfo: CacheImageInfo);
13
+ descrtiption: string;
14
+ constructor(characterProperties: CharacterProperties, colorInfo: LayoutCharacterPropertiesColorInfo, belongsToSubDocId: number, anchorInfo: AnchorInfo, shape: Shape, objectId: number, rotationInRadians: number, cacheInfo: CacheImageInfo, descrtiption: string);
14
15
  getType(): LayoutBoxType;
15
16
  equals(obj: LayoutAnchoredPictureBox): boolean;
16
17
  clone(): LayoutAnchoredPictureBox;
@@ -1,9 +1,10 @@
1
1
  import { LayoutAnchoredObjectBox } from './layout-anchored-object-box';
2
2
  import { LayoutBoxType } from './layout-box';
3
3
  export class LayoutAnchoredPictureBox extends LayoutAnchoredObjectBox {
4
- constructor(characterProperties, colorInfo, belongsToSubDocId, anchorInfo, shape, objectId, rotationInRadians, cacheInfo) {
4
+ constructor(characterProperties, colorInfo, belongsToSubDocId, anchorInfo, shape, objectId, rotationInRadians, cacheInfo, descrtiption) {
5
5
  super(characterProperties, colorInfo, belongsToSubDocId, anchorInfo, shape, objectId, rotationInRadians);
6
6
  this.cacheInfo = cacheInfo;
7
+ this.descrtiption = descrtiption;
7
8
  this.isLoaded = this.cacheInfo.isLoaded;
8
9
  }
9
10
  getType() {
@@ -13,11 +14,11 @@ export class LayoutAnchoredPictureBox extends LayoutAnchoredObjectBox {
13
14
  return super.equals(obj) && this.cacheInfo.equals(obj.cacheInfo) && this.isLoaded == obj.isLoaded;
14
15
  }
15
16
  clone() {
16
- const newObject = new LayoutAnchoredPictureBox(this.characterProperties, this.colorInfo, this.belongsToSubDocId, this.anchorInfo, this.shape, this.objectId, this.rotationInRadians, this.cacheInfo);
17
+ const newObject = new LayoutAnchoredPictureBox(this.characterProperties, this.colorInfo, this.belongsToSubDocId, this.anchorInfo, this.shape, this.objectId, this.rotationInRadians, this.cacheInfo, this.descrtiption);
17
18
  newObject.copyFrom(this);
18
19
  return newObject;
19
20
  }
20
21
  renderGetContent(renderer) {
21
- return renderer.renderPictureBoxContent(this.createSize(), this.cacheInfo, this.hyperlinkTip);
22
+ return renderer.renderPictureBoxContent(this.createSize(), this.cacheInfo, this.hyperlinkTip, this.descrtiption);
22
23
  }
23
24
  }
@@ -9,7 +9,8 @@ import { LayoutBox, LayoutBoxType } from './layout-box';
9
9
  export declare class LayoutPictureBox extends LayoutBox implements ICloneable<LayoutPictureBox>, ISupportCopyFrom<LayoutPictureBox> {
10
10
  cacheInfo: CacheImageInfo;
11
11
  isLoaded: boolean;
12
- constructor(characterProperties: CharacterProperties, colorInfo: LayoutCharacterPropertiesColorInfo, cacheInfo: CacheImageInfo, size: Size);
12
+ description: string;
13
+ constructor(characterProperties: CharacterProperties, colorInfo: LayoutCharacterPropertiesColorInfo, cacheInfo: CacheImageInfo, size: Size, description: string);
13
14
  equals(obj: LayoutPictureBox): boolean;
14
15
  clone(): LayoutPictureBox;
15
16
  getType(): LayoutBoxType;
@@ -1,17 +1,18 @@
1
1
  import { LayoutBox, LayoutBoxType } from './layout-box';
2
2
  export class LayoutPictureBox extends LayoutBox {
3
- constructor(characterProperties, colorInfo, cacheInfo, size) {
3
+ constructor(characterProperties, colorInfo, cacheInfo, size, description) {
4
4
  super(characterProperties, colorInfo);
5
5
  this.cacheInfo = cacheInfo;
6
6
  this.width = size.width;
7
7
  this.height = size.height;
8
+ this.description = description;
8
9
  this.isLoaded = this.cacheInfo.isLoaded;
9
10
  }
10
11
  equals(obj) {
11
- return super.equals(obj) && this.cacheInfo.equals(obj.cacheInfo) && this.isLoaded == obj.isLoaded;
12
+ return super.equals(obj) && this.cacheInfo.equals(obj.cacheInfo) && this.isLoaded == obj.isLoaded && this.description === obj.description;
12
13
  }
13
14
  clone() {
14
- const newObj = new LayoutPictureBox(this.characterProperties, this.colorInfo, this.cacheInfo, this.createSize());
15
+ const newObj = new LayoutPictureBox(this.characterProperties, this.colorInfo, this.cacheInfo, this.createSize(), this.description);
15
16
  newObj.copyFrom(this);
16
17
  return newObj;
17
18
  }
@@ -33,7 +34,7 @@ export class LayoutPictureBox extends LayoutBox {
33
34
  return true;
34
35
  }
35
36
  renderGetContent(renderer) {
36
- return renderer.renderPictureBoxContent(this.createSize(), this.cacheInfo, this.hyperlinkTip);
37
+ return renderer.renderPictureBoxContent(this.createSize(), this.cacheInfo, this.hyperlinkTip, this.description);
37
38
  }
38
39
  isWhitespace() {
39
40
  return false;
@@ -58,4 +58,5 @@ export declare class LayoutPage extends Rectangle {
58
58
  static getLastValidPageInGroup(pages: LayoutPage[], pageIndex: number, validPageCount: number, checkValid: boolean, tryFindPage: boolean): LayoutPage;
59
59
  getEndPosition(): number;
60
60
  static getPrevPageLastPosition(pages: LayoutPage[], currPageIndex: number): number;
61
+ removeOtherPageArea(subDocId: number): void;
61
62
  }
@@ -43,7 +43,7 @@ export class LayoutPage extends Rectangle {
43
43
  this.mainSubDocumentPageAreas = [];
44
44
  this.otherPageAreas = {};
45
45
  this.flags = new Flag();
46
- this.anchoredObjectHolder = new PageAnchoredObjectHolder();
46
+ this.anchoredObjectHolder = new PageAnchoredObjectHolder(this);
47
47
  this.tableAnchoredObjectsHolder = new TableAnchoredObjectsHolder();
48
48
  }
49
49
  setRenderLevelCalculator(anchorObjectsPositionInfo, compatibilityMode) {
@@ -78,7 +78,7 @@ export class LayoutPage extends Rectangle {
78
78
  obj.index = this.index;
79
79
  obj.layoutPageIndex = this.layoutPageIndex;
80
80
  obj.pageOrdinal = this.pageOrdinal;
81
- obj.anchoredObjectHolder = this.anchoredObjectHolder.shallowCopy();
81
+ obj.anchoredObjectHolder = this.anchoredObjectHolder.shallowCopy(obj);
82
82
  obj.tableAnchoredObjectsHolder = this.tableAnchoredObjectsHolder.shallowCopy();
83
83
  obj.contentIntervals = ListUtils.shallowCopy(this.contentIntervals);
84
84
  obj.startPageSectionIndex = this.startPageSectionIndex;
@@ -167,6 +167,9 @@ export class LayoutPage extends Rectangle {
167
167
  const prevPage = pages[currPageIndex - 1];
168
168
  return prevPage ? prevPage.getEndPosition() : 0;
169
169
  }
170
+ removeOtherPageArea(subDocId) {
171
+ delete this.otherPageAreas[subDocId];
172
+ }
170
173
  }
171
174
  class ContentIntervalCollector {
172
175
  constructor(mainSubDocumentPageAreas, startPagePos) {
@@ -48,6 +48,7 @@ export declare class BoxGenerator {
48
48
  private makeDashBox;
49
49
  private makeParagraphAndSectionBox;
50
50
  private isLastParagraphInCell;
51
+ private skipCurrentRun;
51
52
  private makeInlinePictureBox;
52
53
  private makeAnchoredPictureRun;
53
54
  static createLayoutAnchoredTextBoxFromRun(anchorTextBox: AnchoredTextBoxRun, subDocumentId: number, colorProvider: ColorProvider): LayoutAnchoredTextBox;
@@ -290,6 +290,12 @@ export class BoxGenerator {
290
290
  case RunType.LayoutDependentRun:
291
291
  this.makeLayoutDependentRun();
292
292
  break;
293
+ case RunType.FootNoteRun:
294
+ this.skipCurrentRun();
295
+ break;
296
+ case RunType.EndNoteRun:
297
+ this.skipCurrentRun();
298
+ break;
293
299
  default: this.makeDefault();
294
300
  }
295
301
  }
@@ -322,11 +328,15 @@ export class BoxGenerator {
322
328
  return false;
323
329
  return paragraph.getEndPosition() == tableCell.interval.end;
324
330
  }
331
+ skipCurrentRun() {
332
+ this.modelIterator.charOffset = this.run.getLength();
333
+ this.offsetStartWordAtStartRun = this.modelIterator.charOffset;
334
+ }
325
335
  makeInlinePictureBox() {
326
336
  const inlinePictureRun = this.run;
327
337
  this.modelIterator.charOffset++;
328
338
  const charProps = inlinePictureRun.getCharacterMergedProperties();
329
- this.addNewBoxInfo(new LayoutPictureBox(charProps, charProps.getLayoutColorInfo(this.colorProvider), inlinePictureRun.cacheInfo, inlinePictureRun.getActualSize().applyConverter(UnitConverter.twipsToPixelsF)));
339
+ this.addNewBoxInfo(new LayoutPictureBox(charProps, charProps.getLayoutColorInfo(this.colorProvider), inlinePictureRun.cacheInfo, inlinePictureRun.getActualSize().applyConverter(UnitConverter.twipsToPixelsF), inlinePictureRun.info.nonVisualDrawingProperties.description));
330
340
  this.offsetStartWordAtStartRun = this.modelIterator.charOffset;
331
341
  }
332
342
  makeAnchoredPictureRun() {
@@ -335,7 +345,7 @@ export class BoxGenerator {
335
345
  if (anchorPictureRun.anchorInfo.hidden)
336
346
  return;
337
347
  const charProps = anchorPictureRun.getCharacterMergedProperties();
338
- this.addNewBoxInfo(new LayoutAnchoredPictureBox(charProps, charProps.getLayoutColorInfo(this.colorProvider), this.subDocument.id, anchorPictureRun.anchorInfo.clone(), anchorPictureRun.shape.clone().applyConverter(UnitConverter.twipsToPixelsF), anchorPictureRun.anchoredObjectID, UnitConverter.twipsToRadians(anchorPictureRun.size.rotation), anchorPictureRun.cacheInfo)
348
+ this.addNewBoxInfo(new LayoutAnchoredPictureBox(charProps, charProps.getLayoutColorInfo(this.colorProvider), this.subDocument.id, anchorPictureRun.anchorInfo.clone(), anchorPictureRun.shape.clone().applyConverter(UnitConverter.twipsToPixelsF), anchorPictureRun.anchoredObjectID, UnitConverter.twipsToRadians(anchorPictureRun.size.rotation), anchorPictureRun.cacheInfo, anchorPictureRun.info.nonVisualDrawingProperties.description)
339
349
  .setPosition(new Point(0, 0))
340
350
  .setSize(anchorPictureRun.getActualSize().applyConverter(UnitConverter.twipsToPixelsF)));
341
351
  this.offsetStartWordAtStartRun = this.modelIterator.charOffset;
@@ -3,11 +3,13 @@ import { LayoutAnchoredObjectBox } from '../../layout/main-structures/layout-box
3
3
  import { LayoutAnchoredTextBox } from '../../layout/main-structures/layout-boxes/layout-anchored-text-box';
4
4
  import { BaseFormatter } from '../formatter/base-formatter';
5
5
  import { FormatterManager } from '../managers/formatter-manager';
6
+ import { LayoutPage } from '../../../common/layout/main-structures/layout-page';
6
7
  export declare class PageAnchoredObjectHolder {
8
+ private _page;
7
9
  objects: Record<number, LayoutAnchoredObjectBox>;
8
- constructor();
10
+ constructor(_page: LayoutPage);
9
11
  getObjectByModelPosition(layout: DocumentLayout, position: number, belongsToSubDocId: number): LayoutAnchoredObjectBox;
10
- onColumnEnd(activeFormatter: BaseFormatter): void;
12
+ removeOrphanedObjects(activeFormatter: BaseFormatter): void;
11
13
  getObjectsForRenderer(anchorObjectsPositionInfo: AnchorObjectsPositionInfo, objects?: Record<number, LayoutAnchoredObjectBox>): LayoutAnchoredObjectBox[];
12
14
  getObjById(id: number): LayoutAnchoredObjectBox;
13
15
  getUnapprovedObj(): LayoutAnchoredObjectBox;
@@ -16,5 +18,5 @@ export declare class PageAnchoredObjectHolder {
16
18
  addObject(manager: FormatterManager, obj: LayoutAnchoredObjectBox): void;
17
19
  removeObject(obj: LayoutAnchoredObjectBox): void;
18
20
  private correctPositionDueToOtherBoxes;
19
- shallowCopy(): PageAnchoredObjectHolder;
21
+ shallowCopy(page: LayoutPage): PageAnchoredObjectHolder;
20
22
  }
@@ -2,13 +2,14 @@ import { NumberMapUtils } from '@devexpress/utils/lib/utils/map/number';
2
2
  import { LayoutBoxType } from '../../layout/main-structures/layout-boxes/layout-box';
3
3
  import { getLayoutAnchoredObjectBoxComparer } from '../../model/manipulators/floating-objects/comparers';
4
4
  export class PageAnchoredObjectHolder {
5
- constructor() {
5
+ constructor(_page) {
6
+ this._page = _page;
6
7
  this.objects = {};
7
8
  }
8
9
  getObjectByModelPosition(layout, position, belongsToSubDocId) {
9
10
  return NumberMapUtils.elementBy(this.objects, (obj, id) => layout.anchorObjectsPositionInfo.getPosition(id) == position && obj.belongsToSubDocId === belongsToSubDocId);
10
11
  }
11
- onColumnEnd(activeFormatter) {
12
+ removeOrphanedObjects(activeFormatter) {
12
13
  if (!activeFormatter.subDocument.isMain())
13
14
  return;
14
15
  const belongsToSubDocId = activeFormatter.subDocument.id;
@@ -19,6 +20,8 @@ export class PageAnchoredObjectHolder {
19
20
  if (layout.anchorObjectsPositionInfo.getPosition(id) >= position &&
20
21
  obj.belongsToSubDocId === belongsToSubDocId) {
21
22
  keysToDelete.push(id);
23
+ if (obj.getType() === LayoutBoxType.AnchorTextBox)
24
+ this._page.removeOtherPageArea(obj.internalSubDocId);
22
25
  activeFormatter.layoutRowBoundsCalculator.removeAnchorObjectId(id);
23
26
  }
24
27
  });
@@ -56,8 +59,8 @@ export class PageAnchoredObjectHolder {
56
59
  }
57
60
  correctPositionDueToOtherBoxes(_obj) {
58
61
  }
59
- shallowCopy() {
60
- const obj = new PageAnchoredObjectHolder();
62
+ shallowCopy(page) {
63
+ const obj = new PageAnchoredObjectHolder(page);
61
64
  obj.objects = NumberMapUtils.shallowCopy(this.objects);
62
65
  return obj;
63
66
  }