@talrace/ngx-noder 0.0.35 → 0.0.36

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.
@@ -3694,7 +3694,7 @@ class RenderingHelper {
3694
3694
  }
3695
3695
  else {
3696
3696
  const paddingLeft = textFragment.startsWith(' ') && lineInfo.wordSpacing ? lineInfo.wordSpacing : null;
3697
- this.renderText(fragment, formatExt, textFragment, paddingLeft);
3697
+ this.renderText(fragment, formatExt, textFragmentWithoutBreaks, paddingLeft);
3698
3698
  }
3699
3699
  return textFragment.length;
3700
3700
  }
@@ -5261,7 +5261,7 @@ class Selection {
5261
5261
  }
5262
5262
  selectAll(model) {
5263
5263
  const last = model.paragraphs.length - 1;
5264
- const length = last > 0 ? model.contentLength - model.paragraphs[last - 1].insertIndex - 1 : model.contentLength;
5264
+ const length = last > 0 ? model.content.length - model.paragraphs[last - 1].insertIndex - 1 : model.content.length;
5265
5265
  this.placeSelection(new CursorParagraph(0, 0), new CursorParagraph(last, length));
5266
5266
  }
5267
5267
  selectUp(session) {
@@ -5915,7 +5915,7 @@ class Editor {
5915
5915
  }
5916
5916
  setTextStyle(textStyle) {
5917
5917
  const index = ContentHelper.paragraphPositionToDocumentIndex(this.session.displayData.paragraphs, this.selection.cursor);
5918
- const isParagraph = this.session.model.contentLength === index || this.session.model.content[index] === NEW_LINE_MARKUP;
5918
+ const isParagraph = this.session.model.content.length === index || this.session.model.content[index] === NEW_LINE_MARKUP;
5919
5919
  if (isParagraph) {
5920
5920
  this.saveApplyTextStyleToHistory(index, index, textStyle);
5921
5921
  this.session.applyTextStyle(index, index, textStyle);
@@ -10516,7 +10516,6 @@ class EdgesOperationsHelper {
10516
10516
  pageType,
10517
10517
  breaks: [],
10518
10518
  content: '',
10519
- contentLength: 0,
10520
10519
  elements: [],
10521
10520
  formats: [new FormatModel({ startIndex: 0, endIndex: 0, textStyle: DEFAULT_TEXT_STYLE })],
10522
10521
  images: [],
@@ -10962,7 +10961,6 @@ class TableOperationsHelper {
10962
10961
  const cell = new CellModel({
10963
10962
  breaks: [],
10964
10963
  content: '',
10965
- contentLength: 0,
10966
10964
  elements: [],
10967
10965
  formats: [new FormatModel({ startIndex: 0, endIndex: 0, textStyle: DEFAULT_TEXT_STYLE })],
10968
10966
  images: [],
@@ -11065,7 +11063,6 @@ class TableOperationsHelper {
11065
11063
  ...matrix[inheritIndex].cells[i],
11066
11064
  breaks: [],
11067
11065
  content: '',
11068
- contentLength: 0,
11069
11066
  elements: [],
11070
11067
  images: [],
11071
11068
  formats: [
@@ -11102,7 +11099,6 @@ class TableOperationsHelper {
11102
11099
  ...x,
11103
11100
  breaks: [],
11104
11101
  content: '',
11105
- contentLength: 0,
11106
11102
  elements: [],
11107
11103
  formats: [new FormatModel({ startIndex: 0, endIndex: 0, textStyle: new TextStyleModel(x.formats[0].textStyle) })],
11108
11104
  images: [],
@@ -11155,7 +11151,6 @@ class TableOperationsHelper {
11155
11151
  ...row.cells[inheritIndex],
11156
11152
  breaks: [],
11157
11153
  content: '',
11158
- contentLength: 0,
11159
11154
  elements: [],
11160
11155
  formats: [new FormatModel({ startIndex: 0, endIndex: 0, textStyle: row.cells[inheritIndex].formats[0].textStyle })],
11161
11156
  horizontalMerge: null,
@@ -11239,7 +11234,6 @@ class TableOperationsHelper {
11239
11234
  matrix[rowIndex].cells[cellIndex].breaks = removedCell.breaks;
11240
11235
  matrix[rowIndex].cells[cellIndex].columnSections = removedCell.columnSections;
11241
11236
  matrix[rowIndex].cells[cellIndex].content = removedCell.content;
11242
- matrix[rowIndex].cells[cellIndex].contentLength = removedCell.contentLength;
11243
11237
  matrix[rowIndex].cells[cellIndex].elements = removedCell.elements;
11244
11238
  matrix[rowIndex].cells[cellIndex].formats = removedCell.formats;
11245
11239
  matrix[rowIndex].cells[cellIndex].horizontalMerge = removedCell.horizontalMerge;
@@ -11299,8 +11293,8 @@ class TableOperationsHelper {
11299
11293
  static calculateCellsWidth(table) {
11300
11294
  table.rows.forEach(row => {
11301
11295
  let columnIndex = 0;
11302
- for (let i = 0; i < row.cells.length; i++) {
11303
- let cell = row.cells[i];
11296
+ for (const element of row.cells) {
11297
+ let cell = element;
11304
11298
  if (cell.horizontalMerge) {
11305
11299
  let width = table.columns[columnIndex].width;
11306
11300
  for (let j = 1; j < cell.horizontalMerge; j++) {
@@ -11593,7 +11587,6 @@ class OperationsHelper {
11593
11587
  }
11594
11588
  static insertText(document, text, index) {
11595
11589
  document.content = ContentOperationsHelper.insertContent(document.content, text, index);
11596
- document.contentLength = document.content.length;
11597
11590
  FormatOperationsHelper.insertContent(document.formats, index, text.length);
11598
11591
  ParagraphOperationsHelper.insertContent(document.paragraphs, text, index);
11599
11592
  IndexedElementOperationsHelper.insertContent(document.images, index, text.length);
@@ -11607,7 +11600,6 @@ class OperationsHelper {
11607
11600
  const createdParagraphs = ParagraphOperationsHelper.insertParagraphsFromModel(document.paragraphs, index);
11608
11601
  const text = createdParagraphs.map(() => NEW_LINE_MARKUP).join('');
11609
11602
  document.content = ContentOperationsHelper.insertContent(document.content, text, index);
11610
- document.contentLength = document.content.length;
11611
11603
  FormatOperationsHelper.insertContent(document.formats, index, text.length);
11612
11604
  IndexedElementOperationsHelper.insertContent(document.images, index, text.length);
11613
11605
  IndexedElementOperationsHelper.insertContent(document.tables, index, text.length);
@@ -11635,7 +11627,6 @@ class OperationsHelper {
11635
11627
  }
11636
11628
  static insertElement(document, element) {
11637
11629
  document.content = ContentOperationsHelper.insertContent(document.content, CUSTOM_ELEMENT_MARKER, element.element.insertIndex);
11638
- document.contentLength = document.content.length;
11639
11630
  FormatOperationsHelper.insertContent(document.formats, element.element.insertIndex, 1);
11640
11631
  IndexedElementOperationsHelper.insertContent(document.paragraphs, element.element.insertIndex, 1);
11641
11632
  IndexedElementOperationsHelper.insertContent(document.images, element.element.insertIndex, 1);
@@ -11647,7 +11638,6 @@ class OperationsHelper {
11647
11638
  }
11648
11639
  static insertBreak(document, text, index, breakType) {
11649
11640
  document.content = ContentOperationsHelper.insertContent(document.content, text, index);
11650
- document.contentLength = document.content.length;
11651
11641
  FormatOperationsHelper.insertContent(document.formats, index, text.length);
11652
11642
  ParagraphOperationsHelper.insertContent(document.paragraphs, text, index);
11653
11643
  IndexedElementOperationsHelper.insertContent(document.images, index, text.length);
@@ -11659,7 +11649,6 @@ class OperationsHelper {
11659
11649
  }
11660
11650
  static insertTab(document, index) {
11661
11651
  document.content = ContentOperationsHelper.insertContent(document.content, CUSTOM_ELEMENT_MARKER, index);
11662
- document.contentLength = document.content.length;
11663
11652
  FormatOperationsHelper.insertContent(document.formats, index, 1);
11664
11653
  IndexedElementOperationsHelper.insertContent(document.paragraphs, index, 1);
11665
11654
  IndexedElementOperationsHelper.insertContent(document.images, index, 1);
@@ -11671,7 +11660,6 @@ class OperationsHelper {
11671
11660
  }
11672
11661
  static insertLink(document, text, link, index) {
11673
11662
  document.content = ContentOperationsHelper.insertContent(document.content, text, index);
11674
- document.contentLength = document.content.length;
11675
11663
  FormatOperationsHelper.insertContent(document.formats, index, text.length);
11676
11664
  ParagraphOperationsHelper.insertContent(document.paragraphs, text, index);
11677
11665
  IndexedElementOperationsHelper.insertContent(document.images, index, text.length);
@@ -11710,7 +11698,6 @@ class OperationsHelper {
11710
11698
  }
11711
11699
  static insertImage(document, index, imageData) {
11712
11700
  document.content = ContentOperationsHelper.insertContent(document.content, CUSTOM_ELEMENT_MARKER, index);
11713
- document.contentLength = document.content.length;
11714
11701
  FormatOperationsHelper.insertContent(document.formats, index, 1);
11715
11702
  IndexedElementOperationsHelper.insertContent(document.paragraphs, index, 1);
11716
11703
  IndexedElementOperationsHelper.insertContent(document.tables, index, 1);
@@ -11722,7 +11709,6 @@ class OperationsHelper {
11722
11709
  }
11723
11710
  static insertTable(document, index, tableModel, contentWidth) {
11724
11711
  document.content = ContentOperationsHelper.insertContent(document.content, tableModel.content, index);
11725
- document.contentLength = document.content.length;
11726
11712
  FormatOperationsHelper.insertContent(document.formats, index, tableModel.content.length);
11727
11713
  ParagraphOperationsHelper.insertContent(document.paragraphs, tableModel.content, index);
11728
11714
  IndexedElementOperationsHelper.insertContent(document.images, index, tableModel.content.length);
@@ -11734,7 +11720,6 @@ class OperationsHelper {
11734
11720
  }
11735
11721
  static insertStyledText(document, text, index, style) {
11736
11722
  document.content = ContentOperationsHelper.insertContent(document.content, text, index);
11737
- document.contentLength = document.content.length;
11738
11723
  FormatOperationsHelper.insertStyledContent(document.formats, index, text.length, style);
11739
11724
  ParagraphOperationsHelper.insertContent(document.paragraphs, text, index);
11740
11725
  IndexedElementOperationsHelper.insertContent(document.images, index, text.length);
@@ -11752,7 +11737,6 @@ class OperationsHelper {
11752
11737
  }
11753
11738
  static restore(document, model) {
11754
11739
  document.content = ContentOperationsHelper.insertContent(document.content, model.text, model.startIndex);
11755
- document.contentLength = document.content.length;
11756
11740
  FormatOperationsHelper.restore(document.formats, model.startIndex, model.text.length, model.formats);
11757
11741
  IndexedElementOperationsHelper.restore(document.paragraphs, model.startIndex, model.text.length, model.paragraphs);
11758
11742
  IndexedElementOperationsHelper.restore(document.images, model.startIndex, model.text.length, model.images);
@@ -11764,7 +11748,6 @@ class OperationsHelper {
11764
11748
  }
11765
11749
  static delete(document, startIndex, count) {
11766
11750
  document.content = ContentOperationsHelper.removeContent(document.content, startIndex, count);
11767
- document.contentLength = document.content.length;
11768
11751
  const endIndex = startIndex + count - 1;
11769
11752
  FormatOperationsHelper.removeContent(document.formats, startIndex, endIndex);
11770
11753
  IndexedElementOperationsHelper.removeContent(document.paragraphs, startIndex, endIndex);
@@ -11777,7 +11760,6 @@ class OperationsHelper {
11777
11760
  }
11778
11761
  static replaceText(document, startIndex, endIndex, text) {
11779
11762
  document.content = ContentOperationsHelper.replaceContent(document.content, startIndex, endIndex, text);
11780
- document.contentLength = document.content.length;
11781
11763
  FormatOperationsHelper.replaceContent(document.formats, startIndex, endIndex, text.length);
11782
11764
  ParagraphOperationsHelper.replace(document.paragraphs, text, startIndex, endIndex);
11783
11765
  IndexedElementOperationsHelper.replaceContent(document.images, startIndex, endIndex, text.length);
@@ -12061,6 +12043,7 @@ class EditSession {
12061
12043
  const endParagraph = ContentHelper.documentIndexToParagraphIndex(this.displayData.paragraphs, endIndex).row;
12062
12044
  OperationsHelper.applyTextStyle(this.model, startIndex, endIndex, textStyle);
12063
12045
  this.provideTextStyle(startIndex, endIndex);
12046
+ this.displayData.resetAllNumberingInfo(startParagraph);
12064
12047
  this.displayData.updateNextLineIndexes(startParagraph, endParagraph);
12065
12048
  this.setTextStyle(textStyle);
12066
12049
  }
@@ -12068,6 +12051,7 @@ class EditSession {
12068
12051
  const startParagraph = ContentHelper.documentIndexToParagraphIndex(this.displayData.paragraphs, startIndex).row;
12069
12052
  const endParagraph = ContentHelper.documentIndexToParagraphIndex(this.displayData.paragraphs, endIndex).row;
12070
12053
  OperationsHelper.applyParagraphStyle(this.model, startIndex, endIndex, paragraphStyle);
12054
+ this.displayData.resetAllNumberingInfo(startParagraph);
12071
12055
  this.displayData.updateNextLineIndexes(startParagraph, endParagraph);
12072
12056
  this.applyToolbarStyles();
12073
12057
  }
@@ -12121,6 +12105,7 @@ class EditSession {
12121
12105
  imageComponentRef.instance.resize({ width: applyImage.width, height: applyImage.height });
12122
12106
  OperationsHelper.applyImageStyle(this.model, applyImage);
12123
12107
  const start = this.displayData.indexToPosition(applyImage.insertIndex, 0);
12108
+ this.displayData.resetAllNumberingInfo(start.row);
12124
12109
  this.displayData.updateNextLineIndexes(start.row, this.displayData.paragraphs.length - 1);
12125
12110
  }
12126
12111
  restoreTextStyles(formats, linkFormats) {
@@ -12130,6 +12115,7 @@ class EditSession {
12130
12115
  const endPosition = ContentHelper.documentIndexToParagraphWithOffset(this.displayData.paragraphs, endIndex);
12131
12116
  OperationsHelper.restoreTextStyles(this.model, formats, linkFormats);
12132
12117
  this.provideTextStyle(startIndex, endIndex);
12118
+ this.displayData.resetAllNumberingInfo(startParagraph);
12133
12119
  this.displayData.updateNextLineIndexes(startParagraph, endPosition.row);
12134
12120
  this.selection.placeCursor(endPosition);
12135
12121
  this.applyToolbarStyles();
@@ -12303,6 +12289,7 @@ class EditSession {
12303
12289
  const insertIndex = ContentHelper.paragraphPositionToDocumentIndex(this.displayData.paragraphs, position);
12304
12290
  const text = OperationsHelper.insertParagraph(this.model, insertIndex, paragraphModel, this.displayData.contentWidth);
12305
12291
  const endPosition = this.displayData.insertText(position, text);
12292
+ this.displayData.resetAllNumberingInfo(position.row);
12306
12293
  this.displayData.updateNextLineIndexes(position.row, endPosition.row);
12307
12294
  if (endPosition.row - position.row) {
12308
12295
  this.displayData.updateNumberingsDataOnChange(endPosition.row);
@@ -12311,6 +12298,7 @@ class EditSession {
12311
12298
  if (paragraphModel.insertText) {
12312
12299
  const paragraphPosition = ContentHelper.documentIndexToParagraphIndex(this.displayData.paragraphs, paragraphModel.insertText.insertIndex);
12313
12300
  endPoint = this.displayData.insertText(paragraphPosition, text);
12301
+ this.displayData.resetAllNumberingInfo(paragraphPosition.row);
12314
12302
  this.displayData.updateNextLineIndexes(paragraphPosition.row, endPoint.row);
12315
12303
  if (endPoint.row - paragraphPosition.row) {
12316
12304
  this.displayData.updateNumberingsDataOnChange(endPoint.row);
@@ -12323,6 +12311,7 @@ class EditSession {
12323
12311
  const model = this.model.images.find(x => x.insertIndex === imageInsertIndex);
12324
12312
  this.addComponent(this.customComponents.images, model, NoderImageComponent);
12325
12313
  endPoint = this.displayData.insertText(paragraphPosition, CUSTOM_ELEMENT_MARKER);
12314
+ this.displayData.resetAllNumberingInfo(paragraphPosition.row);
12326
12315
  this.displayData.updateNextLineIndexes(paragraphPosition.row, paragraphPosition.row);
12327
12316
  this.selection.placeCursor(endPoint);
12328
12317
  }
@@ -12331,6 +12320,7 @@ class EditSession {
12331
12320
  const model = this.model.tables.find(x => x.insertIndex === paragraphModel.insertTable.insertTableIndex);
12332
12321
  this.addComponent(this.customComponents.tables, model, NoderTableComponent);
12333
12322
  endPoint = this.displayData.insertText(paragraphPosition, paragraphModel.insertTable.content);
12323
+ this.displayData.resetAllNumberingInfo(paragraphPosition.row);
12334
12324
  this.displayData.updateNextLineIndexes(paragraphPosition.row, endPoint.row);
12335
12325
  if (endPoint.row - paragraphPosition.row) {
12336
12326
  this.displayData.updateNumberingsDataOnChange(endPoint.row);
@@ -15680,7 +15670,6 @@ class RevisionHelper {
15680
15670
  const pageMargin = new MarginModel();
15681
15671
  return new DocxModel({
15682
15672
  content: '',
15683
- contentLength: 0,
15684
15673
  headings: DEFAULT_HEADINGS,
15685
15674
  pageHeight: DocumentInfo.height,
15686
15675
  pageWidth: DocumentInfo.width,