@talrace/ngx-noder 19.0.38 → 19.0.40
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 +441 -337
- package/fesm2022/talrace-ngx-noder.mjs.map +1 -1
- package/lib/apart-components/editor-toolbar/components/base-toolbar.component.d.ts +5 -1
- package/lib/apart-components/editor-toolbar/components/buttons/numbering/numbering.component.d.ts +5 -1
- package/lib/apart-components/editor-toolbar/components/toolbar-actions/toolbar-actions.component.d.ts +2 -2
- package/lib/apart-components/editor-toolbar/editor-toolbar/editor-toolbar.component.d.ts +2 -2
- package/lib/editor/content/display-data/display-data.d.ts +1 -1
- package/lib/editor/display/layers/highlight.layer.d.ts +2 -1
- package/lib/editor/display/renderer.d.ts +1 -8
- package/lib/editor/display/virtual.renderer.d.ts +1 -2
- package/lib/editor/execution/edit.session.d.ts +3 -3
- package/lib/editor/execution/editor.d.ts +7 -4
- package/lib/editor/execution/regulator.service.d.ts +1 -4
- package/lib/editor/gadgets/history/operation-history.d.ts +3 -2
- package/lib/editor/gadgets/history/operation.type.d.ts +2 -1
- package/lib/editor/gadgets/numbering/numbering.helper.d.ts +8 -4
- package/lib/editor/interaction/editor.service.d.ts +6 -5
- package/lib/editor/operations/enums/command-type.enum.d.ts +2 -1
- package/lib/editor/operations/helpers/numbering-operations.helper.d.ts +1 -0
- package/lib/editor/operations/helpers/paragraph-operations.helper.d.ts +3 -2
- package/lib/editor/operations/operations-helper.helper.d.ts +5 -4
- package/lib/editor/operations/save-commands.helper.d.ts +3 -2
- package/lib/editor/positioning/position.helper.d.ts +20 -36
- package/lib/editor/positioning/range.d.ts +1 -7
- package/lib/models/generated/apply-numbering-levels.model.d.ts +6 -0
- package/lib/models/generated/apply-paragraph-style.model.d.ts +2 -2
- package/lib/models/generated/command.model.d.ts +2 -0
- package/lib/models/generated/paragraph-style-ext.model.d.ts +8 -0
- package/lib/models/generated/remove-with-paragraph.model.d.ts +2 -2
- package/lib/models/generated/restore-with-paragraph.model.d.ts +2 -2
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/lib/editor/content/display-data/paragraph-info.interface.d.ts +0 -7
|
@@ -1450,6 +1450,8 @@ class BaseCommentComponent {
|
|
|
1450
1450
|
constructor(elementRef, editorService) {
|
|
1451
1451
|
this.elementRef = elementRef;
|
|
1452
1452
|
this.editorService = editorService;
|
|
1453
|
+
this.editing = false;
|
|
1454
|
+
this.isNew = false;
|
|
1453
1455
|
this.resizeObserver = new ResizeObserver(entries => {
|
|
1454
1456
|
const height = entries[0].borderBoxSize[0].blockSize;
|
|
1455
1457
|
if (!height || this.height === height) {
|
|
@@ -1626,6 +1628,7 @@ var CommandType;
|
|
|
1626
1628
|
CommandType[CommandType["ApplyTableCellsStyles"] = 37] = "ApplyTableCellsStyles";
|
|
1627
1629
|
CommandType[CommandType["AttachComment"] = 38] = "AttachComment";
|
|
1628
1630
|
CommandType[CommandType["RemoveComment"] = 39] = "RemoveComment";
|
|
1631
|
+
CommandType[CommandType["ApplyNumberingLevels"] = 40] = "ApplyNumberingLevels";
|
|
1629
1632
|
})(CommandType || (CommandType = {}));
|
|
1630
1633
|
|
|
1631
1634
|
class PageNumbersModel {
|
|
@@ -1674,6 +1677,14 @@ class ApplyImageStyleModel {
|
|
|
1674
1677
|
}
|
|
1675
1678
|
}
|
|
1676
1679
|
|
|
1680
|
+
class ApplyNumberingLevelsModel {
|
|
1681
|
+
constructor(fields) {
|
|
1682
|
+
if (fields) {
|
|
1683
|
+
Object.assign(this, fields);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1677
1688
|
class ApplyPageFormatModel {
|
|
1678
1689
|
constructor(fields) {
|
|
1679
1690
|
if (fields) {
|
|
@@ -1693,11 +1704,20 @@ class ApplyParagraphsModel {
|
|
|
1693
1704
|
}
|
|
1694
1705
|
}
|
|
1695
1706
|
|
|
1707
|
+
class ParagraphStyleExtModel extends ParagraphStyleModel {
|
|
1708
|
+
constructor(fields) {
|
|
1709
|
+
super(fields);
|
|
1710
|
+
if (fields) {
|
|
1711
|
+
Object.assign(this, fields);
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1696
1716
|
class ApplyParagraphStyleModel {
|
|
1697
1717
|
constructor(fields) {
|
|
1698
1718
|
if (fields) {
|
|
1699
1719
|
if (fields.paragraphStyle) {
|
|
1700
|
-
fields.paragraphStyle = new
|
|
1720
|
+
fields.paragraphStyle = new ParagraphStyleExtModel(fields.paragraphStyle);
|
|
1701
1721
|
}
|
|
1702
1722
|
Object.assign(this, fields);
|
|
1703
1723
|
}
|
|
@@ -2199,9 +2219,9 @@ class InputHandler extends BaseHandler {
|
|
|
2199
2219
|
this.actionsWithScroll['Ctrl-Alt-Backspace'] = () => editor.removeWordLeft();
|
|
2200
2220
|
this.actionsWithScroll['Ctrl-Delete'] = () => editor.removeWordRight();
|
|
2201
2221
|
this.actionsWithScroll['Ctrl-Alt-Delete'] = () => editor.removeWordRight();
|
|
2202
|
-
this.actionsWithScroll['Ctrl-KeyL'] = () => editor.applyParagraphStyles(new
|
|
2203
|
-
this.actionsWithScroll['Ctrl-KeyE'] = () => editor.applyParagraphStyles(new
|
|
2204
|
-
this.actionsWithScroll['Ctrl-KeyR'] = () => editor.applyParagraphStyles(new
|
|
2222
|
+
this.actionsWithScroll['Ctrl-KeyL'] = () => editor.applyParagraphStyles(new ParagraphStyleExtModel({ alignment: Alignment$1.left }));
|
|
2223
|
+
this.actionsWithScroll['Ctrl-KeyE'] = () => editor.applyParagraphStyles(new ParagraphStyleExtModel({ alignment: Alignment$1.center }));
|
|
2224
|
+
this.actionsWithScroll['Ctrl-KeyR'] = () => editor.applyParagraphStyles(new ParagraphStyleExtModel({ alignment: Alignment$1.right }));
|
|
2205
2225
|
this.actionsWithScroll['Ctrl-KeyB'] = () => editor.applyTextStyleBold();
|
|
2206
2226
|
this.actionsWithScroll['Ctrl-KeyI'] = () => editor.applyTextStyleItalic();
|
|
2207
2227
|
this.actionsWithScroll['Ctrl-KeyU'] = () => editor.applyTextStyleUnderline();
|
|
@@ -2731,6 +2751,11 @@ class OperationHistory {
|
|
|
2731
2751
|
const undoStep = new RestoreNumberingsModel({ paragraphs, numberings });
|
|
2732
2752
|
this.addToHistory(undoStep, redoStep);
|
|
2733
2753
|
}
|
|
2754
|
+
pushApplyNumbering(numberingId, newLevels, oldLevels) {
|
|
2755
|
+
const redoStep = new ApplyNumberingLevelsModel({ numberingId, levels: newLevels });
|
|
2756
|
+
const undoStep = new ApplyNumberingLevelsModel({ numberingId, levels: oldLevels });
|
|
2757
|
+
this.addToHistory(undoStep, redoStep);
|
|
2758
|
+
}
|
|
2734
2759
|
pushRemoveNumberings(startIndex, endIndex, numberings, paragraphs) {
|
|
2735
2760
|
const redoStep = new RemoveNumberingsModel({ startIndex, endIndex });
|
|
2736
2761
|
const undoStep = new RestoreNumberingsModel({ numberings, paragraphs });
|
|
@@ -3329,6 +3354,10 @@ class NumberingOperationsHelper {
|
|
|
3329
3354
|
const newNumbering = new NumberingModel({ numberingId: numberingId, levels });
|
|
3330
3355
|
numberings.push(newNumbering);
|
|
3331
3356
|
}
|
|
3357
|
+
static apply(numberings, numberingId, levels) {
|
|
3358
|
+
let numbering = numberings.find(x => x.numberingId === numberingId);
|
|
3359
|
+
numbering.levels = levels;
|
|
3360
|
+
}
|
|
3332
3361
|
static generateNumberingId(numberings) {
|
|
3333
3362
|
let result = 0;
|
|
3334
3363
|
for (const numbering of numberings) {
|
|
@@ -4742,10 +4771,10 @@ class ParagraphOperationsHelper {
|
|
|
4742
4771
|
target.alignment = value.alignment ?? target.alignment;
|
|
4743
4772
|
target.backgroundColor = value.backgroundColor ?? target.backgroundColor;
|
|
4744
4773
|
target.headingStyleId = value.headingStyleId ?? target.headingStyleId;
|
|
4745
|
-
target.indentFirstLine = value.indentFirstLine
|
|
4746
|
-
target.indentHanging = value.indentHanging
|
|
4747
|
-
target.indentLeft = value.indentLeft
|
|
4748
|
-
target.indentRight = value.indentRight
|
|
4774
|
+
target.indentFirstLine = value.hasIndentFirstLine ? value.indentFirstLine : target.indentFirstLine;
|
|
4775
|
+
target.indentHanging = value.hasIndentHanging ? value.indentHanging : target.indentHanging;
|
|
4776
|
+
target.indentLeft = value.hasIndentLeft ? value.indentLeft : target.indentLeft;
|
|
4777
|
+
target.indentRight = value.hasIndentRight ? value.indentRight : target.indentRight;
|
|
4749
4778
|
target.lineSpacing = value.lineSpacing ?? target.lineSpacing;
|
|
4750
4779
|
target.numberingId = value.numberingId ?? target.numberingId;
|
|
4751
4780
|
target.numberingLevel = value.numberingLevel ?? target.numberingLevel;
|
|
@@ -5486,6 +5515,11 @@ class OperationsHelper {
|
|
|
5486
5515
|
this.addNumbering(contents, document.numberings, model.startIndex, model.endIndex, model.levels);
|
|
5487
5516
|
break;
|
|
5488
5517
|
}
|
|
5518
|
+
case CommandType.ApplyNumberingLevels: {
|
|
5519
|
+
const model = command.applyNumberingLevels;
|
|
5520
|
+
this.applyNumbering(document.numberings, model.levels, model.numberingId);
|
|
5521
|
+
break;
|
|
5522
|
+
}
|
|
5489
5523
|
case CommandType.RestoreNumberings: {
|
|
5490
5524
|
const model = command.restoreNumberings;
|
|
5491
5525
|
this.restoreNumberings(contents, document.numberings, model.paragraphs, model.numberings);
|
|
@@ -5755,6 +5789,9 @@ class OperationsHelper {
|
|
|
5755
5789
|
NumberingOperationsHelper.addNumbering(numberings, newNumberingId, levels);
|
|
5756
5790
|
NumberingOperationsHelper.deleteUnused(numberings, target.paragraphs, oldNumberingIds);
|
|
5757
5791
|
}
|
|
5792
|
+
static applyNumbering(numberings, levels, numberingId) {
|
|
5793
|
+
NumberingOperationsHelper.apply(numberings, numberingId, levels);
|
|
5794
|
+
}
|
|
5758
5795
|
static removeNumberings(target, numberings, startIndex, endIndex) {
|
|
5759
5796
|
const oldNumberingIds = ParagraphOperationsHelper.applyNumbering(target.paragraphs, startIndex, endIndex, null);
|
|
5760
5797
|
NumberingOperationsHelper.deleteUnused(numberings, target.paragraphs, oldNumberingIds);
|
|
@@ -6022,6 +6059,21 @@ class NumberingParagraphStyleModel extends ParagraphStyleModel {
|
|
|
6022
6059
|
}
|
|
6023
6060
|
|
|
6024
6061
|
class NumberingHelper {
|
|
6062
|
+
static { this.romanMap = new Map([
|
|
6063
|
+
[1000, 'm'],
|
|
6064
|
+
[900, 'cm'],
|
|
6065
|
+
[500, 'd'],
|
|
6066
|
+
[400, 'cd'],
|
|
6067
|
+
[100, 'c'],
|
|
6068
|
+
[90, 'xc'],
|
|
6069
|
+
[50, 'l'],
|
|
6070
|
+
[40, 'xl'],
|
|
6071
|
+
[10, 'x'],
|
|
6072
|
+
[9, 'ix'],
|
|
6073
|
+
[5, 'v'],
|
|
6074
|
+
[4, 'iv'],
|
|
6075
|
+
[1, 'i']
|
|
6076
|
+
]); }
|
|
6025
6077
|
static addValueToNumberingInfo(numberingId, numberingInfo, numberingLevels) {
|
|
6026
6078
|
if (numberingInfo[numberingId]) {
|
|
6027
6079
|
return;
|
|
@@ -6065,13 +6117,6 @@ class NumberingHelper {
|
|
|
6065
6117
|
const numbering = numberings.find(x => x.numberingId === id);
|
|
6066
6118
|
return numbering?.levels;
|
|
6067
6119
|
}
|
|
6068
|
-
static calculateNumberingInfo(numberingId, level, numberingInfo, numberings) {
|
|
6069
|
-
const numberingModel = this.findNumberingLevel(numberings, numberingId, level);
|
|
6070
|
-
if (numberingModel?.markerType === NumberingMarkerType.Bullet) {
|
|
6071
|
-
return;
|
|
6072
|
-
}
|
|
6073
|
-
this.calculateMarkerIndexes(numberingId, level, numberingInfo);
|
|
6074
|
-
}
|
|
6075
6120
|
static calculateMarkerIndexes(numberingId, level, numberingInfo) {
|
|
6076
6121
|
if (numberingInfo[numberingId][level].needToRecalculate) {
|
|
6077
6122
|
if (numberingInfo[numberingId][level].needToCalculateFirstMarker) {
|
|
@@ -6092,13 +6137,13 @@ class NumberingHelper {
|
|
|
6092
6137
|
}
|
|
6093
6138
|
}
|
|
6094
6139
|
static getMarker(levelModels, level, numberingId, numberingInfo) {
|
|
6095
|
-
let
|
|
6096
|
-
let index =
|
|
6140
|
+
let levelModel = levelModels[level];
|
|
6141
|
+
let index = levelModel.marker.indexOf('%');
|
|
6097
6142
|
if (index === -1) {
|
|
6098
|
-
return
|
|
6143
|
+
return levelModel.marker;
|
|
6099
6144
|
}
|
|
6100
|
-
const splittedMarker =
|
|
6101
|
-
return this.createMarkerString(numberingInfo, numberingId, splittedMarker);
|
|
6145
|
+
const splittedMarker = levelModel.marker.split('.');
|
|
6146
|
+
return this.createMarkerString(numberingInfo, numberingId, splittedMarker, levelModel.markerType, levelModels);
|
|
6102
6147
|
}
|
|
6103
6148
|
static createDataModel(numberings, paragraphs, paragraphIndex, numberingInfo) {
|
|
6104
6149
|
const paragraph = paragraphs[paragraphIndex];
|
|
@@ -6147,13 +6192,7 @@ class NumberingHelper {
|
|
|
6147
6192
|
numberingInfo[numberingId][level].markerIndex = markerLevels[lastMarkerLevel];
|
|
6148
6193
|
numberingInfo[numberingId][level].needToRecalculate = true;
|
|
6149
6194
|
}
|
|
6150
|
-
static
|
|
6151
|
-
return input
|
|
6152
|
-
.split('.')
|
|
6153
|
-
.filter(x => !!x)
|
|
6154
|
-
.map(x => parseInt(x));
|
|
6155
|
-
}
|
|
6156
|
-
static createMarkerString(numberingInfo, numberingId, splittedMarker) {
|
|
6195
|
+
static createMarkerString(numberingInfo, numberingId, splittedMarker, markerType, markerLevels) {
|
|
6157
6196
|
const markers = splittedMarker.map(x => {
|
|
6158
6197
|
if (x === '') {
|
|
6159
6198
|
return '';
|
|
@@ -6161,9 +6200,22 @@ class NumberingHelper {
|
|
|
6161
6200
|
if (x.indexOf('%') === -1) {
|
|
6162
6201
|
return x;
|
|
6163
6202
|
}
|
|
6203
|
+
let prefix = '';
|
|
6204
|
+
if (x.startsWith('(')) {
|
|
6205
|
+
x = x.slice(1);
|
|
6206
|
+
prefix = '(';
|
|
6207
|
+
}
|
|
6208
|
+
let suffix = '';
|
|
6209
|
+
if (x.endsWith(')')) {
|
|
6210
|
+
x = x.slice(0, -1);
|
|
6211
|
+
suffix = ')';
|
|
6212
|
+
}
|
|
6164
6213
|
const markerLevel = parseInt(x.slice(1));
|
|
6214
|
+
if (markerLevels[markerLevel - 1].markerType === NumberingMarkerType.Bullet) {
|
|
6215
|
+
return markerLevels[markerLevel - 1].marker;
|
|
6216
|
+
}
|
|
6165
6217
|
const markerIndex = numberingInfo[numberingId][markerLevel - 1]?.markerIndex;
|
|
6166
|
-
return `${markerIndex}`;
|
|
6218
|
+
return `${prefix}${this.markerTypeToMarker(markerType, markerIndex)}${suffix}`;
|
|
6167
6219
|
});
|
|
6168
6220
|
return markers.join('.');
|
|
6169
6221
|
}
|
|
@@ -6186,198 +6238,193 @@ class NumberingHelper {
|
|
|
6186
6238
|
const offset = numberingData.width + numberingData.paddingLeft - info.indentLeft;
|
|
6187
6239
|
return info.indentFirstLine !== null || (offset > 0 && offset <= info.indent.markerWidth) ? info.indent.markerWidth : 0;
|
|
6188
6240
|
}
|
|
6241
|
+
static markerTypeToMarker(markerType, sequence) {
|
|
6242
|
+
switch (markerType) {
|
|
6243
|
+
case NumberingMarkerType.Decimal:
|
|
6244
|
+
return `${sequence}`;
|
|
6245
|
+
case NumberingMarkerType.LowerLetter:
|
|
6246
|
+
return this.numberToLetters(sequence);
|
|
6247
|
+
case NumberingMarkerType.UpperLetter:
|
|
6248
|
+
return this.numberToLetters(sequence).toUpperCase();
|
|
6249
|
+
case NumberingMarkerType.LowerRoman:
|
|
6250
|
+
return this.numberToRoman(sequence);
|
|
6251
|
+
case NumberingMarkerType.UpperRoman:
|
|
6252
|
+
return this.numberToRoman(sequence).toUpperCase();
|
|
6253
|
+
case NumberingMarkerType.DecimalZero:
|
|
6254
|
+
return sequence < 10 ? `0${sequence}` : `${sequence}`;
|
|
6255
|
+
default: {
|
|
6256
|
+
return `${sequence}`;
|
|
6257
|
+
}
|
|
6258
|
+
}
|
|
6259
|
+
}
|
|
6260
|
+
static getLevelInfo(input) {
|
|
6261
|
+
return input
|
|
6262
|
+
.split('.')
|
|
6263
|
+
.filter(x => !!x)
|
|
6264
|
+
.map(x => parseInt(x));
|
|
6265
|
+
}
|
|
6266
|
+
static numberToLetters(sequence) {
|
|
6267
|
+
let result = '';
|
|
6268
|
+
while (sequence > 0) {
|
|
6269
|
+
sequence--;
|
|
6270
|
+
const charCode = (sequence % 26) + 97;
|
|
6271
|
+
result = String.fromCharCode(charCode) + result;
|
|
6272
|
+
sequence = Math.floor(sequence / 26);
|
|
6273
|
+
}
|
|
6274
|
+
return result;
|
|
6275
|
+
}
|
|
6276
|
+
static numberToRoman(sequence) {
|
|
6277
|
+
sequence = sequence % 4000; // there are no Roman numerals for values greater than 3999
|
|
6278
|
+
let result = '';
|
|
6279
|
+
for (const [num, roman] of this.romanMap) {
|
|
6280
|
+
while (sequence >= num) {
|
|
6281
|
+
result += roman;
|
|
6282
|
+
sequence -= num;
|
|
6283
|
+
}
|
|
6284
|
+
}
|
|
6285
|
+
return result;
|
|
6286
|
+
}
|
|
6189
6287
|
}
|
|
6190
6288
|
|
|
6191
6289
|
class PositionHelper {
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6290
|
+
static getLineTopOffset(paragraphLines, paragraphLine) {
|
|
6291
|
+
let result = 0;
|
|
6292
|
+
for (let i = 0; i < paragraphLine; i++) {
|
|
6293
|
+
const info = paragraphLines[i];
|
|
6294
|
+
result += info.height + info.endPageOffset + info.offsetBefore + info.offsetAfter;
|
|
6295
|
+
}
|
|
6296
|
+
return result + paragraphLines[paragraphLine].offsetBefore;
|
|
6198
6297
|
}
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
}
|
|
6209
|
-
const
|
|
6210
|
-
|
|
6211
|
-
return {
|
|
6212
|
-
paragraphIndex,
|
|
6213
|
-
lineIndex,
|
|
6214
|
-
lineTopOffset,
|
|
6215
|
-
lineHeight: paragraphLineInfo.height,
|
|
6216
|
-
lineAscent: paragraphLineInfo.ascent
|
|
6217
|
-
};
|
|
6298
|
+
static documentLineToParagraphLine(paragraphs, documentLine) {
|
|
6299
|
+
let index = 0;
|
|
6300
|
+
let paragraph = 0;
|
|
6301
|
+
while (paragraph < paragraphs.length) {
|
|
6302
|
+
if (index + paragraphs[paragraph].paragraphSettings.textLinesInfo.length > documentLine) {
|
|
6303
|
+
break;
|
|
6304
|
+
}
|
|
6305
|
+
index += paragraphs[paragraph].paragraphSettings.textLinesInfo.length;
|
|
6306
|
+
paragraph++;
|
|
6307
|
+
}
|
|
6308
|
+
const paragraphLine = documentLine - index;
|
|
6309
|
+
return { paragraph, paragraphLine };
|
|
6218
6310
|
}
|
|
6219
|
-
static
|
|
6311
|
+
static paragraphToParagraphLine(nextLineIndexes, indexInParagraph) {
|
|
6312
|
+
if (!nextLineIndexes.length || nextLineIndexes[0] > indexInParagraph) {
|
|
6313
|
+
return { paragraphLine: 0, indexInLine: indexInParagraph };
|
|
6314
|
+
}
|
|
6315
|
+
let index = nextLineIndexes.findLastIndex(x => x <= indexInParagraph);
|
|
6316
|
+
const indexInLine = indexInParagraph - nextLineIndexes[index];
|
|
6317
|
+
return { paragraphLine: index + 1, indexInLine };
|
|
6318
|
+
}
|
|
6319
|
+
static paragraphToDocumentLine(session, paragraph, indexInParagraph) {
|
|
6220
6320
|
const paragraphLine = session.displayData.paragraphs[paragraph].lineNumber;
|
|
6221
|
-
|
|
6222
|
-
|
|
6321
|
+
const nextLineIndexes = session.displayData.paragraphs[paragraph].nextLineIndexes;
|
|
6322
|
+
if (!nextLineIndexes.length || nextLineIndexes[0] > indexInParagraph) {
|
|
6223
6323
|
return new CursorParagraph(paragraphLine, indexInParagraph);
|
|
6224
6324
|
}
|
|
6225
6325
|
let line = 0;
|
|
6226
|
-
while (
|
|
6227
|
-
line < session.displayData.paragraphs[paragraph].nextLineIndexes.length) {
|
|
6326
|
+
while (nextLineIndexes[line] <= indexInParagraph && line < nextLineIndexes.length) {
|
|
6228
6327
|
line++;
|
|
6229
6328
|
}
|
|
6230
|
-
|
|
6231
|
-
return new CursorParagraph(paragraphLine + line, index);
|
|
6329
|
+
return new CursorParagraph(paragraphLine + line, indexInParagraph - nextLineIndexes[line - 1]);
|
|
6232
6330
|
}
|
|
6233
|
-
static
|
|
6234
|
-
let
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
}
|
|
6241
|
-
let lineInParagraph = line - session.displayData.paragraphs[paragraph].lineNumber;
|
|
6242
|
-
if (!session.displayData.paragraphs[paragraph].nextLineIndexes.length || lineInParagraph === 0) {
|
|
6243
|
-
return new CursorParagraph(paragraph, indexInLine);
|
|
6244
|
-
}
|
|
6245
|
-
const index = indexInLine + session.displayData.paragraphs[paragraph].nextLineIndexes[lineInParagraph - 1];
|
|
6246
|
-
return new CursorParagraph(paragraph, index);
|
|
6331
|
+
static documentLineToParagraph(session, documentLine, indexInLine) {
|
|
6332
|
+
let paragraphIndex = session.displayData.paragraphs.findIndex(x => x.lineNumber > documentLine);
|
|
6333
|
+
paragraphIndex = paragraphIndex === -1 ? session.displayData.paragraphs.length - 1 : paragraphIndex - 1;
|
|
6334
|
+
const paragraph = session.displayData.paragraphs[paragraphIndex];
|
|
6335
|
+
let paragraphLine = documentLine - paragraph.lineNumber;
|
|
6336
|
+
const indexInParagraph = paragraphLine === 0 ? indexInLine : indexInLine + paragraph.nextLineIndexes[paragraphLine - 1];
|
|
6337
|
+
return new CursorParagraph(paragraphIndex, indexInParagraph);
|
|
6247
6338
|
}
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6339
|
+
static paragraphToPixel(session, paragraph, indexInParagraph) {
|
|
6340
|
+
const line = this.paragraphToParagraphLine(session.displayData.paragraphs[paragraph].nextLineIndexes, indexInParagraph);
|
|
6341
|
+
return this.paragraphLineToPixel(session, paragraph, line.paragraphLine, line.indexInLine);
|
|
6342
|
+
}
|
|
6343
|
+
static documentLineToPixel(session, documentLine, indexInLine) {
|
|
6344
|
+
const { paragraph, paragraphLine } = this.documentLineToParagraphLine(session.displayData.paragraphs, documentLine);
|
|
6345
|
+
return this.paragraphLineToPixel(session, paragraph, paragraphLine, indexInLine);
|
|
6346
|
+
}
|
|
6347
|
+
static paragraphLineToPixel(session, paragraph, paragraphLine, indexInLine) {
|
|
6348
|
+
const marginLeft = session.displayData.pagesFormat[0].pageFormatModel.marginLeft; // this value is the same for all page formats.
|
|
6252
6349
|
const paragraphs = session.displayData.paragraphs;
|
|
6253
|
-
const
|
|
6254
|
-
|
|
6255
|
-
let tokenIndex = column > 0 ? column - 1 : column;
|
|
6350
|
+
const tokens = session.displayData.getParagraphLineTokens(paragraph, paragraphLine);
|
|
6351
|
+
let tokenIndex = indexInLine > 0 ? indexInLine - 1 : indexInLine;
|
|
6256
6352
|
let sizeMax = { ...tokens[tokenIndex] };
|
|
6257
|
-
let lineWidthToPosition =
|
|
6258
|
-
for (let
|
|
6259
|
-
const currentToken = tokens[
|
|
6260
|
-
if (
|
|
6353
|
+
let lineWidthToPosition = marginLeft;
|
|
6354
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
6355
|
+
const currentToken = tokens[i];
|
|
6356
|
+
if (i < indexInLine) {
|
|
6261
6357
|
lineWidthToPosition += currentToken.width;
|
|
6262
6358
|
}
|
|
6263
6359
|
if (sizeMax.ascent < currentToken.ascent) {
|
|
6264
6360
|
sizeMax = currentToken;
|
|
6265
6361
|
}
|
|
6266
6362
|
}
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
const
|
|
6271
|
-
const paragraphTop = paragraph.paragraphSettings.distanceFromTop || 0;
|
|
6272
|
-
const info = paragraph.paragraphSettings.textLinesInfo[paragraphInfo.lineIndex];
|
|
6273
|
-
const markerOffset = NumberingHelper.getOffsetCausedByMarker(paragraph.paragraphSettings.numberingData, info); // todo: verify (case - 1) numbering paragraph with multi-lines; 2) marker is moved far left so it not affect line offset)
|
|
6363
|
+
const lineTopOffset = this.getLineTopOffset(paragraphs[paragraph].paragraphSettings.textLinesInfo, paragraphLine);
|
|
6364
|
+
const paragraphTop = paragraphs[paragraph].paragraphSettings.distanceFromTop || 0;
|
|
6365
|
+
const info = paragraphs[paragraph].paragraphSettings.textLinesInfo[paragraphLine];
|
|
6366
|
+
const markerOffset = NumberingHelper.getOffsetCausedByMarker(paragraphs[paragraph].paragraphSettings.numberingData, info);
|
|
6274
6367
|
return {
|
|
6275
6368
|
pageX: lineWidthToPosition + info.paddingLeft + info.offsetMargin + markerOffset,
|
|
6276
|
-
pageY: paragraphTop +
|
|
6369
|
+
pageY: paragraphTop + lineTopOffset - session.scrollTop,
|
|
6277
6370
|
width: tokens[tokenIndex].width,
|
|
6278
|
-
height:
|
|
6279
|
-
ascent:
|
|
6371
|
+
height: info.height,
|
|
6372
|
+
ascent: info.ascent
|
|
6280
6373
|
};
|
|
6281
6374
|
}
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
const { displayData, scrollTop } = session;
|
|
6287
|
-
yPosition += scrollTop - top;
|
|
6288
|
-
let paragraphIndex = displayData.paragraphs.findIndex(paragraph => paragraph.paragraphSettings.distanceFromTop > yPosition);
|
|
6289
|
-
if (paragraphIndex < 0) {
|
|
6290
|
-
paragraphIndex = displayData.paragraphs.length - 1;
|
|
6291
|
-
}
|
|
6292
|
-
else if (paragraphIndex > 0) {
|
|
6293
|
-
paragraphIndex--;
|
|
6294
|
-
}
|
|
6295
|
-
const paragraphSettings = displayData.paragraphs[paragraphIndex].paragraphSettings;
|
|
6296
|
-
yPosition -= paragraphSettings.distanceFromTop;
|
|
6297
|
-
let lineIndex = 0;
|
|
6298
|
-
while (yPosition > 0 && lineIndex < paragraphSettings.textLinesInfo.length - 1) {
|
|
6299
|
-
const lineInfo = paragraphSettings.textLinesInfo[lineIndex];
|
|
6300
|
-
const lineHeight = lineInfo.height + lineInfo.endPageOffset + lineInfo.offsetBefore + lineInfo.offsetAfter;
|
|
6301
|
-
if (yPosition <= lineHeight) {
|
|
6302
|
-
break;
|
|
6303
|
-
}
|
|
6304
|
-
lineIndex++;
|
|
6305
|
-
yPosition -= lineHeight;
|
|
6306
|
-
}
|
|
6307
|
-
return { paragraphIndex, lineIndex };
|
|
6308
|
-
}
|
|
6309
|
-
/**
|
|
6310
|
-
* Maps a pixel position to a screen position using half-token width comparison.
|
|
6311
|
-
*/
|
|
6312
|
-
static mapPixelToClosestTokenMidpoint(session, xPixel, paragraphIndex, lineIndex, leftOffset) {
|
|
6313
|
-
const paragraphSettings = session.displayData.paragraphs[paragraphIndex].paragraphSettings;
|
|
6314
|
-
const marginLeft = session.displayData.pagesFormat[0].pageFormatModel.marginLeft; // this value is the same for all page formats.
|
|
6315
|
-
const tokens = session.displayData.getParagraphLineTokens(paragraphIndex, lineIndex);
|
|
6316
|
-
const lineInfo = paragraphSettings.textLinesInfo[lineIndex];
|
|
6317
|
-
const line = lineInfo.screenLine;
|
|
6318
|
-
if (tokens[0].isParagraph) {
|
|
6319
|
-
return { line, indexInLine: 0 };
|
|
6320
|
-
}
|
|
6321
|
-
let indexInLine = 0;
|
|
6322
|
-
const markerOffset = NumberingHelper.getOffsetCausedByMarker(paragraphSettings.numberingData, lineInfo);
|
|
6323
|
-
let relativeX = xPixel - leftOffset - marginLeft - lineInfo.paddingLeft - lineInfo.offsetMargin - markerOffset;
|
|
6324
|
-
while (indexInLine < tokens.length && relativeX >= tokens[indexInLine].width / 2) {
|
|
6325
|
-
relativeX -= tokens[indexInLine].width;
|
|
6326
|
-
indexInLine++;
|
|
6327
|
-
}
|
|
6328
|
-
return { line, indexInLine };
|
|
6329
|
-
}
|
|
6330
|
-
/**
|
|
6331
|
-
* Maps a pixel position to a screen position using full-token width comparison.
|
|
6332
|
-
*/
|
|
6333
|
-
static mapPixelToNextTokenBoundary(session, xPixel, paragraphIndex, lineIndex, leftOffset) {
|
|
6334
|
-
const paragraphSettings = session.displayData.paragraphs[paragraphIndex].paragraphSettings;
|
|
6335
|
-
const marginLeft = session.displayData.pagesFormat[0].pageFormatModel.marginLeft; // this value is the same for all page formats.
|
|
6336
|
-
const tokens = session.displayData.getParagraphLineTokens(paragraphIndex, lineIndex);
|
|
6337
|
-
const lineInfo = paragraphSettings.textLinesInfo[lineIndex];
|
|
6338
|
-
const line = lineInfo.screenLine;
|
|
6339
|
-
if (tokens[0].isParagraph) {
|
|
6340
|
-
return { line, indexInLine: 0 };
|
|
6375
|
+
static pixelToParagraphLine(paragraphs, pageY) {
|
|
6376
|
+
let paragraph = paragraphs.findIndex(x => x.paragraphSettings.distanceFromTop > pageY);
|
|
6377
|
+
if (paragraph < 0) {
|
|
6378
|
+
paragraph = paragraphs.length - 1;
|
|
6341
6379
|
}
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
let relativeX = xPixel - leftOffset - marginLeft - lineInfo.paddingLeft - lineInfo.offsetMargin - markerOffset;
|
|
6345
|
-
while (indexInLine < tokens.length && relativeX >= tokens[indexInLine].width) {
|
|
6346
|
-
relativeX -= tokens[indexInLine].width;
|
|
6347
|
-
indexInLine++;
|
|
6380
|
+
else if (paragraph > 0) {
|
|
6381
|
+
paragraph--;
|
|
6348
6382
|
}
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
if (
|
|
6383
|
+
const paragraphSettings = paragraphs[paragraph].paragraphSettings;
|
|
6384
|
+
pageY -= paragraphSettings.distanceFromTop;
|
|
6385
|
+
let paragraphLine = 0;
|
|
6386
|
+
while (pageY > 0 && paragraphLine < paragraphSettings.textLinesInfo.length - 1) {
|
|
6387
|
+
const lineInfo = paragraphSettings.textLinesInfo[paragraphLine];
|
|
6388
|
+
const lineHeight = lineInfo.height + lineInfo.endPageOffset + lineInfo.offsetBefore + lineInfo.offsetAfter;
|
|
6389
|
+
if (pageY <= lineHeight) {
|
|
6356
6390
|
break;
|
|
6357
6391
|
}
|
|
6358
|
-
|
|
6359
|
-
|
|
6392
|
+
paragraphLine++;
|
|
6393
|
+
pageY -= lineHeight;
|
|
6360
6394
|
}
|
|
6361
|
-
|
|
6362
|
-
return { paragraphIndex, lineIndex };
|
|
6395
|
+
return { paragraph, paragraphLine };
|
|
6363
6396
|
}
|
|
6364
|
-
static
|
|
6397
|
+
static pixelToParagraph(session, pageX, pageY, tokenDivider) {
|
|
6398
|
+
const marginLeft = session.displayData.pagesFormat[0].pageFormatModel.marginLeft; // this value is the same for all page formats.
|
|
6365
6399
|
const paragraphs = session.displayData.paragraphs;
|
|
6400
|
+
const { paragraph, paragraphLine } = this.pixelToParagraphLine(paragraphs, pageY);
|
|
6401
|
+
const settings = paragraphs[paragraph].paragraphSettings;
|
|
6402
|
+
const tokens = session.displayData.getParagraphLineTokens(paragraph, paragraphLine);
|
|
6403
|
+
const lineInfo = settings.textLinesInfo[paragraphLine];
|
|
6404
|
+
const indexInLine = this.getIndexInLine(tokens, lineInfo, settings.numberingData, marginLeft, pageX, tokenDivider);
|
|
6405
|
+
const indexInParagraph = paragraphLine === 0 ? indexInLine : indexInLine + paragraphs[paragraph].nextLineIndexes[paragraphLine - 1];
|
|
6406
|
+
return { paragraph, indexInParagraph };
|
|
6407
|
+
}
|
|
6408
|
+
static pixelToIndexInLine(session, documentLine, pageX, tokenDivider) {
|
|
6366
6409
|
const marginLeft = session.displayData.pagesFormat[0].pageFormatModel.marginLeft; // this value is the same for all page formats.
|
|
6367
|
-
const {
|
|
6368
|
-
const
|
|
6410
|
+
const { paragraph, paragraphLine } = this.documentLineToParagraphLine(session.displayData.paragraphs, documentLine);
|
|
6411
|
+
const settings = session.displayData.paragraphs[paragraph].paragraphSettings;
|
|
6412
|
+
const tokens = session.displayData.getParagraphLineTokens(paragraph, paragraphLine);
|
|
6413
|
+
const lineInfo = settings.textLinesInfo[paragraphLine];
|
|
6414
|
+
return this.getIndexInLine(tokens, lineInfo, settings.numberingData, marginLeft, pageX, tokenDivider);
|
|
6415
|
+
}
|
|
6416
|
+
static getIndexInLine(tokens, lineInfo, numberingData, marginLeft, pageX, tokenDivider) {
|
|
6369
6417
|
if (tokens[0].isParagraph) {
|
|
6370
6418
|
return 0;
|
|
6371
6419
|
}
|
|
6372
|
-
let
|
|
6373
|
-
const
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
index++;
|
|
6420
|
+
let indexInLine = 0;
|
|
6421
|
+
const markerOffset = NumberingHelper.getOffsetCausedByMarker(numberingData, lineInfo);
|
|
6422
|
+
let width = pageX - marginLeft - lineInfo.paddingLeft - lineInfo.offsetMargin - markerOffset;
|
|
6423
|
+
while (indexInLine < tokens.length && width >= tokens[indexInLine].width / tokenDivider) {
|
|
6424
|
+
width -= tokens[indexInLine].width;
|
|
6425
|
+
indexInLine++;
|
|
6379
6426
|
}
|
|
6380
|
-
return
|
|
6427
|
+
return indexInLine;
|
|
6381
6428
|
}
|
|
6382
6429
|
}
|
|
6383
6430
|
|
|
@@ -6467,15 +6514,16 @@ class RenderingHelper {
|
|
|
6467
6514
|
if (wordSpacing) {
|
|
6468
6515
|
const lineStart = lineIndex > 0 ? paragraph.nextLineIndexes[lineIndex - 1] : 0;
|
|
6469
6516
|
const lineStartIndex = start + lineStart;
|
|
6517
|
+
const renderedInLine = renderedCount - lineStart;
|
|
6470
6518
|
const wordSpacingStart = lineInfos[lineIndex].wordSpacingStart;
|
|
6471
6519
|
const wordSpacingEnd = lineInfos[lineIndex].wordSpacingEnd;
|
|
6472
|
-
if (
|
|
6520
|
+
if (renderedInLine < wordSpacingStart && lineStartIndex + wordSpacingStart < fragmentEnd) {
|
|
6473
6521
|
fragmentEnd = lineStartIndex + wordSpacingStart;
|
|
6474
6522
|
}
|
|
6475
|
-
else if (
|
|
6523
|
+
else if (renderedInLine < wordSpacingEnd && lineStartIndex + wordSpacingEnd < fragmentEnd) {
|
|
6476
6524
|
fragmentEnd = lineStartIndex + wordSpacingEnd;
|
|
6477
6525
|
}
|
|
6478
|
-
if (
|
|
6526
|
+
if (renderedInLine < wordSpacingStart || renderedInLine > wordSpacingEnd) {
|
|
6479
6527
|
wordSpacing = null;
|
|
6480
6528
|
}
|
|
6481
6529
|
}
|
|
@@ -7387,15 +7435,9 @@ class Range {
|
|
|
7387
7435
|
const compare = this.compareSingleLine(position);
|
|
7388
7436
|
return compare ?? this.compareMultiLine(position);
|
|
7389
7437
|
}
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
* @param {EditSession} session The `EditSession` to retrieve coordinates from
|
|
7394
|
-
* @returns {Range}
|
|
7395
|
-
**/
|
|
7396
|
-
toScreenRange(session) {
|
|
7397
|
-
const screenPosStart = PositionHelper.documentToScreen(session, this.start.row, this.start.column);
|
|
7398
|
-
const screenPosEnd = PositionHelper.documentToScreen(session, this.end.row, this.end.column);
|
|
7438
|
+
paragraphToDocumentLine(session) {
|
|
7439
|
+
const screenPosStart = PositionHelper.paragraphToDocumentLine(session, this.start.row, this.start.column);
|
|
7440
|
+
const screenPosEnd = PositionHelper.paragraphToDocumentLine(session, this.end.row, this.end.column);
|
|
7399
7441
|
return new Range(screenPosStart, screenPosEnd);
|
|
7400
7442
|
}
|
|
7401
7443
|
/**
|
|
@@ -7467,7 +7509,7 @@ class RemoveWithParagraphModel {
|
|
|
7467
7509
|
constructor(fields) {
|
|
7468
7510
|
if (fields) {
|
|
7469
7511
|
if (fields.paragraphStyle) {
|
|
7470
|
-
fields.paragraphStyle = new
|
|
7512
|
+
fields.paragraphStyle = new ParagraphStyleExtModel(fields.paragraphStyle);
|
|
7471
7513
|
}
|
|
7472
7514
|
Object.assign(this, fields);
|
|
7473
7515
|
}
|
|
@@ -7518,7 +7560,7 @@ class RestoreWithParagraphModel {
|
|
|
7518
7560
|
constructor(fields) {
|
|
7519
7561
|
if (fields) {
|
|
7520
7562
|
if (fields.paragraphStyle) {
|
|
7521
|
-
fields.paragraphStyle = new
|
|
7563
|
+
fields.paragraphStyle = new ParagraphStyleExtModel(fields.paragraphStyle);
|
|
7522
7564
|
}
|
|
7523
7565
|
if (fields.restore) {
|
|
7524
7566
|
fields.restore = new RestoreModel(fields.restore);
|
|
@@ -7548,6 +7590,9 @@ class CommandModel {
|
|
|
7548
7590
|
if (fields.applyImageStyle) {
|
|
7549
7591
|
fields.applyImageStyle = new ApplyImageStyleModel(fields.applyImageStyle);
|
|
7550
7592
|
}
|
|
7593
|
+
if (fields.applyNumberingLevels) {
|
|
7594
|
+
fields.applyNumberingLevels = new ApplyNumberingLevelsModel(fields.applyNumberingLevels);
|
|
7595
|
+
}
|
|
7551
7596
|
if (fields.applyPageFormat) {
|
|
7552
7597
|
fields.applyPageFormat = new ApplyPageFormatModel(fields.applyPageFormat);
|
|
7553
7598
|
}
|
|
@@ -7669,6 +7714,10 @@ class SaveCommandsHelper {
|
|
|
7669
7714
|
const addNumbering = new AddNumberingModel({ startIndex, endIndex, levels });
|
|
7670
7715
|
return new CommandModel({ commandType: CommandType.AddNumbering, addNumbering, targets });
|
|
7671
7716
|
}
|
|
7717
|
+
static getApplyNumberingCommand(numberingId, levels, targets) {
|
|
7718
|
+
const applyNumberingLevels = new ApplyNumberingLevelsModel({ numberingId, levels });
|
|
7719
|
+
return new CommandModel({ commandType: CommandType.ApplyNumberingLevels, applyNumberingLevels, targets });
|
|
7720
|
+
}
|
|
7672
7721
|
static getRemoveNumberingsCommand(startIndex, endIndex, targets) {
|
|
7673
7722
|
const removeNumberings = new RemoveNumberingsModel({ startIndex, endIndex });
|
|
7674
7723
|
return new CommandModel({ commandType: CommandType.RemoveNumberings, removeNumberings, targets });
|
|
@@ -8329,7 +8378,7 @@ class Selection {
|
|
|
8329
8378
|
this.placeCursor(position);
|
|
8330
8379
|
}
|
|
8331
8380
|
moveCursorUp(session, position) {
|
|
8332
|
-
const line = PositionHelper.
|
|
8381
|
+
const line = PositionHelper.paragraphToDocumentLine(session, position.row, position.column);
|
|
8333
8382
|
if (line.row === 0) {
|
|
8334
8383
|
this.selectLineStart(session);
|
|
8335
8384
|
}
|
|
@@ -8338,7 +8387,7 @@ class Selection {
|
|
|
8338
8387
|
}
|
|
8339
8388
|
}
|
|
8340
8389
|
moveCursorDown(session, position) {
|
|
8341
|
-
const line = PositionHelper.
|
|
8390
|
+
const line = PositionHelper.paragraphToDocumentLine(session, position.row, position.column);
|
|
8342
8391
|
const lastParagraphsIndex = session.displayData.paragraphs.length - 1;
|
|
8343
8392
|
const lastParagraph = session.displayData.getParagraphSettings(lastParagraphsIndex);
|
|
8344
8393
|
const lastParagraphLine = lastParagraph.textLinesInfo[lastParagraph.textLinesInfo.length - 1].screenLine;
|
|
@@ -8351,10 +8400,10 @@ class Selection {
|
|
|
8351
8400
|
}
|
|
8352
8401
|
moveToLine(session, line, fromLine) {
|
|
8353
8402
|
if (!this.keepLinePositionX) {
|
|
8354
|
-
this.keepLinePositionX = PositionHelper.
|
|
8403
|
+
this.keepLinePositionX = PositionHelper.documentLineToPixel(session, fromLine.row, fromLine.column).pageX;
|
|
8355
8404
|
}
|
|
8356
|
-
const
|
|
8357
|
-
this.cursor = PositionHelper.
|
|
8405
|
+
const indexInLine = PositionHelper.pixelToIndexInLine(session, line, this.keepLinePositionX, 2);
|
|
8406
|
+
this.cursor = PositionHelper.documentLineToParagraph(session, line, indexInLine);
|
|
8358
8407
|
this.overlayService.close();
|
|
8359
8408
|
}
|
|
8360
8409
|
getCursorLeft(session) {
|
|
@@ -8373,30 +8422,29 @@ class Selection {
|
|
|
8373
8422
|
return ContentHelper.documentIndexToParagraphIndex(session.displayData.paragraphs, index + 1);
|
|
8374
8423
|
}
|
|
8375
8424
|
getLineStart(session, position) {
|
|
8376
|
-
const line = PositionHelper.
|
|
8377
|
-
return PositionHelper.
|
|
8425
|
+
const line = PositionHelper.paragraphToDocumentLine(session, position.row, position.column);
|
|
8426
|
+
return PositionHelper.documentLineToParagraph(session, line.row, 0);
|
|
8378
8427
|
}
|
|
8379
8428
|
getLineEnd(session, position) {
|
|
8380
|
-
const line = PositionHelper.
|
|
8429
|
+
const line = PositionHelper.paragraphToDocumentLine(session, position.row, position.column);
|
|
8381
8430
|
const paragraphLength = session.displayData.getParagraphContent(position.row).length;
|
|
8382
8431
|
const linesCount = session.displayData.getParagraphSettings(position.row).textLinesInfo.length;
|
|
8383
8432
|
if (linesCount === 1) {
|
|
8384
|
-
return PositionHelper.
|
|
8433
|
+
return PositionHelper.documentLineToParagraph(session, line.row, paragraphLength);
|
|
8385
8434
|
}
|
|
8386
8435
|
const paragraphLine = line.row - session.displayData.paragraphs[position.row].lineNumber;
|
|
8436
|
+
const nextLineIndexes = session.displayData.paragraphs[position.row].nextLineIndexes;
|
|
8387
8437
|
let index;
|
|
8388
8438
|
if (paragraphLine === 0) {
|
|
8389
|
-
index =
|
|
8439
|
+
index = nextLineIndexes[0];
|
|
8390
8440
|
}
|
|
8391
8441
|
else if (paragraphLine === linesCount - 1) {
|
|
8392
|
-
index = paragraphLength -
|
|
8442
|
+
index = paragraphLength - nextLineIndexes[paragraphLine - 1];
|
|
8393
8443
|
}
|
|
8394
8444
|
else {
|
|
8395
|
-
index =
|
|
8396
|
-
session.displayData.paragraphs[position.row].nextLineIndexes[paragraphLine] -
|
|
8397
|
-
session.displayData.paragraphs[position.row].nextLineIndexes[paragraphLine - 1];
|
|
8445
|
+
index = nextLineIndexes[paragraphLine] - nextLineIndexes[paragraphLine - 1];
|
|
8398
8446
|
}
|
|
8399
|
-
return PositionHelper.
|
|
8447
|
+
return PositionHelper.documentLineToParagraph(session, line.row, index);
|
|
8400
8448
|
}
|
|
8401
8449
|
getWordRight(session, position) {
|
|
8402
8450
|
let row = position.row;
|
|
@@ -8639,7 +8687,7 @@ class Editor {
|
|
|
8639
8687
|
this.session.applyToolbarStyles();
|
|
8640
8688
|
this.onSetCommentsVisibility(!!this.model.comments.length);
|
|
8641
8689
|
this.search = new Search(editorService);
|
|
8642
|
-
this.subscriptions.push(this.changedEdgeSizeSubscription(), this.changedEdgeSubscription(), this.changedTableSizeSubscription(), this.clipboardDataSubscription(), this.copySelectedSubscription(), this.createCustomComponentSubscription(), this.replaceByCustomComponentSubscription(), this.cutSelectedSubscription(), this.disableSelectionSubscription(), this.endMousePressSubscription(), this.imageLoadedSubscription(), this.insertBreakSubscription(), this.insertImageSubscription(), this.insertLinkSubscription(), this.insertTableColumnsSubscription(), this.insertTableRowsSubscription(), this.insertTableSubscription(), this.updateTableBorderStyleSubscription(), this.updateTableBorderWidthSubscription(), this.updateTableBordersSubscription(), this.selectSpacingSubscription(), this.selectBeforeSubscription(), this.selectAfterSubscription(), this.insertTextSubscription(), this.pasteFromClipboardSubscription(), this.printSubscription(), this.redoSubscription(), this.removeLeftSubscription(), this.removeNumberingsSubscription(), this.removeRightSubscription(), this.removeSelectedSubscription(), this.removeTableColumnsSubscription(), this.removeTableRowsSubscription(), this.removeTableSubscription(), this.rerenderSubscription(), this.resizeTableColumnsSubscription(), ...this.searchOptionSubscriptions(), ...this.replaceSubscription(), this.grammarReplaceSubscription(), this.ignoreGrammarErrorSubscription(), this.selectAllSubscription(), this.setImageStyleSubscription(), this.setNumberingTemplateTypeSubscription(), this.setParagraphStylesSubscription(), this.setTextStylesSubscription(), this.undoSubscription(), this.updateEdgeSubscription(), this.viewOnlyModeSubscription(), this.applyPageFormatSubscription(), this.applyRightMarginPageFormatSubscription(), this.applyLeftMarginPageFormatSubscription(), this.insertPageFormatSubscription(), this.applyDocumentPageFormatSubscription(), this.dragMoveSubscription(), this.dragDropSubscription(), this.applyFirstLinePositionSubscription(), this.applyRightIndentParagraphSubscription(), this.applyLeftIndentParagraphSubscription(), this.applyTabSettingsSubscription(), this.commandCreatedForEdges(), ...this.commentCreationSubscriptions(), this.
|
|
8690
|
+
this.subscriptions.push(this.changedEdgeSizeSubscription(), this.changedEdgeSubscription(), this.changedTableSizeSubscription(), this.clipboardDataSubscription(), this.copySelectedSubscription(), this.createCustomComponentSubscription(), this.replaceByCustomComponentSubscription(), this.cutSelectedSubscription(), this.disableSelectionSubscription(), this.endMousePressSubscription(), this.imageLoadedSubscription(), this.insertBreakSubscription(), this.insertImageSubscription(), this.insertLinkSubscription(), this.insertTableColumnsSubscription(), this.insertTableRowsSubscription(), this.insertTableSubscription(), this.updateTableBorderStyleSubscription(), this.updateTableBorderWidthSubscription(), this.updateTableBordersSubscription(), this.selectSpacingSubscription(), this.selectBeforeSubscription(), this.selectAfterSubscription(), this.insertTextSubscription(), this.pasteFromClipboardSubscription(), this.printSubscription(), this.redoSubscription(), this.removeLeftSubscription(), this.removeNumberingsSubscription(), this.removeRightSubscription(), this.removeSelectedSubscription(), this.removeTableColumnsSubscription(), this.removeTableRowsSubscription(), this.removeTableSubscription(), this.rerenderSubscription(), this.resizeTableColumnsSubscription(), ...this.searchOptionSubscriptions(), ...this.replaceSubscription(), this.grammarReplaceSubscription(), this.ignoreGrammarErrorSubscription(), this.selectAllSubscription(), this.setImageStyleSubscription(), this.setNumberingTemplateTypeSubscription(), this.setParagraphStylesSubscription(), this.setTextStylesSubscription(), this.undoSubscription(), this.updateEdgeSubscription(), this.viewOnlyModeSubscription(), this.applyPageFormatSubscription(), this.applyRightMarginPageFormatSubscription(), this.applyLeftMarginPageFormatSubscription(), this.insertPageFormatSubscription(), this.applyDocumentPageFormatSubscription(), this.dragMoveSubscription(), this.dragDropSubscription(), this.applyFirstLinePositionSubscription(), this.applyRightIndentParagraphSubscription(), this.applyLeftIndentParagraphSubscription(), this.applyTabSettingsSubscription(), this.commandCreatedForEdges(), ...this.commentCreationSubscriptions(), this.removeCommentSubscriptions(), this.rerenderCommentsSubscription(), this.selectCommentSubscription(), this.setComentsVisibilitySubscription(), this.getCommentTextSubscription(), this.replaceCommentTextSubscription());
|
|
8643
8691
|
}
|
|
8644
8692
|
destroy() {
|
|
8645
8693
|
this.subscriptions.forEach(s => s?.unsubscribe());
|
|
@@ -8654,7 +8702,7 @@ class Editor {
|
|
|
8654
8702
|
selectPageDown() {
|
|
8655
8703
|
const config = this.mainRenderer.layerConfig;
|
|
8656
8704
|
const line = config.visibleRange.endScreenLine;
|
|
8657
|
-
const position = PositionHelper.
|
|
8705
|
+
const position = PositionHelper.documentLineToParagraph(this.mainSession, line, 0);
|
|
8658
8706
|
this.selection.moveSelection(position);
|
|
8659
8707
|
this.mainRenderer.scrollBy(config.height);
|
|
8660
8708
|
this.scrollCursorIntoMainView(0.5);
|
|
@@ -8663,7 +8711,7 @@ class Editor {
|
|
|
8663
8711
|
selectPageUp() {
|
|
8664
8712
|
const config = this.mainRenderer.layerConfig;
|
|
8665
8713
|
const line = config.visibleRange.startScreenLine;
|
|
8666
|
-
const position = PositionHelper.
|
|
8714
|
+
const position = PositionHelper.documentLineToParagraph(this.mainSession, line, 0);
|
|
8667
8715
|
this.selection.moveSelection(position);
|
|
8668
8716
|
this.mainRenderer.scrollBy(-config.height);
|
|
8669
8717
|
this.scrollCursorIntoMainView(0.5);
|
|
@@ -8672,7 +8720,7 @@ class Editor {
|
|
|
8672
8720
|
gotoPageDown() {
|
|
8673
8721
|
const config = this.mainRenderer.layerConfig;
|
|
8674
8722
|
const line = config.visibleRange.endScreenLine;
|
|
8675
|
-
const position = PositionHelper.
|
|
8723
|
+
const position = PositionHelper.documentLineToParagraph(this.mainSession, line, 0);
|
|
8676
8724
|
this.selection.placeCursor(position);
|
|
8677
8725
|
this.mainRenderer.scrollBy(config.height);
|
|
8678
8726
|
this.scrollCursorIntoMainView(0.5);
|
|
@@ -8681,7 +8729,7 @@ class Editor {
|
|
|
8681
8729
|
gotoPageUp() {
|
|
8682
8730
|
const config = this.mainRenderer.layerConfig;
|
|
8683
8731
|
const line = config.visibleRange.startScreenLine;
|
|
8684
|
-
const position = PositionHelper.
|
|
8732
|
+
const position = PositionHelper.documentLineToParagraph(this.mainSession, line, 0);
|
|
8685
8733
|
this.selection.placeCursor(position);
|
|
8686
8734
|
this.mainRenderer.scrollBy(-config.height);
|
|
8687
8735
|
this.scrollCursorIntoMainView(0.5);
|
|
@@ -8692,7 +8740,8 @@ class Editor {
|
|
|
8692
8740
|
if (!component) {
|
|
8693
8741
|
return;
|
|
8694
8742
|
}
|
|
8695
|
-
const
|
|
8743
|
+
const paragraphPos = this.session.selection.cursor;
|
|
8744
|
+
const cursor = PositionHelper.paragraphToPixel(this.session, paragraphPos.row, paragraphPos.column);
|
|
8696
8745
|
const rect = this.renderer.container.getBoundingClientRect();
|
|
8697
8746
|
const x = rect.left + cursor.pageX;
|
|
8698
8747
|
const y = rect.top + cursor.pageY + cursor.height;
|
|
@@ -8784,11 +8833,14 @@ class Editor {
|
|
|
8784
8833
|
}
|
|
8785
8834
|
if (this.selection.range.start.column === 0) {
|
|
8786
8835
|
const paragraph = this.session.displayData.paragraphs[this.selection.range.start.row];
|
|
8787
|
-
if (paragraph.paragraphSettings.numberingData.numberingId && paragraph.paragraphSettings.numberingData.level <=
|
|
8788
|
-
this.applyParagraphStyles(new
|
|
8836
|
+
if (paragraph.paragraphSettings.numberingData.numberingId && paragraph.paragraphSettings.numberingData.level <= 7) {
|
|
8837
|
+
this.applyParagraphStyles(new ParagraphStyleExtModel({
|
|
8789
8838
|
numberingLevel: paragraph.paragraphSettings.numberingData.level + 1,
|
|
8839
|
+
hasIndentLeft: true,
|
|
8790
8840
|
indentLeft: null,
|
|
8841
|
+
hasIndentFirstLine: true,
|
|
8791
8842
|
indentFirstLine: null,
|
|
8843
|
+
hasIndentHanging: true,
|
|
8792
8844
|
indentHanging: null
|
|
8793
8845
|
}));
|
|
8794
8846
|
return;
|
|
@@ -8813,10 +8865,13 @@ class Editor {
|
|
|
8813
8865
|
if (paragraph.paragraphSettings.numberingData.level === 0) {
|
|
8814
8866
|
return;
|
|
8815
8867
|
}
|
|
8816
|
-
this.applyParagraphStyles(new
|
|
8868
|
+
this.applyParagraphStyles(new ParagraphStyleExtModel({
|
|
8817
8869
|
numberingLevel: paragraph.paragraphSettings.numberingData.level - 1,
|
|
8870
|
+
hasIndentLeft: true,
|
|
8818
8871
|
indentLeft: null,
|
|
8872
|
+
hasIndentFirstLine: true,
|
|
8819
8873
|
indentFirstLine: null,
|
|
8874
|
+
hasIndentHanging: true,
|
|
8820
8875
|
indentHanging: null
|
|
8821
8876
|
}));
|
|
8822
8877
|
return;
|
|
@@ -9002,14 +9057,41 @@ class Editor {
|
|
|
9002
9057
|
this.session.applyParagraphs(updatedParagraphs);
|
|
9003
9058
|
this.renderer.updateCursor();
|
|
9004
9059
|
}
|
|
9005
|
-
setNumberingTemplate(
|
|
9060
|
+
setNumberingTemplate(newLevels, updateOnlySelectedLevels) {
|
|
9006
9061
|
const range = this.selection.range;
|
|
9007
9062
|
const startIndex = this.session.model.paragraphs[range.start.row].insertIndex;
|
|
9008
|
-
const
|
|
9009
|
-
|
|
9010
|
-
|
|
9063
|
+
const numberingLevels = this.getUniformNumberingLevels(range.start.row, range.end.row);
|
|
9064
|
+
if (numberingLevels) {
|
|
9065
|
+
const numberingId = this.session.model.paragraphs[range.start.row].paragraphStyle.numberingId;
|
|
9066
|
+
const numbering = this.session.generalProperties.numberings.find(x => x.numberingId === numberingId);
|
|
9067
|
+
let updatedLevels = newLevels;
|
|
9068
|
+
if (updateOnlySelectedLevels) {
|
|
9069
|
+
updatedLevels = numbering.levels.map(x => (numberingLevels.has(x.level) ? newLevels.find(y => y.level === x.level) : x));
|
|
9070
|
+
}
|
|
9071
|
+
this.saveApplyNumberingListsToHistory(updatedLevels, numbering.levels, numberingId);
|
|
9072
|
+
this.session.applyNumbering(updatedLevels, numberingId);
|
|
9073
|
+
}
|
|
9074
|
+
else {
|
|
9075
|
+
const endIndex = this.session.model.paragraphs[range.end.row].insertIndex;
|
|
9076
|
+
this.saveAddNumberingToHistory(newLevels, startIndex, endIndex);
|
|
9077
|
+
this.session.addNumbering(newLevels, startIndex, endIndex, null);
|
|
9078
|
+
}
|
|
9011
9079
|
this.renderer.updateCursor();
|
|
9012
9080
|
}
|
|
9081
|
+
getUniformNumberingLevels(start, end) {
|
|
9082
|
+
const numberingId = this.session.model.paragraphs[start].paragraphStyle.numberingId;
|
|
9083
|
+
if (!numberingId) {
|
|
9084
|
+
return null;
|
|
9085
|
+
}
|
|
9086
|
+
const levels = new Set();
|
|
9087
|
+
for (let i = start; i <= end; i++) {
|
|
9088
|
+
if (numberingId !== this.session.model.paragraphs[i].paragraphStyle.numberingId) {
|
|
9089
|
+
return null;
|
|
9090
|
+
}
|
|
9091
|
+
levels.add(this.session.model.paragraphs[i].paragraphStyle.numberingLevel);
|
|
9092
|
+
}
|
|
9093
|
+
return levels;
|
|
9094
|
+
}
|
|
9013
9095
|
removeNumberingsFromParagraphs() {
|
|
9014
9096
|
const range = this.selection.range;
|
|
9015
9097
|
const startIndex = this.session.model.paragraphs[range.start.row].insertIndex;
|
|
@@ -9135,7 +9217,7 @@ class Editor {
|
|
|
9135
9217
|
command = SaveCommandsHelper.getApplyTextStyleCommand(startIndex, endIndex, textStyle, this.targets);
|
|
9136
9218
|
}
|
|
9137
9219
|
else if (operation instanceof ApplyParagraphStyleModel) {
|
|
9138
|
-
const copy = new
|
|
9220
|
+
const copy = new ParagraphStyleExtModel(operation.paragraphStyle);
|
|
9139
9221
|
this.session.applyParagraphStyle(operation.startIndex, operation.endIndex, copy);
|
|
9140
9222
|
const { startIndex, endIndex, paragraphStyle } = operation;
|
|
9141
9223
|
command = SaveCommandsHelper.getApplyParagraphStyleCommand(startIndex, endIndex, paragraphStyle, this.targets);
|
|
@@ -9301,6 +9383,10 @@ class Editor {
|
|
|
9301
9383
|
this.changedTableSize(operation.insertIndex, this.session.sessionId);
|
|
9302
9384
|
command = SaveCommandsHelper.getApplyTableCellsStylesCommand(operation, this.targets);
|
|
9303
9385
|
}
|
|
9386
|
+
else if (operation instanceof ApplyNumberingLevelsModel) {
|
|
9387
|
+
this.session.applyNumbering(operation.levels, operation.numberingId);
|
|
9388
|
+
command = SaveCommandsHelper.getApplyNumberingCommand(operation.numberingId, operation.levels, this.targets);
|
|
9389
|
+
}
|
|
9304
9390
|
else {
|
|
9305
9391
|
throw new Error('Undo/redo is not implemented for the Operation');
|
|
9306
9392
|
}
|
|
@@ -9394,6 +9480,10 @@ class Editor {
|
|
|
9394
9480
|
this.history.pushAddNumbering(startIndex, endIndex, templateLevels, paragraphsDeepCopy, numberings);
|
|
9395
9481
|
this.commandsService.createCommand(SaveCommandsHelper.getAddNumberingCommand(startIndex, endIndex, templateLevels, this.targets));
|
|
9396
9482
|
}
|
|
9483
|
+
saveApplyNumberingListsToHistory(newNumberingLevels, oldNumberingLevels, numberingId) {
|
|
9484
|
+
this.history.pushApplyNumbering(numberingId, newNumberingLevels, oldNumberingLevels);
|
|
9485
|
+
this.commandsService.createCommand(SaveCommandsHelper.getApplyNumberingCommand(numberingId, newNumberingLevels, this.targets));
|
|
9486
|
+
}
|
|
9397
9487
|
saveRemoveNumberingToHistory(startIndex, endIndex) {
|
|
9398
9488
|
const paragraphs = IndexedElementHelper.sliceSection(this.session.model.paragraphs, startIndex, endIndex);
|
|
9399
9489
|
const paragraphsDeepCopy = paragraphs.map(x => new ParagraphModel({ insertIndex: x.insertIndex, paragraphStyle: new ParagraphStyleModel({ ...x.paragraphStyle }) }));
|
|
@@ -9505,11 +9595,23 @@ class Editor {
|
|
|
9505
9595
|
const operation = new RemoveWithParagraphModel({
|
|
9506
9596
|
startIndex: restoreModel.insertIndex,
|
|
9507
9597
|
count: restoreModel.text.length,
|
|
9508
|
-
paragraphStyle: new
|
|
9598
|
+
paragraphStyle: new ParagraphStyleExtModel({
|
|
9599
|
+
...firstParagraph.paragraphStyle,
|
|
9600
|
+
hasIndentFirstLine: true,
|
|
9601
|
+
hasIndentHanging: true,
|
|
9602
|
+
hasIndentLeft: true,
|
|
9603
|
+
hasIndentRight: true
|
|
9604
|
+
})
|
|
9509
9605
|
});
|
|
9510
9606
|
const reversed = new RestoreWithParagraphModel({
|
|
9511
9607
|
restore: restoreModel,
|
|
9512
|
-
paragraphStyle: new
|
|
9608
|
+
paragraphStyle: new ParagraphStyleExtModel({
|
|
9609
|
+
...lastParagraph.paragraphStyle,
|
|
9610
|
+
hasIndentFirstLine: true,
|
|
9611
|
+
hasIndentHanging: true,
|
|
9612
|
+
hasIndentLeft: true,
|
|
9613
|
+
hasIndentRight: true
|
|
9614
|
+
})
|
|
9513
9615
|
});
|
|
9514
9616
|
this.saveRemoveWithParagraphToHistory(operation, reversed);
|
|
9515
9617
|
this.removeExternalData();
|
|
@@ -9530,7 +9632,15 @@ class Editor {
|
|
|
9530
9632
|
}
|
|
9531
9633
|
removeOrLowerNestingNumbering(paragraph) {
|
|
9532
9634
|
if (paragraph.paragraphSettings.numberingData.level > 0) {
|
|
9533
|
-
this.applyParagraphStyles(new
|
|
9635
|
+
this.applyParagraphStyles(new ParagraphStyleExtModel({
|
|
9636
|
+
numberingLevel: paragraph.paragraphSettings.numberingData.level - 1,
|
|
9637
|
+
hasIndentFirstLine: true,
|
|
9638
|
+
indentFirstLine: null,
|
|
9639
|
+
hasIndentHanging: true,
|
|
9640
|
+
indentHanging: null,
|
|
9641
|
+
hasIndentLeft: true,
|
|
9642
|
+
indentLeft: null
|
|
9643
|
+
}));
|
|
9534
9644
|
}
|
|
9535
9645
|
else {
|
|
9536
9646
|
this.removeNumberingsFromParagraphs();
|
|
@@ -9592,9 +9702,9 @@ class Editor {
|
|
|
9592
9702
|
this.saveAttachCommentToHistory(commentModel);
|
|
9593
9703
|
}
|
|
9594
9704
|
onCommentRemoved(id) {
|
|
9595
|
-
const
|
|
9705
|
+
const session = this.regulatorService.getCommentSessionModel(id);
|
|
9596
9706
|
const comment = session.session.removeComment(id);
|
|
9597
|
-
this.saveRemoveCommentToHistory(comment,
|
|
9707
|
+
this.saveRemoveCommentToHistory(comment, session.source.getTarget());
|
|
9598
9708
|
this.editorService.removeCommentData([id]);
|
|
9599
9709
|
session.renderer.loop.schedule({ comments: true });
|
|
9600
9710
|
}
|
|
@@ -9656,7 +9766,7 @@ class Editor {
|
|
|
9656
9766
|
}
|
|
9657
9767
|
}
|
|
9658
9768
|
onLeftClick(event) {
|
|
9659
|
-
const position = this.renderer.
|
|
9769
|
+
const position = this.renderer.screenToParagraph(event.clientX, event.clientY);
|
|
9660
9770
|
if (!this.selection.isEmpty && this.session.isPositionInRange(position, this.selection.selectedRange)) {
|
|
9661
9771
|
this.onSelectionLeftClick(event);
|
|
9662
9772
|
}
|
|
@@ -9683,7 +9793,7 @@ class Editor {
|
|
|
9683
9793
|
this.focusCustomComponent(customElement);
|
|
9684
9794
|
return;
|
|
9685
9795
|
}
|
|
9686
|
-
const position = this.renderer.
|
|
9796
|
+
const position = this.renderer.screenToParagraph(event.clientX, event.clientY, 2);
|
|
9687
9797
|
if (event.shiftKey) {
|
|
9688
9798
|
this.selection.moveSelection(position);
|
|
9689
9799
|
}
|
|
@@ -9695,7 +9805,8 @@ class Editor {
|
|
|
9695
9805
|
const paragraph = this.session.displayData.paragraphs[position.row];
|
|
9696
9806
|
const error = this.grammarChecker.getError(this.session.sessionId, paragraph.id, position.column);
|
|
9697
9807
|
if (!this.editorService.isViewOnly && error) {
|
|
9698
|
-
const
|
|
9808
|
+
const paragraphPos = this.session.selection.cursor;
|
|
9809
|
+
const cursor = PositionHelper.paragraphToPixel(this.session, paragraphPos.row, paragraphPos.column);
|
|
9699
9810
|
const rect = this.renderer.container.getBoundingClientRect();
|
|
9700
9811
|
const hintLeft = rect.left + cursor.pageX;
|
|
9701
9812
|
const hintTop = rect.top + cursor.pageY - POPUP_HEIGHT;
|
|
@@ -9736,7 +9847,7 @@ class Editor {
|
|
|
9736
9847
|
return;
|
|
9737
9848
|
}
|
|
9738
9849
|
event.preventDefault();
|
|
9739
|
-
const position = this.renderer.
|
|
9850
|
+
const position = this.renderer.screenToParagraph(event.clientX, event.clientY, 2);
|
|
9740
9851
|
if (!isEdgeEdit && this.mainSession.customComponents.edges.isEdit) {
|
|
9741
9852
|
this.selection.placeCursor(position);
|
|
9742
9853
|
}
|
|
@@ -9754,7 +9865,7 @@ class Editor {
|
|
|
9754
9865
|
return;
|
|
9755
9866
|
}
|
|
9756
9867
|
event.preventDefault();
|
|
9757
|
-
const position = this.renderer.
|
|
9868
|
+
const position = this.renderer.screenToParagraph(event.clientX, event.clientY, 2);
|
|
9758
9869
|
const start = new CursorParagraph(position.row, 0);
|
|
9759
9870
|
const end = new CursorParagraph(position.row, this.session.displayData.getParagraphContent(position.row).length);
|
|
9760
9871
|
this.selection.placeSelection(start, end);
|
|
@@ -9813,7 +9924,7 @@ class Editor {
|
|
|
9813
9924
|
else {
|
|
9814
9925
|
this.regulatorService.setMainSessionAsCurrent();
|
|
9815
9926
|
}
|
|
9816
|
-
const cursorPosition = this.renderer.
|
|
9927
|
+
const cursorPosition = this.renderer.screenToParagraph(event.clientX, event.clientY, 2);
|
|
9817
9928
|
if (cursorPosition.row === this.selection.cursor.row && cursorPosition.column === this.selection.cursor.column) {
|
|
9818
9929
|
return;
|
|
9819
9930
|
}
|
|
@@ -9858,13 +9969,13 @@ class Editor {
|
|
|
9858
9969
|
const isInsideEdge = this.isInsideEdge(event.target);
|
|
9859
9970
|
const isEdgeEdit = this.mainSession.customComponents.edges.isEdit;
|
|
9860
9971
|
if (!isInsideEdge || isEdgeEdit) {
|
|
9861
|
-
const position = this.renderer.
|
|
9972
|
+
const position = this.renderer.screenToParagraph(event.clientX, event.clientY);
|
|
9862
9973
|
return this.session.getLinkModel(position);
|
|
9863
9974
|
}
|
|
9864
9975
|
const customElement = this.getCustomElement(event.target);
|
|
9865
9976
|
const sessionId = +customElement.attributes.getNamedItem('data-session-id').value;
|
|
9866
9977
|
const session = this.regulatorService.getSessionModel(sessionId);
|
|
9867
|
-
const position = session.renderer.
|
|
9978
|
+
const position = session.renderer.screenToParagraph(event.clientX, event.clientY, 1, customElement.getBoundingClientRect());
|
|
9868
9979
|
return session.session.getLinkModel(position);
|
|
9869
9980
|
}
|
|
9870
9981
|
setCurrentSession(element) {
|
|
@@ -9953,7 +10064,8 @@ class Editor {
|
|
|
9953
10064
|
this.rerenderMarker();
|
|
9954
10065
|
this.updateSelectedComment();
|
|
9955
10066
|
if (!this.selection.isEmpty && this.commentsVisible) {
|
|
9956
|
-
const
|
|
10067
|
+
const paragraphPos = this.session.selection.cursor;
|
|
10068
|
+
const cursor = PositionHelper.paragraphToPixel(this.session, paragraphPos.row, paragraphPos.column);
|
|
9957
10069
|
const mainRect = this.mainRenderer.container.getBoundingClientRect();
|
|
9958
10070
|
const rect = this.renderer.container.getBoundingClientRect();
|
|
9959
10071
|
const hintX = mainRect.right - 20;
|
|
@@ -10062,7 +10174,7 @@ class Editor {
|
|
|
10062
10174
|
this.onContentChange();
|
|
10063
10175
|
}
|
|
10064
10176
|
onMousePressedMove(event) {
|
|
10065
|
-
const position = this.renderer.
|
|
10177
|
+
const position = this.renderer.screenToParagraph(event.clientX, event.clientY, 2);
|
|
10066
10178
|
const cursor = this.selection.cursor;
|
|
10067
10179
|
this.selection.moveSelection(position);
|
|
10068
10180
|
if (cursor.column !== this.selection.cursor.column || cursor.row !== this.selection.cursor.row) {
|
|
@@ -10220,8 +10332,8 @@ class Editor {
|
|
|
10220
10332
|
});
|
|
10221
10333
|
}
|
|
10222
10334
|
setNumberingTemplateTypeSubscription() {
|
|
10223
|
-
return this.editorService.setNumberingTemplateType$.subscribe(
|
|
10224
|
-
this.setNumberingTemplate(
|
|
10335
|
+
return this.editorService.setNumberingTemplateType$.subscribe(numberingList => {
|
|
10336
|
+
this.setNumberingTemplate(numberingList.list, numberingList.updateOnlySelectedLevels);
|
|
10225
10337
|
this.focus();
|
|
10226
10338
|
});
|
|
10227
10339
|
}
|
|
@@ -10364,13 +10476,13 @@ class Editor {
|
|
|
10364
10476
|
return this.editorService.updateTableBorders$.subscribe(x => this.applyTableCellsStyles(x, (data, table, selection) => TableOperationsHelper.getApplyTableCellsBorders(data, table, selection)));
|
|
10365
10477
|
}
|
|
10366
10478
|
selectSpacingSubscription() {
|
|
10367
|
-
return this.editorService.selectSpacing$.subscribe(x => this.applyParagraphStyles(new
|
|
10479
|
+
return this.editorService.selectSpacing$.subscribe(x => this.applyParagraphStyles(new ParagraphStyleExtModel({ lineSpacing: x })));
|
|
10368
10480
|
}
|
|
10369
10481
|
selectBeforeSubscription() {
|
|
10370
|
-
return this.editorService.selectBefore$.subscribe(x => this.applyParagraphStyles(new
|
|
10482
|
+
return this.editorService.selectBefore$.subscribe(x => this.applyParagraphStyles(new ParagraphStyleExtModel({ spaceBefore: x })));
|
|
10371
10483
|
}
|
|
10372
10484
|
selectAfterSubscription() {
|
|
10373
|
-
return this.editorService.selectAfter$.subscribe(x => this.applyParagraphStyles(new
|
|
10485
|
+
return this.editorService.selectAfter$.subscribe(x => this.applyParagraphStyles(new ParagraphStyleExtModel({ spaceAfter: x })));
|
|
10374
10486
|
}
|
|
10375
10487
|
insertTextSubscription() {
|
|
10376
10488
|
return this.editorService.insertText$.subscribe(x => {
|
|
@@ -10498,10 +10610,11 @@ class Editor {
|
|
|
10498
10610
|
return this.editorService.setCommentSelected$.subscribe(x => {
|
|
10499
10611
|
for (const session of this.regulatorService.sessions) {
|
|
10500
10612
|
session.renderer.setSelectedComment(x);
|
|
10613
|
+
session.renderer.loop.schedule({ comments: true });
|
|
10501
10614
|
}
|
|
10502
10615
|
});
|
|
10503
10616
|
}
|
|
10504
|
-
|
|
10617
|
+
removeCommentSubscriptions() {
|
|
10505
10618
|
return this.editorService.removeComment$.subscribe(x => this.onCommentRemoved(x));
|
|
10506
10619
|
}
|
|
10507
10620
|
setComentsVisibilitySubscription() {
|
|
@@ -10562,7 +10675,8 @@ class Editor {
|
|
|
10562
10675
|
if (this.selection.range.isEmpty || !this.commentsVisible) {
|
|
10563
10676
|
return;
|
|
10564
10677
|
}
|
|
10565
|
-
const
|
|
10678
|
+
const paragraphPos = this.session.selection.cursor;
|
|
10679
|
+
const cursor = PositionHelper.paragraphToPixel(this.session, paragraphPos.row, paragraphPos.column);
|
|
10566
10680
|
const mainRect = this.mainRenderer.container.getBoundingClientRect();
|
|
10567
10681
|
const rect = this.renderer.container.getBoundingClientRect();
|
|
10568
10682
|
const hintX = mainRect.right - 20;
|
|
@@ -11328,7 +11442,7 @@ class TableSelection {
|
|
|
11328
11442
|
!this.canStartSelection(event.target)) {
|
|
11329
11443
|
return;
|
|
11330
11444
|
}
|
|
11331
|
-
const position = this.regulatorService.currentSession.renderer.
|
|
11445
|
+
const position = this.regulatorService.currentSession.renderer.screenToParagraph(event.clientX, event.clientY);
|
|
11332
11446
|
if (!this.session.selection.isEmpty && this.session.isPositionInRange(position, this.session.selection.selectedRange)) {
|
|
11333
11447
|
return;
|
|
11334
11448
|
}
|
|
@@ -12780,7 +12894,7 @@ class DisplayData extends EventEmitting {
|
|
|
12780
12894
|
const paragraphSettings = this.getParagraphSettings(i);
|
|
12781
12895
|
if (this.model.paragraphs[i].paragraphStyle.numberingId !== null) {
|
|
12782
12896
|
if (this.generalProperties.numberingInfo[paragraphStyle.numberingId][paragraphStyle.numberingLevel].needToRecalculate) {
|
|
12783
|
-
NumberingHelper.
|
|
12897
|
+
NumberingHelper.calculateMarkerIndexes(paragraphStyle.numberingId, paragraphStyle.numberingLevel, this.generalProperties.numberingInfo);
|
|
12784
12898
|
paragraphSettings.numberingData = NumberingHelper.createDataModel(this.generalProperties.numberings, this.model.paragraphs, i, this.generalProperties.numberingInfo);
|
|
12785
12899
|
const paragraphFormat = FormatStyleHelper.getFormatAtIndex(this.model.formats, this.model.paragraphs[i].insertIndex);
|
|
12786
12900
|
NumberingHelper.updateMarkerData(this.generalProperties.numberings, paragraphSettings, paragraphFormat.textStyle, paragraphStyle);
|
|
@@ -12842,20 +12956,20 @@ class DisplayData extends EventEmitting {
|
|
|
12842
12956
|
const { tokens, paragraphToken } = this.getTokens(paragraphInfo.startIndex, paragraphInfo.content, paragraphSymbolIndex);
|
|
12843
12957
|
return { paragraphTokens: tokens, paragraphToken };
|
|
12844
12958
|
}
|
|
12845
|
-
getParagraphLineTokens(paragraphIndex,
|
|
12959
|
+
getParagraphLineTokens(paragraphIndex, paragraphLine) {
|
|
12846
12960
|
const paragraph = this.paragraphs[paragraphIndex];
|
|
12847
|
-
const lineStart =
|
|
12848
|
-
const lineEnd = paragraph.nextLineIndexes[
|
|
12961
|
+
const lineStart = paragraphLine > 0 ? paragraph.nextLineIndexes[paragraphLine - 1] : 0;
|
|
12962
|
+
const lineEnd = paragraph.nextLineIndexes[paragraphLine] ? paragraph.nextLineIndexes[paragraphLine] : paragraph.content.length;
|
|
12849
12963
|
const lineContent = paragraph.content.substring(lineStart, lineEnd);
|
|
12850
12964
|
const paragraphSymbolIndex = paragraph.paragraphSettings.startInsertIndex + paragraph.content.length;
|
|
12851
12965
|
const { tokens } = this.getTokens(lineStart + paragraph.startIndex, lineContent, paragraphSymbolIndex);
|
|
12852
12966
|
const pageFormat = this.getPageFormatAtPosition(this.paragraphs[paragraphIndex].startIndex);
|
|
12853
12967
|
const paragraphStyle = this.model.paragraphs[paragraphIndex].paragraphStyle;
|
|
12854
|
-
const lineInfo = paragraph.paragraphSettings.textLinesInfo[
|
|
12968
|
+
const lineInfo = paragraph.paragraphSettings.textLinesInfo[paragraphLine];
|
|
12855
12969
|
const maxWidth = pageFormat.contentWidth - lineInfo.indent.right - lineInfo.indent.markerWidth;
|
|
12856
12970
|
const startWidth = lineInfo.indentLeft + lineInfo.indentFirstLine - lineInfo.indent.hanging || 0;
|
|
12857
12971
|
this.computeWrapIndex(tokens, startWidth, maxWidth, paragraphStyle.tabSettings ?? []); // needed to proceed a tab width correction according to the tabs complex positioning
|
|
12858
|
-
const isLast =
|
|
12972
|
+
const isLast = paragraphLine === paragraph.nextLineIndexes.length;
|
|
12859
12973
|
LineInfoHelper.get(tokens, false, isLast, paragraphStyle, lineInfo.indent, lineInfo.isNumbering, pageFormat.contentWidth, 0, 0); // needed to proceed a space width correction according to the wordSpacing in case of justify alignment
|
|
12860
12974
|
return tokens;
|
|
12861
12975
|
}
|
|
@@ -13860,12 +13974,6 @@ class EditSession {
|
|
|
13860
13974
|
destroy() {
|
|
13861
13975
|
this.displayData.destroy();
|
|
13862
13976
|
}
|
|
13863
|
-
getRowLength(row) {
|
|
13864
|
-
if (!this.displayData.paragraphs[row].nextLineIndexes) {
|
|
13865
|
-
return 1;
|
|
13866
|
-
}
|
|
13867
|
-
return this.displayData.paragraphs[row].nextLineIndexes.length + 1;
|
|
13868
|
-
}
|
|
13869
13977
|
getRowCacheIndex(cacheArray, value) {
|
|
13870
13978
|
let start = 0;
|
|
13871
13979
|
let end = cacheArray.length - 1;
|
|
@@ -14035,6 +14143,12 @@ class EditSession {
|
|
|
14035
14143
|
this.displayData.updateNextLineIndexes(startParagraph, endParagraph);
|
|
14036
14144
|
this.applyToolbarStyles();
|
|
14037
14145
|
}
|
|
14146
|
+
applyNumbering(levels, numberingId) {
|
|
14147
|
+
const paragraphIndex = this.displayData.paragraphs.findIndex(x => x.paragraphSettings.numberingData.numberingId === numberingId);
|
|
14148
|
+
OperationsHelper.applyNumbering(this.generalProperties.numberings, levels, numberingId);
|
|
14149
|
+
this.displayData.updateNextLineIndexes(paragraphIndex, paragraphIndex);
|
|
14150
|
+
this.applyToolbarStyles();
|
|
14151
|
+
}
|
|
14038
14152
|
removeNumberings(startIndex, endIndex) {
|
|
14039
14153
|
const startParagraph = ContentHelper.documentIndexToParagraphIndex(this.displayData.paragraphs, startIndex).row;
|
|
14040
14154
|
const endParagraph = ContentHelper.documentIndexToParagraphIndex(this.displayData.paragraphs, endIndex).row;
|
|
@@ -14644,12 +14758,16 @@ class HighlightLayer {
|
|
|
14644
14758
|
selectionElement.className = cssClass;
|
|
14645
14759
|
return selectionElement;
|
|
14646
14760
|
}
|
|
14647
|
-
|
|
14648
|
-
const
|
|
14649
|
-
const
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14761
|
+
getTopByDocumentLine(documentLine) {
|
|
14762
|
+
const { paragraph, paragraphLine } = PositionHelper.documentLineToParagraphLine(this.session.displayData.paragraphs, documentLine);
|
|
14763
|
+
const settings = this.session.displayData.paragraphs[paragraph].paragraphSettings;
|
|
14764
|
+
const lineTopOffset = PositionHelper.getLineTopOffset(settings.textLinesInfo, paragraphLine);
|
|
14765
|
+
return settings.distanceFromTop + lineTopOffset - this.session.scrollTop;
|
|
14766
|
+
}
|
|
14767
|
+
getTopByParagraphLine(paragraph, paragraphLine) {
|
|
14768
|
+
const settings = this.session.displayData.paragraphs[paragraph].paragraphSettings;
|
|
14769
|
+
const lineTopOffset = PositionHelper.getLineTopOffset(settings.textLinesInfo, paragraphLine);
|
|
14770
|
+
return settings.distanceFromTop + lineTopOffset - this.session.scrollTop;
|
|
14653
14771
|
}
|
|
14654
14772
|
// Draws a multi line marker, where lines span the full width
|
|
14655
14773
|
drawMultiLineMarker(range, cssClass) {
|
|
@@ -14660,13 +14778,10 @@ class HighlightLayer {
|
|
|
14660
14778
|
const visibleParagraphs = paragraphs.filter(x => x.paragraphSettings.lastScreenLine >= start && x.paragraphSettings.firstScreenLine <= end);
|
|
14661
14779
|
const textLinesInfo = visibleParagraphs
|
|
14662
14780
|
.map(x => x.paragraphSettings.textLinesInfo
|
|
14663
|
-
.filter(
|
|
14781
|
+
.filter(y => start <= y.screenLine && y.screenLine <= end)
|
|
14664
14782
|
.map(y => ({ textLinesInfo: y, paragraphSettings: x.paragraphSettings })))
|
|
14665
14783
|
.flat();
|
|
14666
|
-
|
|
14667
|
-
let top = paragraphs[paragraphInfo.paragraphIndex].paragraphSettings.distanceFromTop +
|
|
14668
|
-
paragraphInfo.lineTopOffset -
|
|
14669
|
-
this.session.scrollTop;
|
|
14784
|
+
let top = this.getTopByDocumentLine(start);
|
|
14670
14785
|
const padding = this.session.displayData.pagesFormat[this.session.displayData.pagesFormat.length - 1].pageFormatModel.marginLeft;
|
|
14671
14786
|
const results = [];
|
|
14672
14787
|
for (let i = 0; i < textLinesInfo.length; i++) {
|
|
@@ -14679,13 +14794,13 @@ class HighlightLayer {
|
|
|
14679
14794
|
const left = lineInfo.paddingLeft + padding + lineInfo.offsetMargin + markerOffset;
|
|
14680
14795
|
let style;
|
|
14681
14796
|
if (i === 0) {
|
|
14682
|
-
const rangeInfo = this.getRangeInfo(
|
|
14797
|
+
const rangeInfo = this.getRangeInfo(range);
|
|
14683
14798
|
const width = lineInfo.width - rangeInfo.leftPos + left;
|
|
14684
14799
|
style = this.getMarkerStyle(lineInfo.height, width, top, rangeInfo.leftPos);
|
|
14685
14800
|
}
|
|
14686
14801
|
else if (i === textLinesInfo.length - 1) {
|
|
14687
14802
|
const lastRowRange = new Range(new CursorParagraph(range.end.row, 0), range.end);
|
|
14688
|
-
const rangeInfo = this.getRangeInfo(
|
|
14803
|
+
const rangeInfo = this.getRangeInfo(lastRowRange);
|
|
14689
14804
|
style = this.getMarkerStyle(lineInfo.height, rangeInfo.screenWidth, top, left);
|
|
14690
14805
|
}
|
|
14691
14806
|
else {
|
|
@@ -14700,32 +14815,34 @@ class HighlightLayer {
|
|
|
14700
14815
|
}
|
|
14701
14816
|
// Draws a marker which covers part or whole width of a single screen line
|
|
14702
14817
|
drawSingleLineMarker(range, cssClass) {
|
|
14703
|
-
const rangeInfo = this.getRangeInfo(
|
|
14704
|
-
const
|
|
14705
|
-
const
|
|
14706
|
-
const
|
|
14707
|
-
const
|
|
14708
|
-
const
|
|
14709
|
-
|
|
14818
|
+
const rangeInfo = this.getRangeInfo(range);
|
|
14819
|
+
const paragraphs = this.session.displayData.paragraphs;
|
|
14820
|
+
const { paragraph, paragraphLine } = PositionHelper.documentLineToParagraphLine(paragraphs, range.start.row);
|
|
14821
|
+
const lineHeight = paragraphs[paragraph].paragraphSettings.textLinesInfo[paragraphLine].height;
|
|
14822
|
+
const height = rangeInfo.screenHeight || lineHeight;
|
|
14823
|
+
const top = this.getTopByParagraphLine(paragraph, paragraphLine);
|
|
14824
|
+
const markerStyle = this.getMarkerStyle(height, rangeInfo.screenWidth, top, rangeInfo.leftPos);
|
|
14825
|
+
return this.renderHighlight(markerStyle, cssClass);
|
|
14710
14826
|
}
|
|
14711
14827
|
drawCustomElementHighlight(elementInfo, cssClass, screenParentRange) {
|
|
14712
|
-
const
|
|
14713
|
-
const
|
|
14714
|
-
const
|
|
14715
|
-
const
|
|
14828
|
+
const paragraphPos = elementInfo.parentRange.start;
|
|
14829
|
+
const documentLine = PositionHelper.paragraphToDocumentLine(this.session, paragraphPos.row, paragraphPos.column);
|
|
14830
|
+
const paragraph = this.session.displayData.paragraphs[paragraphPos.row];
|
|
14831
|
+
const lineInfo = paragraph.paragraphSettings.textLinesInfo.find(x => x.screenLine === documentLine.column);
|
|
14832
|
+
const elementIndex = paragraph.startIndex + paragraphPos.column;
|
|
14716
14833
|
const element = this.session.customComponents.customElements.find(x => x.instance.content.insertIndex === elementIndex);
|
|
14717
14834
|
if (!element) {
|
|
14718
14835
|
return;
|
|
14719
14836
|
}
|
|
14720
|
-
const top = this.
|
|
14721
|
-
const
|
|
14722
|
-
this.renderHighlight(this.getMarkerStyle(elementInfo.location.height, elementInfo.location.width, top + lineInfo.ascent - elementInfo.location.height + elementInfo.location.top,
|
|
14837
|
+
const top = this.getTopByDocumentLine(screenParentRange.start.row);
|
|
14838
|
+
const startPos = PositionHelper.documentLineToPixel(this.session, screenParentRange.start.row, screenParentRange.start.column);
|
|
14839
|
+
this.renderHighlight(this.getMarkerStyle(elementInfo.location.height, elementInfo.location.width, top + lineInfo.ascent - elementInfo.location.height + elementInfo.location.top, startPos.pageX + elementInfo.location.left), cssClass);
|
|
14723
14840
|
}
|
|
14724
|
-
getRangeInfo(
|
|
14725
|
-
const
|
|
14726
|
-
const
|
|
14727
|
-
const startPos = PositionHelper.
|
|
14728
|
-
const endPos = PositionHelper.
|
|
14841
|
+
getRangeInfo(range) {
|
|
14842
|
+
const startLine = range.start;
|
|
14843
|
+
const endLine = range.end;
|
|
14844
|
+
const startPos = PositionHelper.documentLineToPixel(this.session, startLine.row, startLine.column);
|
|
14845
|
+
const endPos = PositionHelper.documentLineToPixel(this.session, endLine.row, endLine.column);
|
|
14729
14846
|
return {
|
|
14730
14847
|
screenWidth: Math.abs(endPos.pageX - startPos.pageX),
|
|
14731
14848
|
screenHeight: Math.abs(endPos.pageY - startPos.pageY),
|
|
@@ -14759,7 +14876,7 @@ class CommentHighlightLayer extends HighlightLayer {
|
|
|
14759
14876
|
const startPosition = ContentHelper.documentIndexToParagraphIndex(this.session.displayData.paragraphs, comment.startIndex);
|
|
14760
14877
|
const endPosition = ContentHelper.documentIndexToParagraphIndex(this.session.displayData.paragraphs, comment.endIndex + 1);
|
|
14761
14878
|
const range = new Range(startPosition, endPosition);
|
|
14762
|
-
const screenRange = range.
|
|
14879
|
+
const screenRange = range.paragraphToDocumentLine(this.session);
|
|
14763
14880
|
if (config.visibleRange &&
|
|
14764
14881
|
(screenRange.end.row < config.visibleRange.startScreenLine || screenRange.start.row > config.visibleRange.endScreenLine)) {
|
|
14765
14882
|
this.commentService.removeCommentFromRender(this.session.sessionId, comment.commentId);
|
|
@@ -14841,7 +14958,7 @@ class CursorLayer {
|
|
|
14841
14958
|
if (!position) {
|
|
14842
14959
|
position = this.session.selection.cursor;
|
|
14843
14960
|
}
|
|
14844
|
-
return PositionHelper.
|
|
14961
|
+
return PositionHelper.paragraphToPixel(this.session, position.row, position.column);
|
|
14845
14962
|
}
|
|
14846
14963
|
addTextStylesToCursor() {
|
|
14847
14964
|
const textStyle = this.session.editorService.styles;
|
|
@@ -14909,7 +15026,7 @@ class GrammarHighlightLayer extends HighlightLayer {
|
|
|
14909
15026
|
continue;
|
|
14910
15027
|
}
|
|
14911
15028
|
for (const error of grammarErrors) {
|
|
14912
|
-
const range = new Range(new CursorParagraph(index, error.offset), new CursorParagraph(index, error.offset + error.length)).
|
|
15029
|
+
const range = new Range(new CursorParagraph(index, error.offset), new CursorParagraph(index, error.offset + error.length)).paragraphToDocumentLine(this.session);
|
|
14913
15030
|
if (config.visibleRange &&
|
|
14914
15031
|
(range.end.row < config.visibleRange.startScreenLine || range.start.row > config.visibleRange.endScreenLine)) {
|
|
14915
15032
|
continue;
|
|
@@ -15039,7 +15156,7 @@ class SearchHighlightLayer extends HighlightLayer {
|
|
|
15039
15156
|
this.getVisibleCustomElementResults(config);
|
|
15040
15157
|
if (this.active) {
|
|
15041
15158
|
if (this.active instanceof Range) {
|
|
15042
|
-
const screenRange = this.active.
|
|
15159
|
+
const screenRange = this.active.paragraphToDocumentLine(this.session);
|
|
15043
15160
|
if (!screenRange.isEmpty &&
|
|
15044
15161
|
(!config.visibleRange ||
|
|
15045
15162
|
(screenRange.start.row >= config.visibleRange.startScreenLine &&
|
|
@@ -15054,13 +15171,13 @@ class SearchHighlightLayer extends HighlightLayer {
|
|
|
15054
15171
|
}
|
|
15055
15172
|
else {
|
|
15056
15173
|
this.updateActiveResult();
|
|
15057
|
-
const screenParentRange = this.active.parentRange.
|
|
15174
|
+
const screenParentRange = this.active.parentRange.paragraphToDocumentLine(this.session);
|
|
15058
15175
|
this.drawCustomElementHighlight(this.active, this.selectedClassName, screenParentRange);
|
|
15059
15176
|
}
|
|
15060
15177
|
}
|
|
15061
15178
|
if (this.markers?.length) {
|
|
15062
15179
|
const ranges = this.markers
|
|
15063
|
-
.map(x => x.
|
|
15180
|
+
.map(x => x.paragraphToDocumentLine(this.session))
|
|
15064
15181
|
.filter(x => !x.isEmpty &&
|
|
15065
15182
|
(!config.visibleRange ||
|
|
15066
15183
|
(x.start.row >= config.visibleRange.startScreenLine && x.end.row <= config.visibleRange.endScreenLine)) &&
|
|
@@ -15085,7 +15202,7 @@ class SearchHighlightLayer extends HighlightLayer {
|
|
|
15085
15202
|
this.active.location.isEqual(element.location))) {
|
|
15086
15203
|
continue;
|
|
15087
15204
|
}
|
|
15088
|
-
const screenParentRange = element.parentRange.
|
|
15205
|
+
const screenParentRange = element.parentRange.paragraphToDocumentLine(this.session);
|
|
15089
15206
|
if (!config.visibleRange ||
|
|
15090
15207
|
(screenParentRange.start.row >= config.visibleRange.startScreenLine &&
|
|
15091
15208
|
screenParentRange.end.row <= config.visibleRange.endScreenLine)) {
|
|
@@ -15123,7 +15240,7 @@ class SearchHighlightLayer extends HighlightLayer {
|
|
|
15123
15240
|
return;
|
|
15124
15241
|
}
|
|
15125
15242
|
for (const group of groupedByParentRange) {
|
|
15126
|
-
const screenParentRange = group.range.
|
|
15243
|
+
const screenParentRange = group.range.paragraphToDocumentLine(this.session);
|
|
15127
15244
|
if (config.visibleRange &&
|
|
15128
15245
|
(screenParentRange.start.row < config.visibleRange.startScreenLine ||
|
|
15129
15246
|
screenParentRange.end.row > config.visibleRange.endScreenLine)) {
|
|
@@ -15167,7 +15284,7 @@ class SelectionLayer extends HighlightLayer {
|
|
|
15167
15284
|
if (this.marker) {
|
|
15168
15285
|
let range = this.marker.clipRows(config.contentRange.start, config.contentRange.end);
|
|
15169
15286
|
if (!range.isEmpty) {
|
|
15170
|
-
range = range.
|
|
15287
|
+
range = range.paragraphToDocumentLine(this.session);
|
|
15171
15288
|
if (range.isSingleLine) {
|
|
15172
15289
|
this.drawSingleLineMarker(range, this.className);
|
|
15173
15290
|
}
|
|
@@ -15393,23 +15510,13 @@ class Renderer extends EventEmitting {
|
|
|
15393
15510
|
updateCursor() {
|
|
15394
15511
|
this.loop.schedule({ cursor: true });
|
|
15395
15512
|
}
|
|
15396
|
-
|
|
15397
|
-
|
|
15398
|
-
*/
|
|
15399
|
-
screenToTextCoordinatesUsingMidpoint(x, y, rect) {
|
|
15513
|
+
// tokenDivider - used to measure if token fits (1 - should be fully fit, 2 - half of token, 3 - third part, ...) to be included
|
|
15514
|
+
screenToParagraph(x, y, tokenDivider = 1, rect) {
|
|
15400
15515
|
const { left, top } = rect ?? this.container.getBoundingClientRect();
|
|
15401
|
-
const
|
|
15402
|
-
const
|
|
15403
|
-
|
|
15404
|
-
|
|
15405
|
-
/**
|
|
15406
|
-
* Converts screen coordinates to text coordinates by mapping to the next token boundary.
|
|
15407
|
-
*/
|
|
15408
|
-
screenToTextCoordinatesUsingBoundary(x, y, rect) {
|
|
15409
|
-
const { left, top } = rect ?? this.container.getBoundingClientRect();
|
|
15410
|
-
const { paragraphIndex, lineIndex } = PositionHelper.getParagraphAndLineIndexFromYPosition(this.session, y, top);
|
|
15411
|
-
const { line, indexInLine } = PositionHelper.mapPixelToNextTokenBoundary(this.session, x, paragraphIndex, lineIndex, left);
|
|
15412
|
-
return PositionHelper.screenToDocument(this.session, line, indexInLine);
|
|
15516
|
+
const pageX = x - left;
|
|
15517
|
+
const pageY = y + this.session.scrollTop - top;
|
|
15518
|
+
const { paragraph, indexInParagraph } = PositionHelper.pixelToParagraph(this.session, pageX, pageY, tokenDivider);
|
|
15519
|
+
return new CursorParagraph(paragraph, indexInParagraph);
|
|
15413
15520
|
}
|
|
15414
15521
|
showCursor() {
|
|
15415
15522
|
this.cursorLayer.showCursor();
|
|
@@ -15459,7 +15566,6 @@ class Renderer extends EventEmitting {
|
|
|
15459
15566
|
}
|
|
15460
15567
|
setSelectedComment(comment) {
|
|
15461
15568
|
this.commentsLayer.setSelectedComment(comment);
|
|
15462
|
-
this.commentsLayer.update(this.layerConfig);
|
|
15463
15569
|
}
|
|
15464
15570
|
setCommentsVisibility(value) {
|
|
15465
15571
|
this.commentsLayer.enabled = value;
|
|
@@ -15968,11 +16074,9 @@ class VirtualRenderer {
|
|
|
15968
16074
|
this.commentLayer.scrollComments(deltaY);
|
|
15969
16075
|
this.loop.schedule({ scroll: true });
|
|
15970
16076
|
}
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
screenToTextCoordinatesUsingBoundary(x, y, rect) {
|
|
15975
|
-
return this.renderer.screenToTextCoordinatesUsingBoundary(x, y, rect);
|
|
16077
|
+
// tokenDivider - used to measure if token fits (1 - should be fully fit, 2 - half of token, 3 - third part, ...) to be included
|
|
16078
|
+
screenToParagraph(x, y, tokenDivider = 1, rect) {
|
|
16079
|
+
return this.renderer.screenToParagraph(x, y, tokenDivider, rect);
|
|
15976
16080
|
}
|
|
15977
16081
|
showCursor() {
|
|
15978
16082
|
this.renderer.showCursor();
|
|
@@ -16428,10 +16532,10 @@ class RegulatorService {
|
|
|
16428
16532
|
}
|
|
16429
16533
|
return result;
|
|
16430
16534
|
}
|
|
16431
|
-
|
|
16535
|
+
getCommentSessionModel(commentId) {
|
|
16432
16536
|
for (const session of this.sessions) {
|
|
16433
16537
|
if (session.session.model.comments.some(x => x.commentId === commentId)) {
|
|
16434
|
-
return
|
|
16538
|
+
return session;
|
|
16435
16539
|
}
|
|
16436
16540
|
}
|
|
16437
16541
|
return null;
|
|
@@ -17791,7 +17895,7 @@ class MenuDropdownsComponent extends BaseToolbarComponent {
|
|
|
17791
17895
|
}
|
|
17792
17896
|
else {
|
|
17793
17897
|
const templateLevels = NumberingTemplates.find(x => x.templateType === numberingTemplateType).levels;
|
|
17794
|
-
this.setNumberingTemplateType.emit(templateLevels);
|
|
17898
|
+
this.setNumberingTemplateType.emit({ list: templateLevels, updateOnlySelectedLevels: false });
|
|
17795
17899
|
}
|
|
17796
17900
|
}
|
|
17797
17901
|
onTableInsertMenuClosed() {
|
|
@@ -18169,7 +18273,7 @@ class NumberingComponent {
|
|
|
18169
18273
|
this.removeNumberings.emit();
|
|
18170
18274
|
}
|
|
18171
18275
|
else {
|
|
18172
|
-
this.selectNumberingTemplate.emit(NumberingTemplateType.NumberList3);
|
|
18276
|
+
this.selectNumberingTemplate.emit({ type: NumberingTemplateType.NumberList3, updateOnlySelectedLevels: true });
|
|
18173
18277
|
}
|
|
18174
18278
|
}
|
|
18175
18279
|
onToggleBulletedNumbering() {
|
|
@@ -18177,18 +18281,18 @@ class NumberingComponent {
|
|
|
18177
18281
|
this.removeNumberings.emit();
|
|
18178
18282
|
}
|
|
18179
18283
|
else {
|
|
18180
|
-
this.selectNumberingTemplate.emit(NumberingTemplateType.BulletList1);
|
|
18284
|
+
this.selectNumberingTemplate.emit({ type: NumberingTemplateType.BulletList1, updateOnlySelectedLevels: true });
|
|
18181
18285
|
}
|
|
18182
18286
|
}
|
|
18183
18287
|
onSelectNumberingTemplate(numberingTemplateType) {
|
|
18184
|
-
this.selectNumberingTemplate.emit(numberingTemplateType);
|
|
18288
|
+
this.selectNumberingTemplate.emit({ type: numberingTemplateType, updateOnlySelectedLevels: false });
|
|
18185
18289
|
}
|
|
18186
18290
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: NumberingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
18187
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: NumberingComponent, isStandalone: false, selector: "app-nod-numbering", inputs: { isDisabled: "isDisabled", selectedNumberingType: "selectedNumberingType", selectedNumberingTemplate: "selectedNumberingTemplate" }, outputs: { selectNumberingTemplate: "selectNumberingTemplate", removeNumberings: "removeNumberings" }, ngImport: i0, template: "<mat-button-toggle-group\n name=\"format\"\n [hideMultipleSelectionIndicator]=\"true\"\n [hideSingleSelectionIndicator]=\"true\"\n [disabled]=\"isDisabled\">\n <mat-button-toggle\n (click)=\"onToggleBulletedNumbering()\"\n [value]=\"numberingType.Bullet\"\n [checked]=\"selectedNumberingType === numberingType.Bullet\"\n [matTooltip]=\"'NODER.TOOLTIP.BULLETED_LIST' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-format-bulleted\"></mat-icon>\n </mat-button-toggle>\n <button\n mat-button\n [matMenuTriggerFor]=\"listBulletedMenu\"\n [matMenuTriggerRestoreFocus]=\"false\"\n [disabled]=\"isDisabled\"\n [matTooltip]=\"'NODER.TOOLTIP.BULLETED_MENU' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-arrow-dropdown\"></mat-icon>\n </button>\n <mat-menu\n #listBulletedMenu=\"matMenu\"\n class=\"dropdown-numbering-overlay noder-modal\"\n yPosition=\"below\">\n <div class=\"list-icon list-marker\">\n <mat-icon\n svgIcon=\"marker-1\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList1)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList1\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-2\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList2)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList2\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-3\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList3)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList3\"></mat-icon>\n </div>\n <div class=\"list-icon list-marker\">\n <mat-icon\n svgIcon=\"marker-4\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList4)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList4\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-5\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList5)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList5\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-6\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList6)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList6\"></mat-icon>\n </div>\n </mat-menu>\n <mat-button-toggle\n (click)=\"onToggleNumberedNumbering()\"\n [value]=\"numberingType.Number\"\n [checked]=\"selectedNumberingType === numberingType.Number\"\n [matTooltip]=\"'NODER.TOOLTIP.NUMBERED_LIST' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-format-numbered\"></mat-icon>\n </mat-button-toggle>\n <button\n mat-button\n [matMenuTriggerFor]=\"listNumberedMenu\"\n [matMenuTriggerRestoreFocus]=\"false\"\n [disabled]=\"isDisabled\"
|
|
18291
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: NumberingComponent, isStandalone: false, selector: "app-nod-numbering", inputs: { isDisabled: "isDisabled", selectedNumberingType: "selectedNumberingType", selectedNumberingTemplate: "selectedNumberingTemplate" }, outputs: { selectNumberingTemplate: "selectNumberingTemplate", removeNumberings: "removeNumberings" }, ngImport: i0, template: "<mat-button-toggle-group\n name=\"format\"\n [hideMultipleSelectionIndicator]=\"true\"\n [hideSingleSelectionIndicator]=\"true\"\n [disabled]=\"isDisabled\">\n <mat-button-toggle\n (click)=\"onToggleBulletedNumbering()\"\n [value]=\"numberingType.Bullet\"\n [checked]=\"selectedNumberingType === numberingType.Bullet\"\n [matTooltip]=\"'NODER.TOOLTIP.BULLETED_LIST' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-format-bulleted\"></mat-icon>\n </mat-button-toggle>\n <button\n mat-button\n [matMenuTriggerFor]=\"listBulletedMenu\"\n [matMenuTriggerRestoreFocus]=\"false\"\n [disabled]=\"isDisabled\"\n [matTooltip]=\"'NODER.TOOLTIP.BULLETED_MENU' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-arrow-dropdown\"></mat-icon>\n </button>\n <mat-menu\n #listBulletedMenu=\"matMenu\"\n class=\"dropdown-numbering-overlay noder-modal\"\n yPosition=\"below\">\n <div class=\"list-icon list-marker\">\n <mat-icon\n svgIcon=\"marker-1\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList1)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList1\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-2\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList2)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList2\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-3\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList3)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList3\"></mat-icon>\n </div>\n <div class=\"list-icon list-marker\">\n <mat-icon\n svgIcon=\"marker-4\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList4)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList4\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-5\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList5)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList5\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-6\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList6)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList6\"></mat-icon>\n </div>\n </mat-menu>\n <mat-button-toggle\n (click)=\"onToggleNumberedNumbering()\"\n [value]=\"numberingType.Number\"\n [checked]=\"selectedNumberingType === numberingType.Number\"\n [matTooltip]=\"'NODER.TOOLTIP.NUMBERED_LIST' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-format-numbered\"></mat-icon>\n </mat-button-toggle>\n <button\n mat-button\n [matMenuTriggerFor]=\"listNumberedMenu\"\n [matMenuTriggerRestoreFocus]=\"false\"\n [disabled]=\"isDisabled\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-arrow-dropdown\"></mat-icon>\n </button>\n <mat-menu\n #listNumberedMenu=\"matMenu\"\n class=\"dropdown-numbering-overlay noder-modal\"\n yPosition=\"below\">\n <div class=\"list-icon list-number\">\n <mat-icon\n svgIcon=\"number-1\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.NumberList1)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.NumberList1\"></mat-icon>\n <mat-icon\n svgIcon=\"number-2\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.NumberList2)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.NumberList2\"></mat-icon>\n <mat-icon\n svgIcon=\"number-3\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.NumberList3)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.NumberList3\"></mat-icon>\n </div>\n <div class=\"list-icon list-number\">\n <mat-icon\n svgIcon=\"number-4\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.NumberList4)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.NumberList4\"></mat-icon>\n <mat-icon\n svgIcon=\"number-5\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.NumberList5)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.NumberList5\"></mat-icon>\n <mat-icon\n svgIcon=\"number-6\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.NumberList6)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.NumberList6\"></mat-icon>\n </div>\n </mat-menu>\n</mat-button-toggle-group>\n", styles: [":host{display:flex;align-items:center}mat-button-toggle-group,button{margin:0 3px}.mat-button-toggle-group-appearance-standard .mat-button-toggle+.mat-button-toggle{border-left:0}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{border:0}.mdc-button{min-width:32px;min-height:32px;padding:0}.mat-mdc-button>.mat-icon{margin-right:0}.mat-button-toggle-group{align-items:center}.mat-button-toggle-group .mdc-button{min-width:20px;height:32px;padding:0}.list-marker,.list-number{margin:0 5px}.list-marker mat-icon,.list-number mat-icon{width:70px;height:80px;margin:0 5px}.list-marker mat-icon:hover,.list-number mat-icon:hover{border:none!important}.list-icon .selected,.list-icon .selected:hover{border-width:2px;border-style:solid}\n"], dependencies: [{ kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: i3$2.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i3$2.MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4$1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "directive", type: i4$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: i5$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: i6.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
18188
18292
|
}
|
|
18189
18293
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: NumberingComponent, decorators: [{
|
|
18190
18294
|
type: Component,
|
|
18191
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'app-nod-numbering', standalone: false, template: "<mat-button-toggle-group\n name=\"format\"\n [hideMultipleSelectionIndicator]=\"true\"\n [hideSingleSelectionIndicator]=\"true\"\n [disabled]=\"isDisabled\">\n <mat-button-toggle\n (click)=\"onToggleBulletedNumbering()\"\n [value]=\"numberingType.Bullet\"\n [checked]=\"selectedNumberingType === numberingType.Bullet\"\n [matTooltip]=\"'NODER.TOOLTIP.BULLETED_LIST' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-format-bulleted\"></mat-icon>\n </mat-button-toggle>\n <button\n mat-button\n [matMenuTriggerFor]=\"listBulletedMenu\"\n [matMenuTriggerRestoreFocus]=\"false\"\n [disabled]=\"isDisabled\"\n [matTooltip]=\"'NODER.TOOLTIP.BULLETED_MENU' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-arrow-dropdown\"></mat-icon>\n </button>\n <mat-menu\n #listBulletedMenu=\"matMenu\"\n class=\"dropdown-numbering-overlay noder-modal\"\n yPosition=\"below\">\n <div class=\"list-icon list-marker\">\n <mat-icon\n svgIcon=\"marker-1\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList1)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList1\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-2\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList2)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList2\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-3\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList3)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList3\"></mat-icon>\n </div>\n <div class=\"list-icon list-marker\">\n <mat-icon\n svgIcon=\"marker-4\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList4)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList4\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-5\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList5)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList5\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-6\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList6)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList6\"></mat-icon>\n </div>\n </mat-menu>\n <mat-button-toggle\n (click)=\"onToggleNumberedNumbering()\"\n [value]=\"numberingType.Number\"\n [checked]=\"selectedNumberingType === numberingType.Number\"\n [matTooltip]=\"'NODER.TOOLTIP.NUMBERED_LIST' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-format-numbered\"></mat-icon>\n </mat-button-toggle>\n <button\n mat-button\n [matMenuTriggerFor]=\"listNumberedMenu\"\n [matMenuTriggerRestoreFocus]=\"false\"\n [disabled]=\"isDisabled\"
|
|
18295
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'app-nod-numbering', standalone: false, template: "<mat-button-toggle-group\n name=\"format\"\n [hideMultipleSelectionIndicator]=\"true\"\n [hideSingleSelectionIndicator]=\"true\"\n [disabled]=\"isDisabled\">\n <mat-button-toggle\n (click)=\"onToggleBulletedNumbering()\"\n [value]=\"numberingType.Bullet\"\n [checked]=\"selectedNumberingType === numberingType.Bullet\"\n [matTooltip]=\"'NODER.TOOLTIP.BULLETED_LIST' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-format-bulleted\"></mat-icon>\n </mat-button-toggle>\n <button\n mat-button\n [matMenuTriggerFor]=\"listBulletedMenu\"\n [matMenuTriggerRestoreFocus]=\"false\"\n [disabled]=\"isDisabled\"\n [matTooltip]=\"'NODER.TOOLTIP.BULLETED_MENU' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-arrow-dropdown\"></mat-icon>\n </button>\n <mat-menu\n #listBulletedMenu=\"matMenu\"\n class=\"dropdown-numbering-overlay noder-modal\"\n yPosition=\"below\">\n <div class=\"list-icon list-marker\">\n <mat-icon\n svgIcon=\"marker-1\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList1)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList1\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-2\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList2)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList2\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-3\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList3)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList3\"></mat-icon>\n </div>\n <div class=\"list-icon list-marker\">\n <mat-icon\n svgIcon=\"marker-4\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList4)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList4\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-5\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList5)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList5\"></mat-icon>\n <mat-icon\n svgIcon=\"marker-6\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.BulletList6)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.BulletList6\"></mat-icon>\n </div>\n </mat-menu>\n <mat-button-toggle\n (click)=\"onToggleNumberedNumbering()\"\n [value]=\"numberingType.Number\"\n [checked]=\"selectedNumberingType === numberingType.Number\"\n [matTooltip]=\"'NODER.TOOLTIP.NUMBERED_LIST' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-format-numbered\"></mat-icon>\n </mat-button-toggle>\n <button\n mat-button\n [matMenuTriggerFor]=\"listNumberedMenu\"\n [matMenuTriggerRestoreFocus]=\"false\"\n [disabled]=\"isDisabled\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-arrow-dropdown\"></mat-icon>\n </button>\n <mat-menu\n #listNumberedMenu=\"matMenu\"\n class=\"dropdown-numbering-overlay noder-modal\"\n yPosition=\"below\">\n <div class=\"list-icon list-number\">\n <mat-icon\n svgIcon=\"number-1\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.NumberList1)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.NumberList1\"></mat-icon>\n <mat-icon\n svgIcon=\"number-2\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.NumberList2)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.NumberList2\"></mat-icon>\n <mat-icon\n svgIcon=\"number-3\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.NumberList3)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.NumberList3\"></mat-icon>\n </div>\n <div class=\"list-icon list-number\">\n <mat-icon\n svgIcon=\"number-4\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.NumberList4)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.NumberList4\"></mat-icon>\n <mat-icon\n svgIcon=\"number-5\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.NumberList5)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.NumberList5\"></mat-icon>\n <mat-icon\n svgIcon=\"number-6\"\n (click)=\"onSelectNumberingTemplate(numberingTemplateType.NumberList6)\"\n [class.selected]=\"selectedNumberingTemplate === numberingTemplateType.NumberList6\"></mat-icon>\n </div>\n </mat-menu>\n</mat-button-toggle-group>\n", styles: [":host{display:flex;align-items:center}mat-button-toggle-group,button{margin:0 3px}.mat-button-toggle-group-appearance-standard .mat-button-toggle+.mat-button-toggle{border-left:0}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{border:0}.mdc-button{min-width:32px;min-height:32px;padding:0}.mat-mdc-button>.mat-icon{margin-right:0}.mat-button-toggle-group{align-items:center}.mat-button-toggle-group .mdc-button{min-width:20px;height:32px;padding:0}.list-marker,.list-number{margin:0 5px}.list-marker mat-icon,.list-number mat-icon{width:70px;height:80px;margin:0 5px}.list-marker mat-icon:hover,.list-number mat-icon:hover{border:none!important}.list-icon .selected,.list-icon .selected:hover{border-width:2px;border-style:solid}\n"] }]
|
|
18192
18296
|
}], propDecorators: { isDisabled: [{
|
|
18193
18297
|
type: Input
|
|
18194
18298
|
}], selectedNumberingType: [{
|
|
@@ -18296,9 +18400,9 @@ class ToolbarActionsComponent extends BaseToolbarComponent {
|
|
|
18296
18400
|
onApplyAfter(value) {
|
|
18297
18401
|
this.selectAfter.emit(value);
|
|
18298
18402
|
}
|
|
18299
|
-
onSetNumberingTemplateType(
|
|
18300
|
-
const templateLevels = NumberingTemplates.find(x => x.templateType ===
|
|
18301
|
-
this.setNumberingTemplateType.emit(templateLevels);
|
|
18403
|
+
onSetNumberingTemplateType(value) {
|
|
18404
|
+
const templateLevels = NumberingTemplates.find(x => x.templateType === value.type).levels;
|
|
18405
|
+
this.setNumberingTemplateType.emit({ list: templateLevels, updateOnlySelectedLevels: value.updateOnlySelectedLevels });
|
|
18302
18406
|
}
|
|
18303
18407
|
onTableInsertMenuClosed() {
|
|
18304
18408
|
this.tableInsertMenu._animationDone
|
|
@@ -18631,11 +18735,11 @@ class TextFormatMobileComponent {
|
|
|
18631
18735
|
onApply() {
|
|
18632
18736
|
const textStyles = new TextStyleModel(this.styles);
|
|
18633
18737
|
this.editorService.setTextStyles(textStyles);
|
|
18634
|
-
const paragraphStyles = new
|
|
18738
|
+
const paragraphStyles = new ParagraphStyleExtModel({ alignment: this.styles.alignment });
|
|
18635
18739
|
this.editorService.setParagraphStyles(paragraphStyles);
|
|
18636
18740
|
if (this.selectedNumberingTemplate !== null) {
|
|
18637
18741
|
const templateLevels = NumberingTemplates.find(x => x.templateType === this.selectedNumberingTemplate).levels;
|
|
18638
|
-
this.editorService.setNumberingTemplateType(templateLevels);
|
|
18742
|
+
this.editorService.setNumberingTemplateType({ list: templateLevels, updateOnlySelectedLevels: false });
|
|
18639
18743
|
}
|
|
18640
18744
|
else {
|
|
18641
18745
|
this.editorService.removeNumberings();
|
|
@@ -19542,5 +19646,5 @@ class OperationModel {
|
|
|
19542
19646
|
* Generated bundle index. Do not edit.
|
|
19543
19647
|
*/
|
|
19544
19648
|
|
|
19545
|
-
export { AddLinkDialogComponent, AddLinkMobileComponent, Alignment, BaseCommentComponent, BaseNoderComponent, Borders, BreakTypes, CommandModel, CommandType, CommandsService, CommentTypeModel, ConfirmDialogComponent, DEFAULT_BACKGROUND_COLOR, DEFAULT_EDGE_MAX_HEIGHT_MULTIPLIER, DEFAULT_FONT_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_HEADINGS, DEFAULT_HEADING_STYLE_ID, DEFAULT_OFFSET_AFTER_NUMBERING_MARKER, DEFAULT_PARAGRAPH_STYLE, DEFAULT_TABLE_MARGINS, DEFAULT_TAB_WIDTH, DEFAULT_TEXT_STYLE, DEFAULT_TOOLBAR_STYLES, DefaultImageApiService, DestroyComponent, DocumentInfo, DocumentModel, DocumentNameModel, DocxModel, DomHelper, EditorComponent, EditorMobileToolbarComponent, EditorModule, EditorService, EditorTitleComponent, EditorTitleMobileComponent, EditorToolbarComponent, EditorToolbarMode, EditorToolbarModule, EditorToolbarService, ElementDataModel, ElementModel, ExternalComponent, ExternalElementModel, ExternalElementService, FileSourceModel, FontMetrics, FormatStyleHelper, GrammarService, HYPERLINK_FONT_COLOR, HYPERLINK_HEADING_STYLE_ID, ImageApiService, ImageDataModel, LastDocumentRevisionModel, LineStyles, MenuDropdownsComponent, MenuDropdownsMobileComponent, Mode, NEW_LINE_MARKUP, NoderTranslateLoader, NumberingLevelModel, OperationModel, OperationsHistoryInfoModel, PageSetupComponent, PageType, ParagraphStyleModel, RevisionHelper, RevisionModel, SearchResultLocation, TextFormatMobileComponent, TextStyleModel, ToolbarActionsComponent };
|
|
19649
|
+
export { AddLinkDialogComponent, AddLinkMobileComponent, Alignment, BaseCommentComponent, BaseNoderComponent, Borders, BreakTypes, CommandModel, CommandType, CommandsService, CommentTypeModel, ConfirmDialogComponent, DEFAULT_BACKGROUND_COLOR, DEFAULT_EDGE_MAX_HEIGHT_MULTIPLIER, DEFAULT_FONT_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_HEADINGS, DEFAULT_HEADING_STYLE_ID, DEFAULT_OFFSET_AFTER_NUMBERING_MARKER, DEFAULT_PARAGRAPH_STYLE, DEFAULT_TABLE_MARGINS, DEFAULT_TAB_WIDTH, DEFAULT_TEXT_STYLE, DEFAULT_TOOLBAR_STYLES, DefaultImageApiService, DestroyComponent, DocumentInfo, DocumentModel, DocumentNameModel, DocxModel, DomHelper, EditorComponent, EditorMobileToolbarComponent, EditorModule, EditorService, EditorTitleComponent, EditorTitleMobileComponent, EditorToolbarComponent, EditorToolbarMode, EditorToolbarModule, EditorToolbarService, ElementDataModel, ElementModel, ExternalComponent, ExternalElementModel, ExternalElementService, FileSourceModel, FontMetrics, FormatStyleHelper, GrammarService, HYPERLINK_FONT_COLOR, HYPERLINK_HEADING_STYLE_ID, ImageApiService, ImageDataModel, LastDocumentRevisionModel, LineStyles, MenuDropdownsComponent, MenuDropdownsMobileComponent, Mode, NEW_LINE_MARKUP, NoderTranslateLoader, NumberingLevelModel, OperationModel, OperationsHistoryInfoModel, PageSetupComponent, PageType, ParagraphStyleExtModel, ParagraphStyleModel, RevisionHelper, RevisionModel, SearchResultLocation, TextFormatMobileComponent, TextStyleModel, ToolbarActionsComponent };
|
|
19546
19650
|
//# sourceMappingURL=talrace-ngx-noder.mjs.map
|