devexpress-richedit 25.1.2-beta → 25.1.4-build-25191-0102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/bin/gulpfile.js +1 -1
  2. package/bin/index-custom.js +1 -1
  3. package/bin/localization-builder.js +1 -1
  4. package/bin/nspell-index.js +1 -1
  5. package/bin/nspell.webpack.config.js +1 -1
  6. package/bin/webpack-externals.js +1 -1
  7. package/bin/webpack.config.js +1 -1
  8. package/dist/dx.richedit.css +1 -1
  9. package/dist/dx.richedit.d.ts +1 -2
  10. package/dist/dx.richedit.js +1374 -1304
  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/client-rich-edit.js +2 -2
  15. package/lib/client/commands/commands.js +0 -3
  16. package/lib/client/commands/mail-merge-command.js +3 -2
  17. package/lib/client/commands/open-document-command.js +4 -0
  18. package/lib/client/formats/docx/export/exporters/relations/base.js +2 -2
  19. package/lib/client/formats/docx/import/destination/numbering/numberings-destination.js +1 -1
  20. package/lib/client/formats/docx/import/destination/runs/text-destination.js +1 -1
  21. package/lib/client/model-api/character-properties.js +13 -17
  22. package/lib/client/model-api/document.js +2 -0
  23. package/lib/client/model-api/images/image-enums.js +1 -0
  24. package/lib/client/model-api/images/images.js +1 -1
  25. package/lib/client/model-api/table/enums.js +4 -0
  26. package/lib/client/public/commands/enum.d.ts +1 -2
  27. package/lib/client/public/commands/enum.js +1 -1
  28. package/lib/client/public/options.d.ts +1 -0
  29. package/lib/client/public/ribbon/item-ids.js +1 -0
  30. package/lib/client/public/rich-edit.d.ts +5 -5
  31. package/lib/client/ribbon/toolbar-items/index.d.ts +1 -1
  32. package/lib/client/ribbon/toolbar-items/toolbar-item-template-creators/index.d.ts +7 -7
  33. package/lib/client/utils/focus-helper.js +22 -5
  34. package/lib/common/canvas/canvas-manager.js +1 -1
  35. package/lib/common/canvas/canvas-scroll-manager.js +1 -1
  36. package/lib/common/canvas/canvas-size-info.d.ts +1 -0
  37. package/lib/common/canvas/canvas-size-info.js +2 -2
  38. package/lib/common/canvas/renderes/view-manager.js +4 -3
  39. package/lib/common/commands/client-command.d.ts +1 -2
  40. package/lib/common/commands/client-command.js +0 -1
  41. package/lib/common/commands/command-manager.js +0 -2
  42. package/lib/common/commands/dialogs/dialog-layout-options-command.js +0 -3
  43. package/lib/common/commands/document/print-document-on-client-command.d.ts +2 -0
  44. package/lib/common/commands/document/print-document-on-client-command.js +46 -18
  45. package/lib/common/commands/floating-objects/floating-object-drag-drop-change-position-command.js +0 -3
  46. package/lib/common/commands/layout/apply-style-command.d.ts +2 -2
  47. package/lib/common/commands/layout/apply-style-command.js +3 -4
  48. package/lib/common/commands/layout/toggle-show-hidden-symbols-command.js +0 -3
  49. package/lib/common/commands/toc/set-paragraph-level-command.js +1 -1
  50. package/lib/common/formats/html/export/html-export.d.ts +8 -0
  51. package/lib/common/formats/html/export/html-export.js +49 -26
  52. package/lib/common/formats/html/import/containers/runs.d.ts +2 -1
  53. package/lib/common/formats/html/import/containers/runs.js +2 -1
  54. package/lib/common/formats/html/import/html-importer.d.ts +0 -1
  55. package/lib/common/formats/html/import/html-importer.js +2 -3
  56. package/lib/common/formats/html/import/html-model-inserter.js +4 -0
  57. package/lib/common/formats/html/import/importers/list-base.js +2 -1
  58. package/lib/common/formats/rtf/utils/list-level-display-text-helper.js +2 -2
  59. package/lib/common/input-controller.js +2 -2
  60. package/lib/common/layout/document-layout.js +4 -1
  61. package/lib/common/layout/main-structures/layout-row.d.ts +1 -2
  62. package/lib/common/layout/main-structures/layout-row.js +0 -1
  63. package/lib/common/layout-formatter/row/result.js +1 -1
  64. package/lib/common/layout-formatter/row/size-engine/row-formatting-info.d.ts +1 -0
  65. package/lib/common/layout-formatter/row/size-engine/row-formatting-info.js +2 -2
  66. package/lib/common/layout-formatter/row/size-engine/row-sizes-manager.d.ts +2 -0
  67. package/lib/common/layout-formatter/row/size-engine/row-sizes-manager.js +2 -0
  68. package/lib/common/layout-formatter/row/states.js +1 -1
  69. package/lib/common/layout-formatter/row/tab-info.d.ts +2 -1
  70. package/lib/common/layout-formatter/row/tab-info.js +40 -40
  71. package/lib/common/layout-formatter/row/word-holder.js +1 -1
  72. package/lib/common/model/borders/border-info.js +1 -1
  73. package/lib/common/model/caches/images.d.ts +4 -1
  74. package/lib/common/model/caches/images.js +6 -2
  75. package/lib/common/model/character/character-properties.d.ts +1 -1
  76. package/lib/common/model/character/character-properties.js +14 -2
  77. package/lib/common/model/fields/field.d.ts +1 -1
  78. package/lib/common/model/fields/field.js +4 -3
  79. package/lib/common/model/fields/parsers/field-code-parser-doc-variable.d.ts +1 -1
  80. package/lib/common/model/fields/parsers/field-code-parser.d.ts +1 -1
  81. package/lib/common/model/fields/tree-creator.js +1 -1
  82. package/lib/common/model/history/items/character-properties-history-items.d.ts +2 -1
  83. package/lib/common/model/history/items/character-properties-history-items.js +3 -2
  84. package/lib/common/model/manipulators/character-properties-manipulator.js +2 -2
  85. package/lib/common/model/manipulators/i-properties-manipulator.d.ts +1 -1
  86. package/lib/common/model/manipulators/picture-manipulator/picture-manipulator.js +2 -2
  87. package/lib/common/model/options/fonts.d.ts +1 -1
  88. package/lib/common/model/paragraph/paragraph-style.d.ts +1 -0
  89. package/lib/common/model/paragraph/paragraph-style.js +3 -0
  90. package/lib/common/scroll/canvas-states.d.ts +4 -4
  91. package/lib/common/scroll/model-states.d.ts +5 -5
  92. package/lib/common/ui/ruler/controls/ruler.js +3 -7
  93. package/lib/common/ui/ruler/controls/vertical-line.js +2 -1
  94. package/package.json +3 -3
  95. package/lib/client/formats/docx/import/destination/field/field-data-destination.d.ts +0 -0
  96. package/lib/client/formats/docx/import/destination/field/field-data-destination.js +0 -0
  97. package/lib/client/formats/docx/import/destination/field/form-field-destination.d.ts +0 -0
  98. package/lib/client/formats/docx/import/destination/field/form-field-destination.js +0 -0
  99. package/lib/client/formats/docx/import/destination/paragraph-properties/paragraph-mark-run-properties-destination.d.ts +0 -0
  100. package/lib/client/formats/docx/import/destination/paragraph-properties/paragraph-mark-run-properties-destination.js +0 -0
  101. package/lib/common/commands/layout/toggle-allow-zoom-command.d.ts +0 -7
  102. package/lib/common/commands/layout/toggle-allow-zoom-command.js +0 -17
  103. package/lib/common/formats/rtf/import/properties-normalization/tmp.d.ts +0 -0
  104. package/lib/common/formats/rtf/import/properties-normalization/tmp.js +0 -0
  105. package/lib/common/layout-formatter/box/generator/multi-dimension-iterator.d.ts +0 -0
  106. package/lib/common/layout-formatter/box/generator/multi-dimension-iterator.js +0 -0
  107. package/lib/common/layout-formatter/table/layout-row-index-helper.d.ts +0 -0
  108. package/lib/common/layout-formatter/table/layout-row-index-helper.js +0 -0
