@talrace/ngx-noder 19.0.47 → 19.0.48

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.
@@ -2486,7 +2486,7 @@ class LinkModel {
2486
2486
 
2487
2487
  class LinkHelper {
2488
2488
  static sliceSection(links, start, end) {
2489
- return links.map(link => LinkHelper.getPartialLink(link, start, end)).filter((link) => link !== null);
2489
+ return links.map(link => LinkHelper.getPartialLink(link, start, end)).filter(x => x !== null);
2490
2490
  }
2491
2491
  static shiftIndexes(links, offset) {
2492
2492
  for (const link of links) {
@@ -2509,7 +2509,7 @@ class LinkHelper {
2509
2509
  }
2510
2510
  const newStart = Math.max(link.startIndex, selectionStart);
2511
2511
  const newEnd = Math.min(link.endIndex, selectionEnd);
2512
- const newFormats = link.formats
2512
+ const formats = link.formats
2513
2513
  .map(format => {
2514
2514
  const formatStart = link.startIndex + format.startIndex;
2515
2515
  const formatEnd = link.startIndex + format.endIndex;
@@ -2518,10 +2518,11 @@ class LinkHelper {
2518
2518
  }
2519
2519
  const newFormatStart = Math.max(formatStart, newStart) - newStart;
2520
2520
  const newFormatEnd = Math.min(formatEnd, newEnd) - newStart;
2521
- return new FormatModel({ ...format, startIndex: newFormatStart, endIndex: newFormatEnd });
2521
+ const textStyle = new TextStyleModel(format.textStyle);
2522
+ return new FormatModel({ startIndex: newFormatStart, endIndex: newFormatEnd, textStyle });
2522
2523
  })
2523
- .filter((format) => format !== null);
2524
- return new LinkModel({ ...link, startIndex: newStart, endIndex: newEnd, formats: newFormats });
2524
+ .filter(x => x !== null);
2525
+ return new LinkModel({ ...link, startIndex: newStart, endIndex: newEnd, formats });
2525
2526
  }
2526
2527
  }
2527
2528
 
@@ -3224,22 +3225,21 @@ class FormatOperationsHelper {
3224
3225
  for (let i = formats.length - 1; i >= 0; i--) {
3225
3226
  if (formats[i].startIndex >= startIndex && formats[i].endIndex <= endIndex) {
3226
3227
  formats.splice(i, 1);
3228
+ continue;
3227
3229
  }
3228
- }
3229
- formats.forEach(x => {
3230
- if (x.startIndex >= startIndex && x.startIndex <= endIndex) {
3231
- x.startIndex = startIndex;
3230
+ if (formats[i].startIndex > endIndex) {
3231
+ formats[i].startIndex -= length;
3232
3232
  }
3233
- else if (x.startIndex > endIndex) {
3234
- x.startIndex -= length;
3233
+ else if (formats[i].startIndex >= startIndex) {
3234
+ formats[i].startIndex = startIndex;
3235
3235
  }
3236
- if (x.endIndex >= startIndex && x.endIndex <= endIndex) {
3237
- x.endIndex = startIndex - 1;
3236
+ if (formats[i].endIndex > endIndex) {
3237
+ formats[i].endIndex -= length;
3238
3238
  }
3239
- else if (x.endIndex > endIndex) {
3240
- x.endIndex -= length;
3239
+ else if (formats[i].endIndex >= startIndex) {
3240
+ formats[i].endIndex = startIndex - 1;
3241
3241
  }
3242
- });
3242
+ }
3243
3243
  FormatStyleHelper.mergeFormats(formats, startIndex - 1, startIndex);
3244
3244
  }
3245
3245
  static insertContent(formats, index, textLength) {
@@ -3317,15 +3317,17 @@ class ImageOperationsHelper {
3317
3317
  }
3318
3318
 
3319
3319
  class LinkOperationsHelper {
3320
- static insert(links, link, startIndex, length, linkStyle) {
3320
+ static insert(links, link, startIndex, length, style) {
3321
3321
  LinkOperationsHelper.insertContent(links, startIndex, length);
3322
- const linkModel = new LinkModel({
3323
- startIndex,
3324
- link,
3325
- endIndex: startIndex + length - 1,
3326
- formats: [new FormatModel({ startIndex: 0, endIndex: length - 1, textStyle: linkStyle })]
3322
+ const textStyle = new TextStyleModel({
3323
+ ...style,
3324
+ fontColor: HYPERLINK_FONT_COLOR,
3325
+ underline: true,
3326
+ headingStyleId: HYPERLINK_HEADING_STYLE_ID
3327
3327
  });
3328
- const index = links.findIndex(x => x.startIndex > linkModel.startIndex);
3328
+ const formats = [new FormatModel({ startIndex: 0, endIndex: length - 1, textStyle })];
3329
+ const linkModel = new LinkModel({ startIndex, link, endIndex: startIndex + length - 1, formats });
3330
+ const index = links.findIndex(x => x.startIndex > startIndex);
3329
3331
  if (index < 0) {
3330
3332
  links.push(linkModel);
3331
3333
  }
@@ -5888,13 +5890,8 @@ class OperationsHelper {
5888
5890
  IndexedElementOperationsHelper.insertContent(document.tabs, index, text.length);
5889
5891
  RangeElementHelper.insertContent(document.comments, index, text.length);
5890
5892
  PageFormatOperationsHelper.insertContent(document, index, text.length);
5891
- const formatStyle = FormatStyleHelper.getFormatAtIndex(document.formats, index).textStyle;
5892
- LinkOperationsHelper.insert(document.links, link, index, text.length, {
5893
- ...formatStyle,
5894
- fontColor: HYPERLINK_FONT_COLOR,
5895
- underline: true,
5896
- headingStyleId: HYPERLINK_HEADING_STYLE_ID
5897
- });
5893
+ const style = FormatStyleHelper.getFormatAtIndex(document.formats, index).textStyle;
5894
+ LinkOperationsHelper.insert(document.links, link, index, text.length, style);
5898
5895
  }
5899
5896
  static addNumbering(target, numberings, startIndex, endIndex, levels, numberingId = null) {
5900
5897
  const newNumberingId = numberingId ?? NumberingOperationsHelper.generateNumberingId(numberings);
@@ -13982,11 +13979,11 @@ class SaveCommandsHelper {
13982
13979
  const insertTableRows = new InsertTableRowsModel({ count: rowsCount, inheritIndex, insertIndex, targetIndex });
13983
13980
  return new CommandModel({ commandType: CommandType.InsertTableRows, insertTableRows, targets });
13984
13981
  }
13985
- static getRemoveTableColumnsCommand(startIndex, endIndex, insertIndex, targets) {
13982
+ static getRemoveTableColumnsCommand(insertIndex, startIndex, endIndex, targets) {
13986
13983
  const removeTableColumns = new RemoveTableColumnsModel({ startIndex, endIndex, insertIndex });
13987
13984
  return new CommandModel({ commandType: CommandType.RemoveTableColumns, removeTableColumns, targets });
13988
13985
  }
13989
- static getRemoveTableRowsCommand(startIndex, endIndex, insertIndex, targets) {
13986
+ static getRemoveTableRowsCommand(insertIndex, startIndex, endIndex, targets) {
13990
13987
  const removeTableRows = new RemoveTableRowsModel({ startIndex, endIndex, insertIndex });
13991
13988
  return new CommandModel({ commandType: CommandType.RemoveTableRows, removeTableRows, targets });
13992
13989
  }