@talrace/ngx-noder 19.0.30 → 19.0.31
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 +63 -77
- package/fesm2022/talrace-ngx-noder.mjs.map +1 -1
- package/lib/editor/content/display-data/general-properties.model.d.ts +1 -0
- package/lib/editor/execution/editor.d.ts +2 -0
- package/lib/editor/gadgets/numbering/numbering.helper.d.ts +1 -1
- package/lib/editor/revision.helper.d.ts +0 -8
- package/package.json +1 -1
|
@@ -8346,6 +8346,13 @@ class Editor {
|
|
|
8346
8346
|
insert(text) {
|
|
8347
8347
|
const sanitizedText = text.replace(this.emojiRegex, ' ');
|
|
8348
8348
|
if (this.selection.isEmpty) {
|
|
8349
|
+
if (text === NEW_LINE_MARKUP && this.selection.range.start.column === 0) {
|
|
8350
|
+
const paragraph = this.session.displayData.paragraphs[this.selection.range.start.row];
|
|
8351
|
+
if (paragraph.paragraphSettings.numberingData.numberingId) {
|
|
8352
|
+
this.removeOrLowerNestingNumbering(paragraph);
|
|
8353
|
+
return;
|
|
8354
|
+
}
|
|
8355
|
+
}
|
|
8349
8356
|
const textStyle = ContentStyleHelper.combineTextStyles(null, this.editorService.styles);
|
|
8350
8357
|
this.insertText(sanitizedText, textStyle);
|
|
8351
8358
|
}
|
|
@@ -8419,7 +8426,7 @@ class Editor {
|
|
|
8419
8426
|
}
|
|
8420
8427
|
if (this.selection.range.start.column === 0) {
|
|
8421
8428
|
const paragraph = this.session.displayData.paragraphs[this.selection.range.start.row];
|
|
8422
|
-
if (paragraph.paragraphSettings.numberingData.numberingId) {
|
|
8429
|
+
if (paragraph.paragraphSettings.numberingData.numberingId && paragraph.paragraphSettings.numberingData.level <= 6) {
|
|
8423
8430
|
this.applyParagraphStyles(new ParagraphStyleModel({
|
|
8424
8431
|
numberingLevel: paragraph.paragraphSettings.numberingData.level + 1,
|
|
8425
8432
|
indentLeft: 0,
|
|
@@ -8445,6 +8452,9 @@ class Editor {
|
|
|
8445
8452
|
if (this.selection.range.start.column === 0) {
|
|
8446
8453
|
const paragraph = this.session.displayData.paragraphs[this.selection.range.start.row];
|
|
8447
8454
|
if (paragraph.paragraphSettings.numberingData.numberingId) {
|
|
8455
|
+
if (paragraph.paragraphSettings.numberingData.level === 0) {
|
|
8456
|
+
return;
|
|
8457
|
+
}
|
|
8448
8458
|
this.applyParagraphStyles(new ParagraphStyleModel({
|
|
8449
8459
|
numberingLevel: paragraph.paragraphSettings.numberingData.level - 1,
|
|
8450
8460
|
indentLeft: 0,
|
|
@@ -9090,7 +9100,8 @@ class Editor {
|
|
|
9090
9100
|
const indexes = ContentHelper.getSelectedPartDocumentIndexes(this.session.displayData.paragraphs, range);
|
|
9091
9101
|
if (isNumbering && range.end.column === 0 && indexes.startIndex >= indexes.endIndex) {
|
|
9092
9102
|
this.selection.placeCursor(range.end);
|
|
9093
|
-
this.
|
|
9103
|
+
const paragraph = this.session.displayData.paragraphs[this.selection.range.end.row];
|
|
9104
|
+
this.removeOrLowerNestingNumbering(paragraph);
|
|
9094
9105
|
this.onSelectionChange();
|
|
9095
9106
|
this.onContentChange();
|
|
9096
9107
|
this.focus();
|
|
@@ -9135,6 +9146,14 @@ class Editor {
|
|
|
9135
9146
|
this.editorService.removeCustomElementsData(elements);
|
|
9136
9147
|
}
|
|
9137
9148
|
}
|
|
9149
|
+
removeOrLowerNestingNumbering(paragraph) {
|
|
9150
|
+
if (paragraph.paragraphSettings.numberingData.level > 0) {
|
|
9151
|
+
this.applyParagraphStyles(new ParagraphStyleModel({ numberingLevel: paragraph.paragraphSettings.numberingData.level - 1 }));
|
|
9152
|
+
}
|
|
9153
|
+
else {
|
|
9154
|
+
this.removeNumberingsFromParagraphs();
|
|
9155
|
+
}
|
|
9156
|
+
}
|
|
9138
9157
|
onInput() {
|
|
9139
9158
|
const text = this.textInput.getInsertText();
|
|
9140
9159
|
if (!text) {
|
|
@@ -11615,11 +11634,20 @@ class NumberingHelper {
|
|
|
11615
11634
|
numberingInfo[numberingId][level].markerIndex++;
|
|
11616
11635
|
return;
|
|
11617
11636
|
}
|
|
11618
|
-
this.updateNumberingInfo(numberingInfo, marker, numberingId);
|
|
11637
|
+
this.updateNumberingInfo(numberingInfo, marker, numberingId, level);
|
|
11619
11638
|
}
|
|
11620
11639
|
else {
|
|
11621
11640
|
numberingInfo[numberingId][level].markerIndex++;
|
|
11622
|
-
numberingInfo[numberingId].
|
|
11641
|
+
for (let i = 0; i < numberingInfo[numberingId].length; i++) {
|
|
11642
|
+
if (i >= level + 1) {
|
|
11643
|
+
numberingInfo[numberingId][i].markerIndex = 0;
|
|
11644
|
+
}
|
|
11645
|
+
else {
|
|
11646
|
+
if (numberingInfo[numberingId][i].markerIndex === 0) {
|
|
11647
|
+
numberingInfo[numberingId][i].markerIndex++;
|
|
11648
|
+
}
|
|
11649
|
+
}
|
|
11650
|
+
}
|
|
11623
11651
|
}
|
|
11624
11652
|
}
|
|
11625
11653
|
static getMarker(levelModel, numberingId, paragraphs, paragraphIndex, numberingInfo) {
|
|
@@ -11639,7 +11667,7 @@ class NumberingHelper {
|
|
|
11639
11667
|
index = resultMarker.indexOf('%');
|
|
11640
11668
|
}
|
|
11641
11669
|
numberingInfo[numberingId] ??= [];
|
|
11642
|
-
this.updateNumberingInfo(numberingInfo, resultMarker, numberingId);
|
|
11670
|
+
this.updateNumberingInfo(numberingInfo, resultMarker, numberingId, levelModel.level);
|
|
11643
11671
|
return resultMarker;
|
|
11644
11672
|
}
|
|
11645
11673
|
static createDataModel(numberings, paragraphs, paragraphIndex, numberingInfo) {
|
|
@@ -11650,6 +11678,12 @@ class NumberingHelper {
|
|
|
11650
11678
|
}
|
|
11651
11679
|
const level = paragraph.paragraphStyle.numberingLevel;
|
|
11652
11680
|
const numberingLevelModel = this.find(numberings, numberingId, level);
|
|
11681
|
+
for (let i = 0; i < level; i++) {
|
|
11682
|
+
if (!numberingInfo[numberingId][i]) {
|
|
11683
|
+
const numberingLevel = this.find(numberings, numberingId, i);
|
|
11684
|
+
this.getMarker(numberingLevel, numberingId, paragraphs, paragraphIndex, numberingInfo);
|
|
11685
|
+
}
|
|
11686
|
+
}
|
|
11653
11687
|
const marker = this.getMarker(numberingLevelModel, numberingId, paragraphs, paragraphIndex, numberingInfo);
|
|
11654
11688
|
return new NumberingDataModel({ numberingId, level, marker });
|
|
11655
11689
|
}
|
|
@@ -11683,14 +11717,17 @@ class NumberingHelper {
|
|
|
11683
11717
|
}
|
|
11684
11718
|
return { height, width };
|
|
11685
11719
|
}
|
|
11686
|
-
static updateNumberingInfo(numberingInfo, marker, numberingId) {
|
|
11720
|
+
static updateNumberingInfo(numberingInfo, marker, numberingId, level) {
|
|
11687
11721
|
if (!numberingInfo[numberingId]) {
|
|
11688
11722
|
return;
|
|
11689
11723
|
}
|
|
11690
|
-
const
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11724
|
+
const markerLevels = this.getLevelInfo(marker);
|
|
11725
|
+
const lastMarkerLevel = markerLevels.length - 1;
|
|
11726
|
+
numberingInfo[numberingId][level] = {
|
|
11727
|
+
markerIndex: markerLevels[lastMarkerLevel],
|
|
11728
|
+
markerLevel: Math.min(lastMarkerLevel, level),
|
|
11729
|
+
visited: true
|
|
11730
|
+
};
|
|
11694
11731
|
}
|
|
11695
11732
|
static getLevelIndex(paragraphs, paragraphIndex, numberingId, numberingLevel) {
|
|
11696
11733
|
let index = 0;
|
|
@@ -11723,10 +11760,13 @@ class NumberingHelper {
|
|
|
11723
11760
|
if (level === 0) {
|
|
11724
11761
|
return numberingInfo[numberingId][level].markerIndex + '.';
|
|
11725
11762
|
}
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
.
|
|
11763
|
+
let marker = [];
|
|
11764
|
+
let { markerLevel, markerIndex } = numberingInfo[numberingId][level];
|
|
11765
|
+
for (let i = 0; i < markerLevel; i++) {
|
|
11766
|
+
marker.push(numberingInfo[numberingId][i].markerIndex);
|
|
11767
|
+
}
|
|
11768
|
+
marker.push(markerIndex);
|
|
11769
|
+
return marker.join('.');
|
|
11730
11770
|
}
|
|
11731
11771
|
}
|
|
11732
11772
|
|
|
@@ -12349,20 +12389,18 @@ class DisplayData extends EventEmitting {
|
|
|
12349
12389
|
}
|
|
12350
12390
|
resetAllNumberingInfo(paragraphIndex) {
|
|
12351
12391
|
for (let i = paragraphIndex; i < this.model.paragraphs.length; i++) {
|
|
12352
|
-
const { numberingId
|
|
12353
|
-
if (numberingId !== null &&
|
|
12354
|
-
this.generalProperties.numberingInfo[numberingId]
|
|
12355
|
-
this.generalProperties.numberingInfo[numberingId][numberingLevel]) {
|
|
12356
|
-
this.generalProperties.numberingInfo[numberingId][numberingLevel].visited = false;
|
|
12392
|
+
const { numberingId } = this.model.paragraphs[i].paragraphStyle;
|
|
12393
|
+
if (numberingId !== null && this.generalProperties.numberingInfo[numberingId]) {
|
|
12394
|
+
this.generalProperties.numberingInfo[numberingId] = [];
|
|
12357
12395
|
}
|
|
12358
12396
|
}
|
|
12359
12397
|
}
|
|
12360
12398
|
resetNumberingInfoByTableCell(table) {
|
|
12361
12399
|
for (const element of table.instance.rowMatrix) {
|
|
12362
12400
|
for (let cell of element.cells) {
|
|
12363
|
-
const { marker, numberingId } = cell.componentRef.instance.session.displayData.paragraphs[0].paragraphSettings.numberingData;
|
|
12401
|
+
const { marker, numberingId, level } = cell.componentRef.instance.session.displayData.paragraphs[0].paragraphSettings.numberingData;
|
|
12364
12402
|
if (marker && numberingId) {
|
|
12365
|
-
NumberingHelper.updateNumberingInfo(this.generalProperties.numberingInfo, marker, numberingId);
|
|
12403
|
+
NumberingHelper.updateNumberingInfo(this.generalProperties.numberingInfo, marker, numberingId, level);
|
|
12366
12404
|
this.resetAllNumberingInfo(0);
|
|
12367
12405
|
return;
|
|
12368
12406
|
}
|
|
@@ -12847,12 +12885,8 @@ class DisplayData extends EventEmitting {
|
|
|
12847
12885
|
if (displayTokens[0].isTable || (displayTokens[0].breaksLine && displayTokens.length === 1)) {
|
|
12848
12886
|
return 1;
|
|
12849
12887
|
}
|
|
12850
|
-
const
|
|
12851
|
-
|
|
12852
|
-
displayTokens[0].indentFirstLine -
|
|
12853
|
-
displayTokens[0].indentHanging || 0;
|
|
12854
|
-
const maxRowWidth = contentWidth - indent;
|
|
12855
|
-
let sum = 0;
|
|
12888
|
+
const maxRowWidth = contentWidth - displayTokens[0].indentRight;
|
|
12889
|
+
let sum = displayTokens[0].indentLeft + displayTokens[0].indentFirstLine - displayTokens[0].indentHanging || 0;
|
|
12856
12890
|
let prevTabIndex = null;
|
|
12857
12891
|
let tabCenter = null;
|
|
12858
12892
|
let prevTabAlignment = TabAlignment.Left;
|
|
@@ -14008,11 +14042,10 @@ class EditSession {
|
|
|
14008
14042
|
const startIndex = paragraphs[0].insertIndex;
|
|
14009
14043
|
const endIndex = paragraphs[paragraphs.length - 1].insertIndex;
|
|
14010
14044
|
const startParagraph = ContentHelper.documentIndexToParagraphIndex(this.displayData.paragraphs, startIndex).row;
|
|
14011
|
-
const
|
|
14045
|
+
const endParagraph = ContentHelper.documentIndexToParagraphWithOffset(this.displayData.paragraphs, endIndex).row;
|
|
14012
14046
|
OperationsHelper.applyParagraphs(this.model, paragraphs);
|
|
14013
14047
|
this.displayData.resetAllNumberingInfo(startParagraph);
|
|
14014
|
-
this.displayData.updateNextLineIndexes(startParagraph,
|
|
14015
|
-
this.displayData.updateNumberingsDataOnChange(startParagraph + 1);
|
|
14048
|
+
this.displayData.updateNextLineIndexes(startParagraph, endParagraph);
|
|
14016
14049
|
this.applyToolbarStyles();
|
|
14017
14050
|
}
|
|
14018
14051
|
setTextStyle(textStyle) {
|
|
@@ -18938,53 +18971,6 @@ class RevisionHelper {
|
|
|
18938
18971
|
const actions = operations.map(x => x.command);
|
|
18939
18972
|
OperationsHelper.applyOperations(content, actions);
|
|
18940
18973
|
}
|
|
18941
|
-
static fillTablesDefaultStyles(tables) {
|
|
18942
|
-
for (const table of tables) {
|
|
18943
|
-
for (const row of table.rows) {
|
|
18944
|
-
for (const cell of row.cells) {
|
|
18945
|
-
this.fillDefaultStyles(cell);
|
|
18946
|
-
}
|
|
18947
|
-
}
|
|
18948
|
-
}
|
|
18949
|
-
}
|
|
18950
|
-
static fillEdgesDefaultStyles(headers, footers) {
|
|
18951
|
-
for (const header of headers) {
|
|
18952
|
-
this.fillTablesDefaultStyles(header.tables);
|
|
18953
|
-
this.fillDefaultStyles(header);
|
|
18954
|
-
}
|
|
18955
|
-
for (const footer of footers) {
|
|
18956
|
-
this.fillTablesDefaultStyles(footer.tables);
|
|
18957
|
-
this.fillDefaultStyles(footer);
|
|
18958
|
-
}
|
|
18959
|
-
}
|
|
18960
|
-
static fillDefaultStyles(contents) {
|
|
18961
|
-
for (const format of contents.formats) {
|
|
18962
|
-
format.textStyle = ContentStyleHelper.combineTextStyles(format.textStyle, DEFAULT_TEXT_STYLE);
|
|
18963
|
-
}
|
|
18964
|
-
for (const paragraph of contents.paragraphs) {
|
|
18965
|
-
paragraph.paragraphStyle = this.fillParagraphStyleModel(paragraph.paragraphStyle);
|
|
18966
|
-
}
|
|
18967
|
-
}
|
|
18968
|
-
static fillParagraphStyleModel(paragraphStyle) {
|
|
18969
|
-
return new ParagraphStyleModel({
|
|
18970
|
-
alignment: paragraphStyle.alignment ?? DEFAULT_PARAGRAPH_STYLE.alignment,
|
|
18971
|
-
backgroundColor: paragraphStyle.backgroundColor ?? DEFAULT_PARAGRAPH_STYLE.backgroundColor,
|
|
18972
|
-
headingStyleId: paragraphStyle.headingStyleId,
|
|
18973
|
-
indentFirstLine: paragraphStyle.indentFirstLine ?? DEFAULT_PARAGRAPH_STYLE.indentFirstLine,
|
|
18974
|
-
indentHanging: paragraphStyle.indentHanging ?? DEFAULT_PARAGRAPH_STYLE.indentHanging,
|
|
18975
|
-
indentLeft: paragraphStyle.indentLeft ?? DEFAULT_PARAGRAPH_STYLE.indentLeft,
|
|
18976
|
-
indentRight: paragraphStyle.indentRight ?? DEFAULT_PARAGRAPH_STYLE.indentRight,
|
|
18977
|
-
lineSpacing: paragraphStyle.lineSpacing ?? DEFAULT_PARAGRAPH_STYLE.lineSpacing,
|
|
18978
|
-
spaceAfter: paragraphStyle.spaceAfter ?? DEFAULT_PARAGRAPH_STYLE.spaceAfter,
|
|
18979
|
-
spaceBefore: paragraphStyle.spaceBefore ?? DEFAULT_PARAGRAPH_STYLE.spaceBefore,
|
|
18980
|
-
contextualSpacing: paragraphStyle.contextualSpacing ?? DEFAULT_PARAGRAPH_STYLE.contextualSpacing,
|
|
18981
|
-
beforeAutospacing: paragraphStyle.beforeAutospacing ?? DEFAULT_PARAGRAPH_STYLE.beforeAutospacing,
|
|
18982
|
-
afterAutospacing: paragraphStyle.afterAutospacing ?? DEFAULT_PARAGRAPH_STYLE.afterAutospacing,
|
|
18983
|
-
numberingId: paragraphStyle.numberingId ?? DEFAULT_PARAGRAPH_STYLE.numberingId,
|
|
18984
|
-
numberingLevel: paragraphStyle.numberingLevel ?? DEFAULT_PARAGRAPH_STYLE.numberingLevel,
|
|
18985
|
-
tabSettings: paragraphStyle.tabSettings ?? DEFAULT_PARAGRAPH_STYLE.tabSettings
|
|
18986
|
-
});
|
|
18987
|
-
}
|
|
18988
18974
|
static getEmptyDocxModel() {
|
|
18989
18975
|
const pageMargin = new MarginModel();
|
|
18990
18976
|
return new DocxModel({
|