@@ -11,7 +11,6 @@ import { Point } from '@devexpress/utils/lib/geometry/point';
11
11
  import { HitTestDeviation, RectangleDeviation, Rectangle as Rect } from '@devexpress/utils/lib/geometry/rectangle';
12
12
  import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
13
13
  import { SelectionHistoryItem } from '../../model/history/selection/selection-history-item';
14
- import { ScrollState } from '../../scroll/model-states';
15
14
  import { RichEditClientCommand } from '../client-command';
16
15
  import { CommandBase, CommandOptions } from '../command-base';
17
16
  import { SimpleCommandState } from '../command-states';
@@ -45,7 +44,6 @@ export class FloatingObjectDragDropChangePositionCommand extends CommandBase {
45
44
  this.getFloatingObjectParentSubDocument().isEditable([new FixedInterval(specialRunInfo.getPosition(), 1)]);
46
45
  }
47
46
  executeCore(_state, options) {
48
- const topInfo = this.control.viewManager.canvasManager.getScrollTopInfo();
49
47
  const runInfo = this.activeSubDocument.getRunAndIndexesByPosition(this.selection.specialRunInfo.getPosition());
50
48
  const oldRun = runInfo.run.clone();
51
49
  const oldRunPos = runInfo.getAbsoluteRunPosition();
@@ -60,7 +58,6 @@ export class FloatingObjectDragDropChangePositionCommand extends CommandBase {
60
58
  this.changeActiveSubDocument(initialHtr, finalClickPoint);
61
59
  this.move(oldRun, oldRunPos, initialHtr, options.endPageIndex, options.finalPoint);
62
60
  this.history.endTransaction();
63
- this.selection.scrollManager.setScroll(new ScrollState().byScrollInfo.setPageInfo(topInfo));
64
61
  return true;
65
62
  }
66
63
  changeActiveSubDocument(htr, point) {
@@ -6,7 +6,7 @@ import { CommandBase, CommandSimpleOptions } from '../command-base';
6
6
  import { ApplyStyleCommandState } from '../command-states';
7
7
  export interface IApplyStyleCommandParams {
8
8
  styleName: string;
9
- keepDirectFormatting?: boolean;
9
+ keepCustomFormatting?: boolean;
10
10
  }
11
11
  export declare class ApplyStyleCommand extends CommandBase<ApplyStyleCommandState> {
12
12
  getState(): ApplyStyleCommandState;
@@ -14,7 +14,7 @@ export declare class ApplyStyleCommand extends CommandBase<ApplyStyleCommandStat
14
14
  DEPRECATEDConvertOptionsParameter(parameter: string | IApplyStyleCommandParams): IApplyStyleCommandParams;
15
15
  executeCore(state: ApplyStyleCommandState, options: CommandSimpleOptions<IApplyStyleCommandParams>): boolean;
16
16
  applyCharacterStyle(subDocumentInterval: SubDocumentInterval, style: CharacterStyle, isPresetStyle: boolean): void;
17
- applyParagraphStyle(subDocumentInterval: SubDocumentInterval, style: ParagraphStyle, isPresetStyle: boolean, keepDirectFormatting?: boolean): void;
17
+ applyParagraphStyle(subDocumentInterval: SubDocumentInterval, style: ParagraphStyle, isPresetStyle: boolean, keepCustomFormatting?: boolean): void;
18
18
  applyParagraphLinkedStyle(subDocumentInterval: SubDocumentInterval, style: ParagraphStyle, isPresetStyle: boolean): void;
19
19
  private addLinkedCharacterStyle;
20
20
  calculateAffectedParagraphCount(subDocumentInterval: SubDocumentInterval): number;
@@ -70,7 +70,7 @@ export class ApplyStyleCommand extends CommandBase {
70
70
  paragraphStyle = StylesManager.getPresetParagraphStyleByName(styleName).clone();
71
71
  isPresetStyle = true;
72
72
  }
73
- this.applyParagraphStyle(subDocumentInterval, paragraphStyle, isPresetStyle, parameter.keepDirectFormatting);
73
+ this.applyParagraphStyle(subDocumentInterval, paragraphStyle, isPresetStyle, parameter.keepCustomFormatting);
74
74
  }
75
75
  else if (!StylesManager.isParagraphStyle(parameter.styleName) && state.characterStyleChangeEnabled) {
76
76
  const styleName = StylesManager.getStyleNameWithoutPrefix(parameter.styleName);
@@ -105,7 +105,7 @@ export class ApplyStyleCommand extends CommandBase {
105
105
  this.modelManipulator.style.applyCharacterStyle(subDocumentInterval, characterStyle, false);
106
106
  }
107
107
  }
108
- applyParagraphStyle(subDocumentInterval, style, isPresetStyle, keepDirectFormatting = false) {
108
+ applyParagraphStyle(subDocumentInterval, style, isPresetStyle, keepCustomFormatting = false) {
109
109
  const count = this.calculateAffectedParagraphCount(subDocumentInterval);
110
110
  if (count > 0 && ControlOptions.isEnabled(this.control.modelManager.richOptions.control.paragraphStyle)) {
111
111
  const { interval, subDocument } = subDocumentInterval;
@@ -118,8 +118,7 @@ export class ApplyStyleCommand extends CommandBase {
118
118
  style = isPresetStyle ? modelManipulator.model.stylesManager.addParagraphStyle(style) : style;
119
119
  this.history.addAndRedo(new ApplyParagraphStyleHistoryItem(modelManipulator, paragraphSubDocumentInterval, style));
120
120
  this.history.addAndRedo(new ParagraphUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0));
121
- if (!keepDirectFormatting)
122
- this.history.addAndRedo(new FontUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0));
121
+ this.history.addAndRedo(new FontUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0, keepCustomFormatting));
123
122
  this.history.addAndRedo(new AddParagraphToListHistoryItem(modelManipulator, subDocument, paragraphIndex, NumberingList.NumberingListNotSettedIndex, -1));
124
123
  }
125
124
  }
@@ -1,4 +1,3 @@
1
- import { ScrollState } from '../../scroll/model-states';
2
1
  import { CommandBase } from '../command-base';
3
2
  import { SimpleCommandState } from '../command-states';
4
3
  export class ToggleShowHiddenSymbolsCommand extends CommandBase {
@@ -12,9 +11,7 @@ export class ToggleShowHiddenSymbolsCommand extends CommandBase {
12
11
  let newValue = options.param;
13
12
  if (newValue !== this.control.innerClientProperties.showHiddenSymbols) {
14
13
  this.control.innerClientProperties.showHiddenSymbols = newValue;
15
- const topInfo = this.control.viewManager.canvasManager.getScrollTopInfo();
16
14
  this.control.layoutFormatterManager.invalidator.onChangedAllLayout();
17
- this.selection.scrollManager.setScroll(new ScrollState().byScrollInfo.setPageInfo(topInfo));
18
15
  return true;
19
16
  }
20
17
  return false;
@@ -22,7 +22,7 @@ export class SetParagraphLevelCommandBase extends CommandBase {
22
22
  if (!paragraphStyle)
23
23
  paragraphStyle = StylesManager.getPresetParagraphStyleByName(styleName);
24
24
  if (paragraphStyle) {
25
- const commandOptions = new CommandSimpleOptions(this.control, { styleName: StylesManager.paragraphPrefix + styleName, keepDirectFormatting: true });
25
+ const commandOptions = new CommandSimpleOptions(this.control, { styleName: StylesManager.paragraphPrefix + styleName, keepCustomFormatting: true });
26
26
  this.commandManager.getCommand(RichEditClientCommand.ChangeStyle).execute(this.commandManager.isPublicApiCall, commandOptions);
27
27
  }
28
28
  else {
@@ -5,12 +5,19 @@ import { Paragraph } from '../../../model/paragraph/paragraph';
5
5
  import { SubDocument } from '../../../model/sub-document';
6
6
  import { HtmlBuilder } from './html-builder';
7
7
  import { IExportModelOptions } from '../../i-document-exporter';
8
+ interface ListInterval {
9
+ listStartValue: number;
10
+ start: number;
11
+ end: number;
12
+ }
8
13
  interface List {
9
14
  parentList?: List;
10
15
  numberingListIndex: number;
11
16
  listLevelIndex: number;
12
17
  start: number;
13
18
  end: number;
19
+ intervals: ListInterval[];
20
+ paragraphsCount: number;
14
21
  }
15
22
  interface IHtmlExporterOptions {
16
23
  sanitaizeHyperlinkURIs?: boolean;
@@ -30,6 +37,7 @@ export declare class HtmlExporter {
30
37
  getHtmlElementsByInterval(model: DocumentModel, subDocument: SubDocument, interval: FixedInterval, guidLabel: string): HtmlBuilder;
31
38
  getParagraphsByInterval(subDocument: SubDocument, interval: FixedInterval): Paragraph[];
32
39
  getListsByParagraphs(paragraphs: Paragraph[]): List[];
40
+ updateListIntervals(list: List, start: number, end: number): void;
33
41
  private addParentTableRecursively;
34
42
  startList(model: DocumentModel, subDocument: SubDocument, interval: FixedInterval, builder: HtmlBuilder, lists: List[], position: number): void;
35
43
  private endList;
@@ -287,7 +287,7 @@ export class HtmlExporter {
287
287
  .configure((el) => {
288
288
  el.setAttribute('border', '1');
289
289
  el.style.cssText = 'border-width: 0px; border-collapse: collapse; border-spacing: 0px;';
290
- el.setAttribute('id', guidLabel.replace("id=\"", "").replace("\"", ""));
290
+ el.setAttribute('id', guidLabel.replace(/id="/g, "").replace(/"/g, ""));
291
291
  })
292
292
  .startChild('tbody')
293
293
  .startChild('tr')
@@ -484,17 +484,26 @@ export class HtmlExporter {
484
484
  });
485
485
  if (!list) {
486
486
  const parentList = (previousList === null || previousList === void 0 ? void 0 : previousList.numberingListIndex) === numberingListIndex ? previousList : null;
487
- list = { parentList, numberingListIndex, listLevelIndex, start, end };
487
+ list = { parentList, numberingListIndex, listLevelIndex, start, end, intervals: [], paragraphsCount: 0 };
488
488
  listsInInterval.push(list);
489
489
  }
490
+ list.paragraphsCount++;
490
491
  previousList = list;
491
- do {
492
- list.end = end;
493
- } while (list = list.parentList);
492
+ this.updateListIntervals(list, start, end);
494
493
  }
495
494
  }
496
495
  return listsInInterval;
497
496
  }
497
+ updateListIntervals(list, start, end) {
498
+ list.end = end;
499
+ const lastInterval = list.intervals.at(-1);
500
+ if (lastInterval && lastInterval.end === start)
501
+ lastInterval.end = end;
502
+ else
503
+ list.intervals.push({ start, end, listStartValue: list.paragraphsCount });
504
+ if (list.parentList)
505
+ this.updateListIntervals(list.parentList, start, end);
506
+ }
498
507
  addParentTableRecursively(model, builder, parentCell, paragraphStartPosition) {
499
508
  const parentRow = parentCell.parentRow;
500
509
  const parentTable = parentRow.parentTable;
@@ -532,51 +541,65 @@ export class HtmlExporter {
532
541
  startList(model, subDocument, interval, builder, lists, position) {
533
542
  if (!lists.length)
534
543
  return;
535
- let listIndex = lists.findIndex((list) => list.start === position);
536
- if (listIndex < 0 && position === interval.start) {
544
+ const listsToStart = lists.filter(list => list.intervals.some(interval => interval.start === position));
545
+ if (!listsToStart.length && position === interval.start) {
537
546
  const firstParagraph = subDocument.getParagraphByPosition(position);
538
547
  if (firstParagraph.getNumberingListIndex() === lists[0].numberingListIndex)
539
- listIndex = 0;
548
+ listsToStart.push(lists[0]);
540
549
  }
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) {
550
+ for (const list of listsToStart) {
551
+ const numberingList = model.numberingLists[list.numberingListIndex];
552
+ const level = numberingList.levels[list.listLevelIndex];
553
+ const format = level.getListLevelProperties().format;
554
+ const listType = numberingList.getListType();
555
+ const levelStart = level.getNewStart();
556
+ const intervalStart = list.intervals.find(interval => interval.start === position).listStartValue;
557
+ const listStart = Math.max(levelStart, intervalStart);
558
+ let listStyleType = "";
559
+ switch (format) {
547
560
  case NumberingFormat.Bullet:
548
- listFormatType = "disc";
561
+ listStyleType = "disc";
549
562
  break;
550
563
  case NumberingFormat.Decimal:
551
- listFormatType = "decimal";
564
+ listStyleType = "decimal";
552
565
  break;
553
566
  case NumberingFormat.LowerLetter:
554
- listFormatType = "lower-alpha";
567
+ listStyleType = "lower-alpha";
555
568
  break;
556
569
  case NumberingFormat.UpperLetter:
557
- listFormatType = "upper-alpha";
570
+ listStyleType = "upper-alpha";
558
571
  break;
559
572
  case NumberingFormat.LowerRoman:
560
- listFormatType = "lower-roman";
573
+ listStyleType = "lower-roman";
561
574
  break;
562
575
  case NumberingFormat.UpperRoman:
563
- listFormatType = "upper-roman";
576
+ listStyleType = "upper-roman";
564
577
  break;
565
578
  default:
566
579
  break;
567
580
  }
568
581
  builder
569
- .startChild(numberingListType !== NumberingType.Bullet ? "ol" : "ul")
570
- .configure((e) => e.style.cssText = "list-style-type:" + listFormatType);
582
+ .startChild(listType !== NumberingType.Bullet ? "ol" : "ul")
583
+ .configure((e) => {
584
+ e.style.cssText = "list-style-type:" + listStyleType;
585
+ if (listStart > 1)
586
+ e.setAttribute("start", listStart.toString());
587
+ });
571
588
  }
572
589
  }
573
590
  endList(model, builder, lists, endPosition) {
574
591
  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");
592
+ const list = lists[i];
593
+ for (let j = list.intervals.length - 1; j >= 0; j--) {
594
+ const interval = list.intervals[j];
595
+ if (interval.end === endPosition) {
596
+ const listType = model.numberingLists[list.numberingListIndex].getListType();
597
+ builder.endChild(listType !== NumberingType.Bullet ? "ol" : "ul");
598
+ list.intervals.splice(j, 1);
599
+ }
579
600
  }
601
+ if (list.intervals.length === 0)
602
+ lists.splice(i, 1);
580
603
  }
581
604
  }
582
605
  getHtmlText(text) {
@@ -31,7 +31,8 @@ export declare class ImportedParagraphListInfo {
31
31
  listType: NumberingType;
32
32
  displayFormatString: string;
33
33
  maskedCharacterProperties: MaskedCharacterProperties;
34
- constructor(listIndex: number, listLevel: number, listFormat: NumberingFormat, listType: NumberingType, displayFormatString: string, maskedCharacterProperties: MaskedCharacterProperties);
34
+ newStart: number;
35
+ constructor(listIndex: number, listLevel: number, listFormat: NumberingFormat, listType: NumberingType, displayFormatString: string, maskedCharacterProperties: MaskedCharacterProperties, newStart?: number);
35
36
  }
36
37
  export declare class ImportedParagraphRunInfo extends RunInfo {
37
38
  listInfo: ImportedParagraphListInfo;
@@ -40,13 +40,14 @@ export class ImportedTextRunInfo extends RunInfo {
40
40
  }
41
41
  ImportedTextRunInfo.tabRegex = new RegExp(RichUtils.specialCharacters.NonBreakingSpace + "{1,}", "gi");
42
42
  export class ImportedParagraphListInfo {
43
- constructor(listIndex, listLevel, listFormat, listType, displayFormatString, maskedCharacterProperties) {
43
+ constructor(listIndex, listLevel, listFormat, listType, displayFormatString, maskedCharacterProperties, newStart = 1) {
44
44
  this.listIndex = listIndex;
45
45
  this.listLevel = listLevel;
46
46
  this.listFormat = listFormat;
47
47
  this.listType = listType;
48
48
  this.displayFormatString = displayFormatString;
49
49
  this.maskedCharacterProperties = maskedCharacterProperties;
50
+ this.newStart = newStart;
50
51
  }
51
52
  }
52
53
  export class ImportedParagraphRunInfo extends RunInfo {
@@ -38,7 +38,6 @@ export declare class HtmlImporter {
38
38
  get currElement(): HTMLElement;
39
39
  get currElementChildren(): HTMLElement[];
40
40
  levelInfo: LevelInfo[];
41
- get prevLevelInfo(): LevelInfo;
42
41
  get currLevelInfo(): LevelInfo;
43
42
  get currListItemLevelInfo(): LevelInfo | null;
44
43
  fieldsId: number;
@@ -72,7 +72,6 @@ export class HtmlImporter {
72
72
  ;
73
73
  get currElementChildren() { return ListUtils.last(this.levelInfo).childElements; }
74
74
  ;
75
- get prevLevelInfo() { return this.levelInfo[this.levelInfo.length - 2]; }
76
75
  get currLevelInfo() { return ListUtils.last(this.levelInfo); }
77
76
  get currListItemLevelInfo() { return ListUtils.reverseElementBy(this.levelInfo, (levelInfo) => { var _a; return ((_a = levelInfo.tagImporter) === null || _a === void 0 ? void 0 : _a.elementTag()) === 'LI'; }); }
78
77
  get currListInfo() {
@@ -305,7 +304,7 @@ export class HtmlImporter {
305
304
  html = html.replace(/<o:[pP][^>]*>\s*<\/o:[pP]>/gi, '');
306
305
  html = html.replace(/<o:[pP][^>]*>.*?<\/o:[pP]>/gi, '&nbsp;');
307
306
  html = html.replace(/<st1:.*?>/gi, '');
308
- html = html.replace(/<\!--[\s\S]*?-->/g, '');
307
+ html = html.replace(/<!--[\s\S]*?(-->|$)/g, '');
309
308
  html = html.replace(/\s*style="\s*"/gi, '');
310
309
  html = html.replace(/style=""/ig, "");
311
310
  html = html.replace(/style=''/ig, "");
@@ -346,7 +345,7 @@ export class HtmlImporter {
346
345
  html = html.replace(/\n/gi, RichUtils.specialCharacters.LineBreak);
347
346
  html = html.replace(/(<\/(?!(p)+)(\s*[^>]*)?>)<\/td>/gi, '$1<p>&nbsp;</p></td>');
348
347
  html = html.replace(/(<\/(?!(p)+)(\s*[^>]*)?>)<\/th>/gi, '$1<p>&nbsp;</p></th>');
349
- html = html.replace(/<script(\s[^>]*)?>[\s\S]*?<\/script>/gi, '');
348
+ html = html.replace(/<script\b[^>]*>[\s\S]*?(<\/script\b[^>]*>|$)/gi, '');
350
349
  html = html.replace(/<u>([\s\S]*?)<\/u>/gi, '<span style="text-decoration: underline">$1</span>');
351
350
  html = html.replace(/<s>([\s\S]*?)<\/s>/gi, '<span style="text-decoration: line-through">$1</span>');
352
351
  html = html.replace(/<\/([^\s>]+)(\s[^>]*)?><br><\/([^\s>]+)(\s[^>]*)?>/gi, '');
@@ -144,6 +144,10 @@ export class HtmlModelInserter {
144
144
  if (listInfo.displayFormatString) {
145
145
  modelManipulator.numberingList.listLevelProperties.displayFormatString.setValue(model, false, targetListIndex, listLevelIndex, listInfo.displayFormatString);
146
146
  }
147
+ if (listInfo.newStart) {
148
+ modelManipulator.numberingList.setIOverrideListLevelNewStart(numberingListIndex, listLevelIndex, listInfo.newStart);
149
+ modelManipulator.numberingList.setIOverrideListLevelOverrideStart(numberingListIndex, listLevelIndex, true);
150
+ }
147
151
  if (listInfo.maskedCharacterProperties) {
148
152
  listLevel.setCharacterProperties(listInfo.maskedCharacterProperties);
149
153
  listLevel.onCharacterPropertiesChanged();
@@ -20,7 +20,8 @@ export class HtmlListTagImporterBase extends HtmlTagImporterBase {
20
20
  }
21
21
  const listFormat = ParagraphListPropertiesUtils.getListType(this.element);
22
22
  const displayFormat = ParagraphListPropertiesUtils.importDisplayFormatStringByParentListFormat(listFormat, parentList === null || parentList === void 0 ? void 0 : parentList.listFormat, listLevel);
23
- this.importer.listInfos.push(new ImportedParagraphListInfo(listIndex, listLevel, listFormat, listFormat == NumberingFormat.Bullet ? NumberingType.Bullet : NumberingType.MultiLevel, displayFormat, null));
23
+ const startIndex = parseInt(this.element.getAttribute('start'));
24
+ this.importer.listInfos.push(new ImportedParagraphListInfo(listIndex, listLevel, listFormat, listFormat == NumberingFormat.Bullet ? NumberingType.Bullet : NumberingType.MultiLevel, displayFormat, null, startIndex));
24
25
  }
25
26
  isImportChildren() {
26
27
  return true;
@@ -18,8 +18,8 @@ export class ListLevelDisplayTextHelper {
18
18
  static getTextRange(placeholderIndices, startPlaceHolderIndex, text) {
19
19
  var index = placeholderIndices[startPlaceHolderIndex] + 1;
20
20
  var result = text.substr(index, placeholderIndices[startPlaceHolderIndex + 1] - index);
21
- result = result.replace("{", "{{");
22
- result = result.replace("}", "}}");
21
+ result = result.replace(/{/g, "{{");
22
+ result = result.replace(/}/g, "}}");
23
23
  return result;
24
24
  }
25
25
  }
@@ -722,7 +722,7 @@ export class IFrameInputEditor extends InputEditorBase {
722
722
  const propChar = HtmlConverter.getSizeSignificantRules(this.control.inputPosition.getMergedCharacterPropertiesRaw()).join(";");
723
723
  this.editableDocument.body.style.cssText = "padding: 0px; margin: 0px; overflow: hidden; color: transparent; " + propChar;
724
724
  this.editableDocument.body.style.textIndent = currentTextIndent;
725
- if (Browser.Firefox) {
725
+ if (Browser.Firefox && Browser.Version <= 137) {
726
726
  this.editableDocument.body.style.zoom = this.control.viewManager.zoomLevel;
727
727
  }
728
728
  let layoutX = layoutPosition.getLayoutX(this.control.measurer, DocumentLayoutDetailsLevel.Row);
@@ -828,7 +828,7 @@ export class InputController {
828
828
  }
829
829
  static getCopyPasteHtmlContentForEditable(html, guidLabel) {
830
830
  const builder = new HtmlBuilder();
831
- const id = guidLabel.replace("id=\"", "").replace("\"", "");
831
+ const id = guidLabel.replace(/id="/g, "").replace(/"/g, "");
832
832
  builder
833
833
  .startChild('a')
834
834
  .configure((el) => {
@@ -1,6 +1,7 @@
1
1
  import { NumberMapUtils } from '@devexpress/utils/lib/utils/map/number';
2
2
  import { ColorHelper } from '../model/color/color';
3
3
  import { SearchUtils } from '@devexpress/utils/lib/utils/search';
4
+ import { MixedSize } from '../utils/mixed-size';
4
5
  export class ModelPositionHolder {
5
6
  constructor(pos, posManager) {
6
7
  this.pos = posManager.registerPosition(pos);
@@ -66,6 +67,8 @@ export class DocumentLayout {
66
67
  return this.pages.find((page) => !!page.mainSubDocumentPageAreas[subDocumentId] || !!page.otherPageAreas[subDocumentId]);
67
68
  }
68
69
  findPageIndexByOffsetY(offsetY, sizeInfo) {
69
- return Math.max(0, SearchUtils.normedInterpolationIndexOf(this.pages, (p) => sizeInfo.getPageOffsetY(p), offsetY));
70
+ const getPageOffsetY = (p) => MixedSize.fromLayout(sizeInfo.getPageOffsetY(p)).useScale(sizeInfo.zoomLevel).UISize;
71
+ const normedInterpolationIndex = SearchUtils.normedInterpolationIndexOf(this.pages, getPageOffsetY, offsetY);
72
+ return Math.max(0, normedInterpolationIndex);
70
73
  }
71
74
  }
@@ -13,8 +13,7 @@ export declare enum LayoutRowStateFlags {
13
13
  SectionEnd = 8,
14
14
  DocumentEnd = 16,
15
15
  CellTableEnd = 64,
16
- PageBreakBefore = 128,
17
- InfinityWidth = 256
16
+ PageBreakBefore = 128
18
17
  }
19
18
  export declare class LayoutRow extends Rectangle {
20
19
  boxes: LayoutBox[];
@@ -12,7 +12,6 @@ export var LayoutRowStateFlags;
12
12
  LayoutRowStateFlags[LayoutRowStateFlags["DocumentEnd"] = 16] = "DocumentEnd";
13
13
  LayoutRowStateFlags[LayoutRowStateFlags["CellTableEnd"] = 64] = "CellTableEnd";
14
14
  LayoutRowStateFlags[LayoutRowStateFlags["PageBreakBefore"] = 128] = "PageBreakBefore";
15
- LayoutRowStateFlags[LayoutRowStateFlags["InfinityWidth"] = 256] = "InfinityWidth";
16
15
  })(LayoutRowStateFlags || (LayoutRowStateFlags = {}));
17
16
  export class LayoutRow extends Rectangle {
18
17
  get hasEffectToPageHeight() { return this.boxes.length != 1 || !this.boxes[0].isSectionBreakBox; }
@@ -42,7 +42,7 @@ export class RowFormatterResult {
42
42
  return;
43
43
  this.rowFormatter.tabInfo.shiftBoxesAfterLastTab();
44
44
  const dontJustifyLinesEndingInSoftLineBreak = this.rowFormatter.manager.model.compatibilitySettings.dontJustifyLinesEndingInSoftLineBreak;
45
- if (!this.row.flags.get(LayoutRowStateFlags.InfinityWidth))
45
+ if (!this.rowFormatter.rowSizesManager.isInfinityWidth)
46
46
  BoxAligner.align(this.row, this.rowFormatter.paragraphProps.alignment, currLogicRowEndPos, this.rowBoxIndexStart, dontJustifyLinesEndingInSoftLineBreak);
47
47
  this.rowBoxIndexStart = this.row.boxes.length;
48
48
  }
@@ -19,6 +19,7 @@ export declare class RowFormattingInfo {
19
19
  lastNonEmptyIntervalIndex: number;
20
20
  tableCell: TableCell;
21
21
  private intersectsObjects;
22
+ isInfinityWidth: boolean;
22
23
  get isFloatingIntersectRow(): boolean;
23
24
  get lastNonEmptyInterval(): RowIntervalInfo;
24
25
  constructor(minY: number, height: number, outerHorizontalRowContentBounds: FixedInterval, boundsOfAnchoredOblectsOnThisColumn: AnchorObjectBoundsInfo[], tableCell: TableCell | null);
@@ -84,7 +84,7 @@ export class RowFormattingInfo {
84
84
  let index = 0;
85
85
  while (index < this.intervals.length) {
86
86
  const interval = this.intervals[index];
87
- if (interval.start <= position && position < interval.end || position < interval.start)
87
+ if (position < interval.start || interval.start <= position && position < interval.end)
88
88
  break;
89
89
  index++;
90
90
  }
@@ -109,7 +109,7 @@ export class RowFormattingInfo {
109
109
  calcIntersectObjects(height) {
110
110
  const initRect = new Rectangle(this.outerHorizontalRowContentBounds.start, this.minY, this.outerHorizontalRowContentBounds.length, height);
111
111
  return ListUtils.reducedMap(this.boundsOfAnchoredOblectsOnThisColumn, (objInfo) => {
112
- if (this.tableCell !== objInfo.cell)
112
+ if (this.tableCell !== objInfo.cell || this.isInfinityWidth)
113
113
  return null;
114
114
  const rect = Rectangle.getNonCollapsedIntersection(initRect, objInfo.bounds);
115
115
  if (!rect)
@@ -13,6 +13,8 @@ export declare class RowSizesManager {
13
13
  private row;
14
14
  rowStartPos: number;
15
15
  constructor(rowFormatter: RowFormatter, outerHorizontalRowContentBounds: FixedInterval, minY: number, rowSpacingBeforeApplier: IRowSpacingBeforeApplier, boundsOfAnchoredOblectsOnThisColumn: AnchorObjectBoundsInfo[], isFirstRowInParagraph: boolean);
16
+ get isInfinityWidth(): boolean;
17
+ set isInfinityWidth(value: boolean);
16
18
  private addNumberingListBoxes;
17
19
  addFullWord(boxes: LayoutBox[]): AddFullWordResult;
18
20
  addWordByChars(boxes: LayoutBox[]): number;
@@ -26,6 +26,8 @@ export class RowSizesManager {
26
26
  this.rowFormattingInfo = new RowFormattingInfo(minY, this.heightCalculator.currState.getFullRowHeight(), outerHorizontalRowContentBounds, boundsOfAnchoredOblectsOnThisColumn, tableCell);
27
27
  this.rowFormattingInfo.calculate();
28
28
  }
29
+ get isInfinityWidth() { return this.rowFormattingInfo.isInfinityWidth; }
30
+ set isInfinityWidth(value) { this.rowFormattingInfo.isInfinityWidth = value; }
29
31
  addNumberingListBoxes() {
30
32
  const { paragraph, result: { paragraphIndex }, numberingListCountersManager, manager: formatterManager } = this.rowFormatter;
31
33
  const counters = numberingListCountersManager.calculateCounters(paragraphIndex);
@@ -45,7 +45,7 @@ export class RowBaseFormatterState {
45
45
  return;
46
46
  if (!this.rowFormatter.rowSizesManager.addNumberingBoxes())
47
47
  return;
48
- if (this.rowFormatter.tabInfo.addTabBox())
48
+ if (this.rowFormatter.tabInfo.tryAddTabBox())
49
49
  this.rowFormatter.setState(TextRowFormatterState.Base);
50
50
  else
51
51
  this.rowFormatter.finishRow();
@@ -14,7 +14,8 @@ export declare class RowTabInfo {
14
14
  constructor(rowFormatter: RowFormatter, paragraphHorizontalBoundsStart: number);
15
15
  restart(): void;
16
16
  shiftBoxesAfterLastTab(): void;
17
- addTabBox(): boolean;
17
+ tryAddTabBox(): boolean;
18
+ private addTabBox;
18
19
  private calculateActualTabWidth;
19
20
  private calcLastVisibleBoxRightBounds;
20
21
  private getFinalCustomTabWidth;
@@ -7,7 +7,6 @@ import { SearchUtils } from '@devexpress/utils/lib/utils/search';
7
7
  import { StringUtils } from '@devexpress/utils/lib/utils/string';
8
8
  import { LayoutBoxType } from '../../layout/main-structures/layout-boxes/layout-box';
9
9
  import { TabLeaderType } from '../../layout/main-structures/layout-boxes/layout-tab-space-box';
10
- import { LayoutRowStateFlags } from '../../layout/main-structures/layout-row';
11
10
  import { TabAlign } from '../../model/paragraph/paragraph';
12
11
  import { ParagraphFirstLineIndent } from '../../model/paragraph/paragraph-properties';
13
12
  import { TabInfo } from '../../model/paragraph/paragraph-style';
@@ -61,52 +60,46 @@ export class RowTabInfo {
61
60
  }
62
61
  this.restart();
63
62
  }
64
- addTabBox() {
65
- const box = this.rowFormatter.currBox;
63
+ tryAddTabBox() {
66
64
  this.shiftBoxesAfterLastTab();
67
65
  let tabPosition = this.getNextCustomTabPosition(this.currInterval.startOfFreeSpace);
68
- const isCustomNonLeftTabPosition = tabPosition && !EnumUtils.isAnyOf(tabPosition.alignment, TabAlign.Left, TabAlign.Numbering);
66
+ const isCustomNonLeftTabPosition = tabPosition && !tabPosition.isLeftAlignment;
69
67
  let tabXPosRelativePage = tabPosition ? tabPosition.position : this.getNextDefaultTabPosition(this.currInterval.startOfFreeSpace);
70
68
  if (tabXPosRelativePage > this.currInterval.end) {
71
- let ind = this.rowFormatter.rowSizesManager.rowFormattingInfo.indexOfIntervalContainsPositon(tabXPosRelativePage);
72
- if (ind != this.rowFormatter.rowSizesManager.rowFormattingInfo.currIndex) {
73
- if (isCustomNonLeftTabPosition)
74
- tabXPosRelativePage = this.currInterval.end;
75
- else {
76
- this.rowFormatter.rowSizesManager.finishLogicalRow(ind, this.currInterval.end);
77
- tabPosition = this.getNextCustomTabPosition(this.currInterval.startOfFreeSpace);
78
- tabXPosRelativePage = tabPosition ? tabPosition.position : this.getNextDefaultTabPosition(this.currInterval.startOfFreeSpace);
79
- }
69
+ if (this.rowFormatter.manager.model.compatibilitySettings.compatibilityMode < CompatibilityMode.Word2013 && tabPosition && !tabPosition.isParagraphIndent) {
70
+ const interval = this.rowFormatter.rowSizesManager.rowFormattingInfo.outerHorizontalRowContentBounds;
71
+ interval.length = Number.MAX_SAFE_INTEGER - interval.start;
72
+ this.rowFormatter.rowSizesManager.isInfinityWidth = true;
73
+ this.rowFormatter.rowSizesManager.rowFormattingInfo.recalculate(interval);
74
+ this.row.width = Number.MAX_SAFE_INTEGER;
75
+ return this.tryAddTabBox();
80
76
  }
81
- }
82
- box.x = this.currInterval.startOfFreeSpace;
83
- box.width = !isCustomNonLeftTabPosition ? tabXPosRelativePage - box.x : 0;
84
- const tabBox = box.getLayoutTabBox(tabPosition ? tabPosition.leader : TabLeaderType.None);
85
- const lastInterval = ListUtils.last(this.rowFormatter.rowSizesManager.rowFormattingInfo.intervals);
86
- if (tabXPosRelativePage > lastInterval.end) {
87
- if (lastInterval.end < this.rowFormatter.paragraphHorizontalBounds.end) {
88
- if (this.rowFormatter.manager.model.compatibilitySettings.compatibilityMode < CompatibilityMode.Word2013 && tabPosition && !tabPosition.isParagraphIndent) {
89
- const interval = this.rowFormatter.rowSizesManager.rowFormattingInfo.outerHorizontalRowContentBounds;
90
- interval.length = Number.MAX_SAFE_INTEGER - interval.start;
91
- this.rowFormatter.rowSizesManager.rowFormattingInfo.recalculate(interval);
92
- this.row.width = Number.MAX_SAFE_INTEGER;
93
- this.row.flags.set(LayoutRowStateFlags.InfinityWidth, true);
94
- return this.addTabBox();
95
- }
96
- else if (tabBox.right < this.rowFormatter.paragraphHorizontalBounds.end) {
97
- const delta = this.rowFormatter.paragraphHorizontalBounds.end - lastInterval.end;
98
- let canIncrease = !isCustomNonLeftTabPosition;
99
- if (canIncrease && this.rowFormatter.rowSizesManager.rowFormattingInfo.isFloatingIntersectRow) {
100
- canIncrease = !IntervalAlgorithms.getIntersection(new FixedInterval(lastInterval.end, delta), ListUtils.last(this.rowFormatter.rowSizesManager.rowFormattingInfo.busyIntervals));
77
+ else {
78
+ let ind = this.rowFormatter.rowSizesManager.rowFormattingInfo.indexOfIntervalContainsPositon(tabXPosRelativePage);
79
+ if (ind != this.rowFormatter.rowSizesManager.rowFormattingInfo.currIndex) {
80
+ if (isCustomNonLeftTabPosition) {
81
+ this.addTabBox(tabPosition, this.currInterval.end);
82
+ return true;
101
83
  }
102
- if (canIncrease) {
103
- lastInterval.end = this.rowFormatter.paragraphHorizontalBounds.end;
104
- lastInterval.avaliableWidth += delta;
105
- this.row.width += delta;
106
- return this.addTabBox();
84
+ else {
85
+ this.rowFormatter.rowSizesManager.finishLogicalRow(ind, this.currInterval.end);
86
+ tabPosition = this.getNextCustomTabPosition(this.currInterval.startOfFreeSpace);
87
+ return this.tryAddTabBox();
107
88
  }
108
89
  }
109
90
  }
91
+ const extraSpace = this.rowFormatter.paragraphHorizontalBounds.end - this.currInterval.end;
92
+ if (extraSpace > 0) {
93
+ let canIncrease = !isCustomNonLeftTabPosition;
94
+ if (canIncrease && this.rowFormatter.rowSizesManager.rowFormattingInfo.isFloatingIntersectRow)
95
+ canIncrease = !IntervalAlgorithms.getIntersection(new FixedInterval(this.currInterval.end, extraSpace), ListUtils.last(this.rowFormatter.rowSizesManager.rowFormattingInfo.busyIntervals));
96
+ if (canIncrease) {
97
+ this.currInterval.end = this.rowFormatter.paragraphHorizontalBounds.end;
98
+ this.currInterval.avaliableWidth += extraSpace;
99
+ this.row.width += extraSpace;
100
+ return this.tryAddTabBox();
101
+ }
102
+ }
110
103
  if (!this.row.isEmpty() && !isCustomNonLeftTabPosition)
111
104
  return false;
112
105
  if (this.rowFormatter.rowSizesManager.rowFormattingInfo.isFloatingIntersectRow && !isCustomNonLeftTabPosition) {
@@ -114,13 +107,20 @@ export class RowTabInfo {
114
107
  this.rowFormatter.rowSizesManager.restartAllRow(false);
115
108
  while (EnumUtils.isAnyOf(this.rowFormatter.currBox.getType(), LayoutBoxType.AnchorPicture, LayoutBoxType.AnchorTextBox))
116
109
  this.rowFormatter.setBoxInfo(true);
117
- return this.addTabBox();
110
+ return this.tryAddTabBox();
118
111
  }
119
112
  }
113
+ this.addTabBox(tabPosition, tabXPosRelativePage);
114
+ return true;
115
+ }
116
+ addTabBox(tabPosition, tabXPosRelativePage) {
117
+ const box = this.rowFormatter.currBox;
118
+ box.x = this.currInterval.startOfFreeSpace;
119
+ box.width = (!tabPosition || tabPosition.isLeftAlignment) ? tabXPosRelativePage - box.x : 0;
120
+ const tabBox = box.getLayoutTabBox(tabPosition ? tabPosition.leader : TabLeaderType.None);
120
121
  this.rowFormatter.rowSizesManager.addTabBox(tabBox);
121
122
  this.lastTabPosition = tabPosition ? tabPosition : new TabInfo(tabXPosRelativePage, TabAlign.Left, TabLeaderType.None, false, false);
122
123
  this.lastTabBoxIndex = this.row.boxes.length - 1;
123
- return true;
124
124
  }
125
125
  calculateActualTabWidth(prevTabBox) {
126
126
  const prevTabBoxXPos = prevTabBox.x;
@@ -25,7 +25,7 @@ export class WordHolderInfo {
25
25
  }
26
26
  if (res == null)
27
27
  return false;
28
- if (this.rowFormatter.row.isEmpty()) {
28
+ if (this.rowFormatter.row.isEmpty() || this.rowFormatter.row.containsSpacesOnly()) {
29
29
  if (this.rowFormatter.rowSizesManager.rowFormattingInfo.isFloatingIntersectRow) {
30
30
  this.rowFormatter.rowSizesManager.rowFormattingInfo.findNextYPosWhatHasNeededSpace(res.requiredWidth);
31
31
  return this.pushBoxes();