@talrace/ngx-noder 19.0.55 → 19.0.56
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 +42 -16
- package/fesm2022/talrace-ngx-noder.mjs.map +1 -1
- package/lib/editor/operations/helpers/contents-operations.helper.d.ts +3 -2
- package/lib/editor/operations/helpers/numbering-operations.helper.d.ts +2 -0
- package/lib/editor/operations/operations-helper.helper.d.ts +1 -1
- package/lib/models/generated/contents.model.d.ts +2 -0
- package/package.json +1 -1
|
@@ -2112,6 +2112,14 @@ class ContentOperationsHelper {
|
|
|
2112
2112
|
}
|
|
2113
2113
|
}
|
|
2114
2114
|
|
|
2115
|
+
class ContentsModel {
|
|
2116
|
+
constructor(fields) {
|
|
2117
|
+
if (fields) {
|
|
2118
|
+
Object.assign(this, fields);
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2115
2123
|
class ElementModel {
|
|
2116
2124
|
constructor(fields) {
|
|
2117
2125
|
if (fields) {
|
|
@@ -2342,14 +2350,6 @@ class RestoreModel {
|
|
|
2342
2350
|
}
|
|
2343
2351
|
}
|
|
2344
2352
|
|
|
2345
|
-
class ContentsModel {
|
|
2346
|
-
constructor(fields) {
|
|
2347
|
-
if (fields) {
|
|
2348
|
-
Object.assign(this, fields);
|
|
2349
|
-
}
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2353
2353
|
class TableModel {
|
|
2354
2354
|
constructor(fields) {
|
|
2355
2355
|
if (fields) {
|
|
@@ -2398,7 +2398,7 @@ class ContentsOperationsHelper {
|
|
|
2398
2398
|
comments
|
|
2399
2399
|
});
|
|
2400
2400
|
}
|
|
2401
|
-
static GetRelativeContentSlice(contents, startIndex, count) {
|
|
2401
|
+
static GetRelativeContentSlice(contents, documentNumberings, startIndex, count) {
|
|
2402
2402
|
const content = ContentOperationsHelper.sliceContent(contents.content, startIndex, count);
|
|
2403
2403
|
const endIndex = startIndex + count - 1;
|
|
2404
2404
|
const formats = FormatHelper.sliceSection(contents.formats, startIndex, endIndex).map(x => new FormatModel(x));
|
|
@@ -2419,6 +2419,8 @@ class ContentsOperationsHelper {
|
|
|
2419
2419
|
IndexedElementHelper.shiftIndexes(tabs, -startIndex);
|
|
2420
2420
|
RangeElementHelper.shiftIndexes(comments, -startIndex);
|
|
2421
2421
|
LinkHelper.shiftIndexes(links, -startIndex);
|
|
2422
|
+
const paragraphNumberingIds = new Set(paragraphs.map(x => x.paragraphStyle.numberingId).filter(id => id != null));
|
|
2423
|
+
const numberings = documentNumberings.filter(x => paragraphNumberingIds.has(x.numberingId));
|
|
2422
2424
|
return new ContentsModel({
|
|
2423
2425
|
content,
|
|
2424
2426
|
formats,
|
|
@@ -2429,7 +2431,8 @@ class ContentsOperationsHelper {
|
|
|
2429
2431
|
breaks,
|
|
2430
2432
|
tabs,
|
|
2431
2433
|
links,
|
|
2432
|
-
comments
|
|
2434
|
+
comments,
|
|
2435
|
+
numberings
|
|
2433
2436
|
});
|
|
2434
2437
|
}
|
|
2435
2438
|
}
|
|
@@ -3751,6 +3754,16 @@ class NumberingOperationsHelper {
|
|
|
3751
3754
|
numberings.splice(index, 1);
|
|
3752
3755
|
}
|
|
3753
3756
|
}
|
|
3757
|
+
static insertRelative(numberings, insertNumberingId, insertNumberings, paragraphs) {
|
|
3758
|
+
const oldToNewIds = new Map();
|
|
3759
|
+
for (const insertNumbering of insertNumberings) {
|
|
3760
|
+
oldToNewIds.set(insertNumbering.numberingId, insertNumberingId);
|
|
3761
|
+
insertNumbering.numberingId = insertNumberingId;
|
|
3762
|
+
numberings.push(insertNumbering);
|
|
3763
|
+
insertNumberingId++;
|
|
3764
|
+
}
|
|
3765
|
+
this.updateParagraphNumberings(paragraphs, oldToNewIds);
|
|
3766
|
+
}
|
|
3754
3767
|
static filterUnusedIds(paragraphs, numberingIds) {
|
|
3755
3768
|
const unusedNumberingIds = [...numberingIds];
|
|
3756
3769
|
let index = 0;
|
|
@@ -3764,6 +3777,17 @@ class NumberingOperationsHelper {
|
|
|
3764
3777
|
}
|
|
3765
3778
|
return unusedNumberingIds;
|
|
3766
3779
|
}
|
|
3780
|
+
static updateParagraphNumberings(paragraphs, oldToNewIds) {
|
|
3781
|
+
for (const paragraphStyle of paragraphs.map(x => x.paragraphStyle)) {
|
|
3782
|
+
if (paragraphStyle.numberingId == null) {
|
|
3783
|
+
continue;
|
|
3784
|
+
}
|
|
3785
|
+
const newId = oldToNewIds.get(paragraphStyle.numberingId);
|
|
3786
|
+
if (newId !== undefined) {
|
|
3787
|
+
paragraphStyle.numberingId = newId;
|
|
3788
|
+
}
|
|
3789
|
+
}
|
|
3790
|
+
}
|
|
3767
3791
|
}
|
|
3768
3792
|
|
|
3769
3793
|
var Alignment;
|
|
@@ -6027,13 +6051,13 @@ class OperationsHelper {
|
|
|
6027
6051
|
}
|
|
6028
6052
|
case CommandType.InsertContents: {
|
|
6029
6053
|
const model = command.insertContents;
|
|
6030
|
-
this.insertContents(contents, model.insertIndex, model.contents);
|
|
6054
|
+
this.insertContents(contents, document.numberings, model.insertIndex, model.contents);
|
|
6031
6055
|
break;
|
|
6032
6056
|
}
|
|
6033
6057
|
case CommandType.ReplaceByContents: {
|
|
6034
6058
|
const model = command.replaceByContents;
|
|
6035
6059
|
this.delete(contents, model.startIndex, model.count);
|
|
6036
|
-
this.insertContents(contents, model.startIndex, model.contents);
|
|
6060
|
+
this.insertContents(contents, document.numberings, model.startIndex, model.contents);
|
|
6037
6061
|
break;
|
|
6038
6062
|
}
|
|
6039
6063
|
}
|
|
@@ -6291,9 +6315,11 @@ class OperationsHelper {
|
|
|
6291
6315
|
document.comments = document.comments.filter(x => x.commentId !== commentId);
|
|
6292
6316
|
return comment;
|
|
6293
6317
|
}
|
|
6294
|
-
static insertContents(contents, insertIndex, insertContents) {
|
|
6318
|
+
static insertContents(contents, numberings, insertIndex, insertContents) {
|
|
6295
6319
|
const contentLength = insertContents.content.length;
|
|
6296
6320
|
contents.content = ContentOperationsHelper.insertContent(contents.content, insertContents.content, insertIndex);
|
|
6321
|
+
const insertNumberingId = NumberingOperationsHelper.generateNumberingId(numberings);
|
|
6322
|
+
NumberingOperationsHelper.insertRelative(numberings, insertNumberingId, insertContents.numberings, insertContents.paragraphs);
|
|
6297
6323
|
IndexedElementOperationsHelper.insertRelative(contents.paragraphs, insertIndex, contentLength, insertContents.paragraphs);
|
|
6298
6324
|
IndexedElementOperationsHelper.insertRelative(contents.images, insertIndex, contentLength, insertContents.images);
|
|
6299
6325
|
IndexedElementOperationsHelper.insertRelative(contents.tables, insertIndex, contentLength, insertContents.tables);
|
|
@@ -9728,7 +9754,7 @@ class EditSession {
|
|
|
9728
9754
|
table.instance.updateTable();
|
|
9729
9755
|
}
|
|
9730
9756
|
insertContents(insertIndex, contents) {
|
|
9731
|
-
OperationsHelper.insertContents(this.model, insertIndex, contents);
|
|
9757
|
+
OperationsHelper.insertContents(this.model, this.generalProperties.numberings, insertIndex, contents);
|
|
9732
9758
|
const endIndex = insertIndex + contents.content.length - 1;
|
|
9733
9759
|
this.insertComponents(this.model.tables, this.customComponents.tables, NoderTableComponent, insertIndex, endIndex);
|
|
9734
9760
|
this.insertComponents(this.model.images, this.customComponents.images, NoderImageComponent, insertIndex, endIndex);
|
|
@@ -9786,7 +9812,7 @@ class EditSession {
|
|
|
9786
9812
|
const startIndex = ContentHelper.paragraphPositionToDocumentIndex(this.displayData.paragraphs, start);
|
|
9787
9813
|
const endIndex = ContentHelper.paragraphPositionToDocumentIndex(this.displayData.paragraphs, end) - 1;
|
|
9788
9814
|
const count = endIndex - startIndex + 1;
|
|
9789
|
-
return ContentsOperationsHelper.GetRelativeContentSlice(this.model, startIndex, count);
|
|
9815
|
+
return ContentsOperationsHelper.GetRelativeContentSlice(this.model, this.generalProperties.numberings, startIndex, count);
|
|
9790
9816
|
}
|
|
9791
9817
|
createRestoreFromSlice(start, end) {
|
|
9792
9818
|
const startIndex = ContentHelper.paragraphToDocumentIndex(this.displayData.paragraphs, start.row, start.column);
|
|
@@ -16134,7 +16160,7 @@ class Editor {
|
|
|
16134
16160
|
this.commandsService.createCommand(SaveCommandsHelper.getInsertContentsCommand(redoModel, this.targets));
|
|
16135
16161
|
}
|
|
16136
16162
|
saveReplaceByContentsToHistory(redoModel) {
|
|
16137
|
-
const undoSlice = ContentsOperationsHelper.GetRelativeContentSlice(this.session.model, redoModel.startIndex, redoModel.count);
|
|
16163
|
+
const undoSlice = ContentsOperationsHelper.GetRelativeContentSlice(this.session.model, this.session.generalProperties.numberings, redoModel.startIndex, redoModel.count);
|
|
16138
16164
|
const undoModel = new ReplaceByContentsModel({
|
|
16139
16165
|
startIndex: redoModel.startIndex,
|
|
16140
16166
|
contents: undoSlice,
|