@talrace/ngx-noder 19.0.55 → 19.0.57
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 +46 -18
- 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
|
}
|
|
@@ -2468,14 +2471,14 @@ class ContextMenuComponent {
|
|
|
2468
2471
|
this.overlayService.close(AfterCloseOverlayActions.OpenSetNumberingValue);
|
|
2469
2472
|
}
|
|
2470
2473
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ContextMenuComponent, deps: [{ token: EditorService }, { token: OverlayService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2471
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: ContextMenuComponent, isStandalone: true, selector: "app-nod-context-menu", inputs: { hasNumbering: "hasNumbering", hasSelection: "hasSelection", disableContinueNumber: "disableContinueNumber" }, host: { properties: { "style.height.px": "210", "style.width.px": "320" } }, ngImport: i0, template: "<button\n mat-button\n (click)=\"onCopy()\"\n [disabled]=\"!hasSelection\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-copy\" />\n {{ 'NODER.LABEL.COPY' | translate }}\n</button>\n<button\n mat-button\n (click)=\"onPaste()\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-paste\" />\n {{ 'NODER.LABEL.PASTE' | translate }}\n</button>\n<button\n mat-button\n (click)=\"onCut()\"\n [disabled]=\"!hasSelection\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-cut\" />\n {{ 'NODER.LABEL.CUT' | translate }}\n</button>\n<div class=\"separator\"></div>\n<button\n mat-button\n (click)=\"onStartNewList()\"\n [disabled]=\"!hasNumbering\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-restart-numbering\" />\n {{ 'NODER.LABEL.START_NEW_LIST' | translate }}\n</button>\n<button\n mat-button\n (click)=\"onContinueNumbering()\"\n [disabled]=\"!hasNumbering || disableContinueNumber\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-continue-numbering\" />\n {{ 'NODER.LABEL.CONTINUE_NUMBERING' | translate }}\n</button>\n<button\n mat-button\n (click)=\"onSetNumberingValue()\"\n [disabled]=\"!hasNumbering\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-starting-value\" />\n {{ 'NODER.LABEL.SET_NUMBERING_VALUE' | translate }}\n</button>\n", styles: [":host{display:flex;padding:8px 16px;flex-direction:column;align-items:flex-start;gap:4px;border-radius:8px;box-shadow:2px 2px 8px #21212129}.separator{width:288px;height:1px}button{width:100%;justify-content:start;min-height:28px;height:28px}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i6.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2474
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: ContextMenuComponent, isStandalone: true, selector: "app-nod-context-menu", inputs: { hasNumbering: "hasNumbering", hasSelection: "hasSelection", disableContinueNumber: "disableContinueNumber" }, host: { properties: { "style.height.px": "210", "style.width.px": "320" } }, ngImport: i0, template: "<button\n mat-button\n (click)=\"onCopy()\"\n [disabled]=\"!hasSelection\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-copy\" />\n {{ 'NODER.LABEL.COPY' | translate }}\n <span class=\"shortcut\">Ctrl+C</span>\n</button>\n<button\n mat-button\n (click)=\"onPaste()\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-paste\" />\n {{ 'NODER.LABEL.PASTE' | translate }}\n <span class=\"shortcut\">Ctrl+V</span>\n</button>\n<button\n mat-button\n (click)=\"onCut()\"\n [disabled]=\"!hasSelection\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-cut\" />\n {{ 'NODER.LABEL.CUT' | translate }}\n <span class=\"shortcut\">Ctrl+X</span>\n</button>\n<div class=\"separator\"></div>\n<button\n mat-button\n (click)=\"onStartNewList()\"\n [disabled]=\"!hasNumbering\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-restart-numbering\" />\n {{ 'NODER.LABEL.START_NEW_LIST' | translate }}\n</button>\n<button\n mat-button\n (click)=\"onContinueNumbering()\"\n [disabled]=\"!hasNumbering || disableContinueNumber\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-continue-numbering\" />\n {{ 'NODER.LABEL.CONTINUE_NUMBERING' | translate }}\n</button>\n<button\n mat-button\n (click)=\"onSetNumberingValue()\"\n [disabled]=\"!hasNumbering\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-starting-value\" />\n {{ 'NODER.LABEL.SET_NUMBERING_VALUE' | translate }}\n</button>\n", styles: [":host{display:flex;padding:8px 16px;flex-direction:column;align-items:flex-start;gap:4px;border-radius:8px;box-shadow:2px 2px 8px #21212129}.separator{width:288px;height:1px}button{width:100%;justify-content:start;min-height:28px;height:28px}button ::ng-deep .mdc-button__label{display:flex;flex-direction:row;width:100%;margin-left:3px;font-weight:400}.shortcut{margin-left:auto;opacity:.5}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i6.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2472
2475
|
}
|
|
2473
2476
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ContextMenuComponent, decorators: [{
|
|
2474
2477
|
type: Component,
|
|
2475
2478
|
args: [{ selector: 'app-nod-context-menu', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButtonModule, TranslateModule, MatIconModule], host: {
|
|
2476
2479
|
'[style.height.px]': `${CONTEXT_MENU_HEIGHT}`,
|
|
2477
2480
|
'[style.width.px]': `${CONTEXT_MENU_WIDTH}`
|
|
2478
|
-
}, template: "<button\n mat-button\n (click)=\"onCopy()\"\n [disabled]=\"!hasSelection\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-copy\" />\n {{ 'NODER.LABEL.COPY' | translate }}\n</button>\n<button\n mat-button\n (click)=\"onPaste()\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-paste\" />\n {{ 'NODER.LABEL.PASTE' | translate }}\n</button>\n<button\n mat-button\n (click)=\"onCut()\"\n [disabled]=\"!hasSelection\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-cut\" />\n {{ 'NODER.LABEL.CUT' | translate }}\n</button>\n<div class=\"separator\"></div>\n<button\n mat-button\n (click)=\"onStartNewList()\"\n [disabled]=\"!hasNumbering\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-restart-numbering\" />\n {{ 'NODER.LABEL.START_NEW_LIST' | translate }}\n</button>\n<button\n mat-button\n (click)=\"onContinueNumbering()\"\n [disabled]=\"!hasNumbering || disableContinueNumber\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-continue-numbering\" />\n {{ 'NODER.LABEL.CONTINUE_NUMBERING' | translate }}\n</button>\n<button\n mat-button\n (click)=\"onSetNumberingValue()\"\n [disabled]=\"!hasNumbering\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-starting-value\" />\n {{ 'NODER.LABEL.SET_NUMBERING_VALUE' | translate }}\n</button>\n", styles: [":host{display:flex;padding:8px 16px;flex-direction:column;align-items:flex-start;gap:4px;border-radius:8px;box-shadow:2px 2px 8px #21212129}.separator{width:288px;height:1px}button{width:100%;justify-content:start;min-height:28px;height:28px}\n"] }]
|
|
2481
|
+
}, template: "<button\n mat-button\n (click)=\"onCopy()\"\n [disabled]=\"!hasSelection\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-copy\" />\n {{ 'NODER.LABEL.COPY' | translate }}\n <span class=\"shortcut\">Ctrl+C</span>\n</button>\n<button\n mat-button\n (click)=\"onPaste()\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-paste\" />\n {{ 'NODER.LABEL.PASTE' | translate }}\n <span class=\"shortcut\">Ctrl+V</span>\n</button>\n<button\n mat-button\n (click)=\"onCut()\"\n [disabled]=\"!hasSelection\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-cut\" />\n {{ 'NODER.LABEL.CUT' | translate }}\n <span class=\"shortcut\">Ctrl+X</span>\n</button>\n<div class=\"separator\"></div>\n<button\n mat-button\n (click)=\"onStartNewList()\"\n [disabled]=\"!hasNumbering\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-restart-numbering\" />\n {{ 'NODER.LABEL.START_NEW_LIST' | translate }}\n</button>\n<button\n mat-button\n (click)=\"onContinueNumbering()\"\n [disabled]=\"!hasNumbering || disableContinueNumber\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-continue-numbering\" />\n {{ 'NODER.LABEL.CONTINUE_NUMBERING' | translate }}\n</button>\n<button\n mat-button\n (click)=\"onSetNumberingValue()\"\n [disabled]=\"!hasNumbering\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-starting-value\" />\n {{ 'NODER.LABEL.SET_NUMBERING_VALUE' | translate }}\n</button>\n", styles: [":host{display:flex;padding:8px 16px;flex-direction:column;align-items:flex-start;gap:4px;border-radius:8px;box-shadow:2px 2px 8px #21212129}.separator{width:288px;height:1px}button{width:100%;justify-content:start;min-height:28px;height:28px}button ::ng-deep .mdc-button__label{display:flex;flex-direction:row;width:100%;margin-left:3px;font-weight:400}.shortcut{margin-left:auto;opacity:.5}\n"] }]
|
|
2479
2482
|
}], ctorParameters: () => [{ type: EditorService }, { type: OverlayService }], propDecorators: { hasNumbering: [{
|
|
2480
2483
|
type: Input
|
|
2481
2484
|
}], hasSelection: [{
|
|
@@ -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,13 @@ 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
|
+
if (insertContents.numberings && insertContents.numberings.length > 0) {
|
|
6322
|
+
const insertNumberingId = NumberingOperationsHelper.generateNumberingId(numberings);
|
|
6323
|
+
NumberingOperationsHelper.insertRelative(numberings, insertNumberingId, insertContents.numberings, insertContents.paragraphs);
|
|
6324
|
+
}
|
|
6297
6325
|
IndexedElementOperationsHelper.insertRelative(contents.paragraphs, insertIndex, contentLength, insertContents.paragraphs);
|
|
6298
6326
|
IndexedElementOperationsHelper.insertRelative(contents.images, insertIndex, contentLength, insertContents.images);
|
|
6299
6327
|
IndexedElementOperationsHelper.insertRelative(contents.tables, insertIndex, contentLength, insertContents.tables);
|
|
@@ -9728,7 +9756,7 @@ class EditSession {
|
|
|
9728
9756
|
table.instance.updateTable();
|
|
9729
9757
|
}
|
|
9730
9758
|
insertContents(insertIndex, contents) {
|
|
9731
|
-
OperationsHelper.insertContents(this.model, insertIndex, contents);
|
|
9759
|
+
OperationsHelper.insertContents(this.model, this.generalProperties.numberings, insertIndex, contents);
|
|
9732
9760
|
const endIndex = insertIndex + contents.content.length - 1;
|
|
9733
9761
|
this.insertComponents(this.model.tables, this.customComponents.tables, NoderTableComponent, insertIndex, endIndex);
|
|
9734
9762
|
this.insertComponents(this.model.images, this.customComponents.images, NoderImageComponent, insertIndex, endIndex);
|
|
@@ -9786,7 +9814,7 @@ class EditSession {
|
|
|
9786
9814
|
const startIndex = ContentHelper.paragraphPositionToDocumentIndex(this.displayData.paragraphs, start);
|
|
9787
9815
|
const endIndex = ContentHelper.paragraphPositionToDocumentIndex(this.displayData.paragraphs, end) - 1;
|
|
9788
9816
|
const count = endIndex - startIndex + 1;
|
|
9789
|
-
return ContentsOperationsHelper.GetRelativeContentSlice(this.model, startIndex, count);
|
|
9817
|
+
return ContentsOperationsHelper.GetRelativeContentSlice(this.model, this.generalProperties.numberings, startIndex, count);
|
|
9790
9818
|
}
|
|
9791
9819
|
createRestoreFromSlice(start, end) {
|
|
9792
9820
|
const startIndex = ContentHelper.paragraphToDocumentIndex(this.displayData.paragraphs, start.row, start.column);
|
|
@@ -16134,7 +16162,7 @@ class Editor {
|
|
|
16134
16162
|
this.commandsService.createCommand(SaveCommandsHelper.getInsertContentsCommand(redoModel, this.targets));
|
|
16135
16163
|
}
|
|
16136
16164
|
saveReplaceByContentsToHistory(redoModel) {
|
|
16137
|
-
const undoSlice = ContentsOperationsHelper.GetRelativeContentSlice(this.session.model, redoModel.startIndex, redoModel.count);
|
|
16165
|
+
const undoSlice = ContentsOperationsHelper.GetRelativeContentSlice(this.session.model, this.session.generalProperties.numberings, redoModel.startIndex, redoModel.count);
|
|
16138
16166
|
const undoModel = new ReplaceByContentsModel({
|
|
16139
16167
|
startIndex: redoModel.startIndex,
|
|
16140
16168
|
contents: undoSlice,
|