@talrace/ngx-noder 19.0.47 → 19.0.49
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.
- package/fesm2022/talrace-ngx-noder.mjs +34 -45
- package/fesm2022/talrace-ngx-noder.mjs.map +1 -1
- package/lib/editor/operations/helpers/link-operations.helper.d.ts +1 -1
- package/lib/editor/operations/save-commands.helper.d.ts +2 -2
- package/lib/editor/operations/target-operations.helper.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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(
|
|
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
|
|
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
|
-
|
|
2521
|
+
const textStyle = new TextStyleModel(format.textStyle);
|
|
2522
|
+
return new FormatModel({ startIndex: newFormatStart, endIndex: newFormatEnd, textStyle });
|
|
2522
2523
|
})
|
|
2523
|
-
.filter(
|
|
2524
|
-
return new LinkModel({ ...link, startIndex: newStart, endIndex: newEnd, formats
|
|
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
|
-
|
|
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 (
|
|
3234
|
-
|
|
3233
|
+
else if (formats[i].startIndex >= startIndex) {
|
|
3234
|
+
formats[i].startIndex = startIndex;
|
|
3235
3235
|
}
|
|
3236
|
-
if (
|
|
3237
|
-
|
|
3236
|
+
if (formats[i].endIndex > endIndex) {
|
|
3237
|
+
formats[i].endIndex -= length;
|
|
3238
3238
|
}
|
|
3239
|
-
else if (
|
|
3240
|
-
|
|
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,
|
|
3320
|
+
static insert(links, link, startIndex, length, style) {
|
|
3321
3321
|
LinkOperationsHelper.insertContent(links, startIndex, length);
|
|
3322
|
-
const
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
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
|
|
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
|
}
|
|
@@ -5527,7 +5529,7 @@ class TargetOperationsHelper {
|
|
|
5527
5529
|
static getContents(document, targets) {
|
|
5528
5530
|
let result = document;
|
|
5529
5531
|
for (const target of targets) {
|
|
5530
|
-
result = this.getTargetContents(
|
|
5532
|
+
result = this.getTargetContents(result, target, document);
|
|
5531
5533
|
}
|
|
5532
5534
|
return result;
|
|
5533
5535
|
}
|
|
@@ -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
|
|
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);
|
|
@@ -6879,17 +6876,11 @@ class DisplayTokenHelper {
|
|
|
6879
6876
|
});
|
|
6880
6877
|
}
|
|
6881
6878
|
static getSymbolToken(symbol, fontString, index) {
|
|
6882
|
-
|
|
6879
|
+
return new DisplayToken({
|
|
6883
6880
|
...FontMetrics.measureCharSize(symbol, fontString),
|
|
6884
6881
|
displayValue: this.getSymbolDisplayValue(symbol),
|
|
6885
6882
|
index
|
|
6886
6883
|
});
|
|
6887
|
-
if (result.isSpace) {
|
|
6888
|
-
result.ascent = 0;
|
|
6889
|
-
result.descent = 0;
|
|
6890
|
-
result.height = 0;
|
|
6891
|
-
}
|
|
6892
|
-
return result;
|
|
6893
6884
|
}
|
|
6894
6885
|
static getComponentTokens(component, fontString, index) {
|
|
6895
6886
|
if (component.instance instanceof ExternalComponent && component.instance.isText) {
|
|
@@ -7086,6 +7077,7 @@ class LineInfoHelper {
|
|
|
7086
7077
|
let maxAscent = 0;
|
|
7087
7078
|
let maxDescent = 0;
|
|
7088
7079
|
let i = 0;
|
|
7080
|
+
const length = tokens[tokens.length - 1].isParagraph && tokens.length > 1 ? tokens.length - 1 : tokens.length;
|
|
7089
7081
|
do {
|
|
7090
7082
|
if (maxAscent < tokens[i].ascent) {
|
|
7091
7083
|
maxAscent = tokens[i].ascent;
|
|
@@ -7095,10 +7087,7 @@ class LineInfoHelper {
|
|
|
7095
7087
|
}
|
|
7096
7088
|
line.width += tokens[i].width;
|
|
7097
7089
|
i++;
|
|
7098
|
-
} while (i <
|
|
7099
|
-
if (tokens.length > 1 && tokens[tokens.length - 1].isParagraph) {
|
|
7100
|
-
line.width -= tokens[tokens.length - 1].width;
|
|
7101
|
-
}
|
|
7090
|
+
} while (i < length);
|
|
7102
7091
|
line.height = maxAscent + maxDescent;
|
|
7103
7092
|
line.ascent = maxAscent;
|
|
7104
7093
|
if (line.height === 0) {
|
|
@@ -13354,7 +13343,7 @@ class RenderingHelper {
|
|
|
13354
13343
|
this.renderText(fragment, textStyle, textBeforeElement, wordSpacing);
|
|
13355
13344
|
renderedIndexes += textBeforeElement.length;
|
|
13356
13345
|
if (component.instance instanceof ExternalComponent && component.instance.isText) {
|
|
13357
|
-
const rendered = this.renderExternalText(fragment, textStyle, wordSpacing, component.instance, line, renderedTokensInLine, paragraphStartIndex);
|
|
13346
|
+
const rendered = this.renderExternalText(fragment, textStyle, wordSpacing, component.instance, line, renderedTokensInLine + renderedIndexes + additionalTokens, paragraphStartIndex);
|
|
13358
13347
|
renderedIndexes += rendered.renderedIndexes;
|
|
13359
13348
|
additionalTokens += rendered.additionalTokens;
|
|
13360
13349
|
}
|
|
@@ -13982,11 +13971,11 @@ class SaveCommandsHelper {
|
|
|
13982
13971
|
const insertTableRows = new InsertTableRowsModel({ count: rowsCount, inheritIndex, insertIndex, targetIndex });
|
|
13983
13972
|
return new CommandModel({ commandType: CommandType.InsertTableRows, insertTableRows, targets });
|
|
13984
13973
|
}
|
|
13985
|
-
static getRemoveTableColumnsCommand(startIndex, endIndex,
|
|
13974
|
+
static getRemoveTableColumnsCommand(insertIndex, startIndex, endIndex, targets) {
|
|
13986
13975
|
const removeTableColumns = new RemoveTableColumnsModel({ startIndex, endIndex, insertIndex });
|
|
13987
13976
|
return new CommandModel({ commandType: CommandType.RemoveTableColumns, removeTableColumns, targets });
|
|
13988
13977
|
}
|
|
13989
|
-
static getRemoveTableRowsCommand(startIndex, endIndex,
|
|
13978
|
+
static getRemoveTableRowsCommand(insertIndex, startIndex, endIndex, targets) {
|
|
13990
13979
|
const removeTableRows = new RemoveTableRowsModel({ startIndex, endIndex, insertIndex });
|
|
13991
13980
|
return new CommandModel({ commandType: CommandType.RemoveTableRows, removeTableRows, targets });
|
|
13992
13981
|
}
|