devexpress-richedit 24.2.1-alpha-24260-0102 → 24.2.3
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/bin/gulpfile.js +1 -1
- package/bin/index-custom.js +1 -1
- package/bin/localization-builder.js +1 -1
- package/bin/nspell-index.js +1 -1
- package/bin/nspell.webpack.config.js +1 -1
- package/bin/webpack-externals.js +1 -1
- package/bin/webpack.config.js +1 -1
- package/dist/dx.richedit.d.ts +12 -1
- package/dist/dx.richedit.js +5908 -406
- package/dist/dx.richedit.min.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/client/bars/rich-edit-ribbon/ribbon-items-data.js +2 -1
- package/lib/client/client-rich-edit.js +6 -6
- package/lib/client/commands/commands.js +3 -0
- package/lib/client/commands/mail-merge-command.d.ts +4 -1
- package/lib/client/commands/mail-merge-command.js +51 -18
- package/lib/client/commands/new-document-command.js +2 -1
- package/lib/client/default-localization.js +2 -0
- package/lib/client/dialogs/hyperlink-dialog.js +13 -6
- package/lib/client/formats/docx/export/exporters/styles.d.ts +5 -0
- package/lib/client/formats/docx/export/exporters/styles.js +30 -1
- package/lib/client/formats/docx/import/color/open-xml-color-import-helper.js +2 -2
- package/lib/client/formats/docx/import/importers/styles-importer.js +2 -1
- package/lib/client/formatters-options.js +2 -2
- package/lib/client/i-rich-constructor-settings.d.ts +1 -2
- package/lib/client/model-api/api-utils/range-permission-finder.js +3 -1
- package/lib/client/model-api/collections/drawing-object-collection.js +1 -1
- package/lib/client/model-api/collections/hyperlink-collection.js +1 -1
- package/lib/client/model-api/collections/range-permission-collection.js +3 -2
- package/lib/client/public/commands/enum.d.ts +1 -0
- package/lib/client/public/commands/enum.js +1 -0
- package/lib/client/public/options.d.ts +1 -2
- package/lib/client/public/ribbon/item-ids.d.ts +1 -0
- package/lib/client/public/ribbon/item-ids.js +1 -0
- package/lib/client/public/rich-edit.js +1 -1
- package/lib/client/settings.js +2 -4
- package/lib/common/commands/client-command.d.ts +2 -1
- package/lib/common/commands/client-command.js +1 -0
- package/lib/common/commands/command-manager.js +2 -1
- package/lib/common/commands/dialogs/dialog-hyperlink-command.js +10 -4
- package/lib/common/commands/fields/create-field-command.d.ts +4 -0
- package/lib/common/commands/fields/create-field-command.js +8 -0
- package/lib/common/commands/fields/open-hyperlink-command.js +9 -6
- package/lib/common/commands/floating-objects/floating-object-drag-drop-change-position-command.js +1 -1
- package/lib/common/commands/floating-objects/insert-anchored-text-box-command.js +1 -1
- package/lib/common/formats/html/export/html-export.d.ts +7 -1
- package/lib/common/formats/html/export/html-export.js +35 -35
- package/lib/common/formats/html/import/html-importer.js +1 -1
- package/lib/common/formats/html/import/importers/list-base.js +4 -4
- package/lib/common/formats/rtf/export/helpers/rtf-export-helper.js +3 -2
- package/lib/common/input-controller.d.ts +14 -1
- package/lib/common/input-controller.js +58 -20
- package/lib/common/layout/document-layout.js +1 -1
- package/lib/common/layout/main-structures/layout-boxes/layout-space-box.js +1 -1
- package/lib/common/model/color/color-model-info.d.ts +1 -1
- package/lib/common/model/color/color-model-info.js +2 -1
- package/lib/common/model/fields/field.d.ts +4 -1
- package/lib/common/model/fields/field.js +18 -2
- package/lib/common/model/fields/names.d.ts +2 -1
- package/lib/common/model/fields/names.js +1 -0
- package/lib/common/model/fields/parsers/field-code-parser-client-updating-base.js +1 -1
- package/lib/common/model/fields/parsers/field-code-parser-doc-variable.js +1 -1
- package/lib/common/model/fields/parsers/field-code-parser-hyperlink.js +32 -38
- package/lib/common/model/fields/parsers/field-code-parser-if.d.ts +40 -0
- package/lib/common/model/fields/parsers/field-code-parser-if.js +141 -0
- package/lib/common/model/fields/parsers/field-code-parser-merge-field.js +1 -1
- package/lib/common/model/fields/parsers/field-code-parser.d.ts +3 -2
- package/lib/common/model/fields/parsers/field-code-parser.js +6 -12
- package/lib/common/model/fields/tree-creator.js +2 -0
- package/lib/common/model/history/items/floating-objects/insert-anchored-picture-history-item.js +1 -0
- package/lib/common/model/history/items/switch-text-box-sub-documents-state-history-item.js +0 -1
- package/lib/common/model/manipulators/document/sub-document-inserter.d.ts +1 -0
- package/lib/common/model/manipulators/document/sub-document-inserter.js +4 -0
- package/lib/common/model/manipulators/range/remove-interval-operation.d.ts +2 -0
- package/lib/common/model/manipulators/range/remove-interval-operation.js +10 -2
- package/lib/common/model/manipulators/range-permission-manipulator.d.ts +4 -0
- package/lib/common/model/manipulators/range-permission-manipulator.js +35 -0
- package/lib/common/model/manipulators/text-box-manipulator.d.ts +1 -1
- package/lib/common/model/manipulators/text-box-manipulator.js +2 -1
- package/lib/common/model/manipulators/text-manipulator/text-manipulator.js +1 -1
- package/lib/common/model/options/fields.d.ts +1 -2
- package/lib/common/model/options/fields.js +2 -5
- package/lib/common/model/range-permissions.js +6 -4
- package/lib/common/model/styles-manager.js +1 -0
- package/lib/common/selection/selection.js +2 -1
- package/lib/common/ui/ruler/controls/indent/first-line.js +5 -5
- package/lib/common/ui/ruler/controls/indent/left.js +6 -6
- package/lib/common/ui/ruler/controls/indent/right.js +4 -4
- package/lib/common/ui/ruler/controls/margin/left.js +1 -1
- package/lib/common/ui/ruler/controls/margin/right.js +1 -1
- package/lib/common/ui/ruler/controls/ruler.js +2 -2
- package/lib/common/ui/ruler/controls/tab/tab-type.js +3 -3
- package/lib/common/ui/ruler/controls/tab/tab.js +7 -7
- package/lib/common/ui/ruler/controls/tab/utils.d.ts +2 -2
- package/lib/common/ui/ruler/controls/tab/utils.js +5 -5
- package/lib/common/ui/ruler/controls/table.js +1 -1
- package/lib/common/ui/ruler/controls/vertical-line.d.ts +1 -2
- package/lib/common/ui/ruler/controls/vertical-line.js +2 -2
- package/lib/common/ui/ruler/controls/wrapper.js +1 -1
- package/lib/common/ui/ruler/manager.js +1 -1
- package/lib/common/ui/ruler/model-data.d.ts +8 -2
- package/lib/common/ui/ruler/model-data.js +6 -0
- package/lib/common/ui/ruler/ruler.js +2 -1
- package/lib/common/utils/utils.d.ts +10 -5
- package/lib/common/utils/utils.js +46 -18
- package/package.json +3 -3
@@ -6,10 +6,11 @@ import { HyperlinkInfo } from '../field';
|
|
6
6
|
import { FieldName } from '../names';
|
7
7
|
import { FieldCodeParserState, FieldSwitchType } from './field-code-parser';
|
8
8
|
import { FieldCodeParserClientUpdatingBase } from './field-code-parser-client-updating-base';
|
9
|
+
import { UrlUtils } from '../../../utils/utils';
|
9
10
|
export class FieldCodeParserHyperlink extends FieldCodeParserClientUpdatingBase {
|
10
11
|
get name() { return FieldName.Hyperlink; }
|
11
12
|
parseCodeCurrentFieldInternal(_responce) {
|
12
|
-
if (this.parseSwitchesAndArgs(
|
13
|
+
if (this.parseSwitchesAndArgs())
|
13
14
|
this.fillResult();
|
14
15
|
else
|
15
16
|
this.removeInterval(this.getTopField().getResultInterval());
|
@@ -17,54 +18,47 @@ export class FieldCodeParserHyperlink extends FieldCodeParserClientUpdatingBase
|
|
17
18
|
return true;
|
18
19
|
}
|
19
20
|
fillResult() {
|
20
|
-
var
|
21
|
-
|
22
|
-
|
21
|
+
var _a, _b;
|
22
|
+
const field = this.getTopField();
|
23
|
+
const text = (_b = (_a = this.parameterInfoList[0]) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : "";
|
24
|
+
const newHyperlinkInfo = this.updateHyperlinkInfo(text);
|
23
25
|
if (!newHyperlinkInfo) {
|
24
|
-
if (!this.modelManager.richOptions.fields.keepHyperlinkResultForInvalidReference)
|
26
|
+
if (!this.modelManager.richOptions.fields.keepHyperlinkResultForInvalidReference) {
|
25
27
|
this.removeInterval(this.getTopField().getResultInterval());
|
28
|
+
}
|
26
29
|
return true;
|
27
30
|
}
|
28
|
-
|
29
|
-
|
30
|
-
if (resultInterval.length
|
31
|
-
|
32
|
-
|
31
|
+
const modelManipulator = this.modelManager.modelManipulator;
|
32
|
+
const resultInterval = field.getResultInterval();
|
33
|
+
if (resultInterval.length === 0) {
|
34
|
+
const resultText = text !== null && text !== void 0 ? text : "#" + newHyperlinkInfo.anchor;
|
35
|
+
const newResultInterval = new FixedInterval(resultInterval.start, resultText.length);
|
33
36
|
this.setInputPositionState();
|
34
37
|
this.replaceTextByInterval(resultInterval, resultText);
|
35
|
-
|
38
|
+
const subDocumentInterval = new SubDocumentInterval(this.subDocument, newResultInterval);
|
39
|
+
const historyItem = new ApplyFieldHyperlinkStyleHistoryItem(modelManipulator, subDocumentInterval);
|
40
|
+
this.modelManager.history.addAndRedo(historyItem);
|
36
41
|
}
|
37
|
-
|
42
|
+
const historyItem = new ChangeFieldHyperlinkInfoHistoryItem(modelManipulator, this.subDocument, field.index, newHyperlinkInfo);
|
43
|
+
this.modelManager.history.addAndRedo(historyItem);
|
38
44
|
return true;
|
39
45
|
}
|
40
|
-
updateHyperlinkInfo(
|
41
|
-
|
46
|
+
updateHyperlinkInfo(text) {
|
47
|
+
const newHyperlinkInfo = new HyperlinkInfo("", "", "", false);
|
48
|
+
[newHyperlinkInfo.uri, newHyperlinkInfo.anchor] = UrlUtils.splitUrlByAnchor(text);
|
42
49
|
newHyperlinkInfo.visited = false;
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
break;
|
54
|
-
}
|
50
|
+
for (const switchInfo of this.switchInfoList) {
|
51
|
+
if (switchInfo.type != FieldSwitchType.FieldSpecific)
|
52
|
+
continue;
|
53
|
+
switch (switchInfo.name.toLocaleUpperCase()) {
|
54
|
+
case "O":
|
55
|
+
newHyperlinkInfo.tip = switchInfo.arg;
|
56
|
+
break;
|
57
|
+
case "L":
|
58
|
+
newHyperlinkInfo.anchor = switchInfo.arg;
|
59
|
+
break;
|
55
60
|
}
|
56
|
-
newHyperlinkInfo.tip = tipSwitch ? tipSwitch.arg : "";
|
57
|
-
var splitted = text.split("#");
|
58
|
-
if (splitted.length == 1) {
|
59
|
-
newHyperlinkInfo.uri = splitted[0];
|
60
|
-
newHyperlinkInfo.anchor = bookmarkSwitch ? bookmarkSwitch.arg : "";
|
61
|
-
if (newHyperlinkInfo.uri == "" && newHyperlinkInfo.anchor == "")
|
62
|
-
return null;
|
63
|
-
}
|
64
|
-
else {
|
65
|
-
newHyperlinkInfo.uri = splitted[0];
|
66
|
-
newHyperlinkInfo.anchor = splitted[1];
|
67
61
|
}
|
68
|
-
return newHyperlinkInfo;
|
62
|
+
return newHyperlinkInfo.isValid() ? newHyperlinkInfo : null;
|
69
63
|
}
|
70
64
|
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { FieldName } from '../names';
|
2
|
+
import { FieldCodeParserClientUpdatingBase } from './field-code-parser-client-updating-base';
|
3
|
+
export declare class FieldCodeParserIf extends FieldCodeParserClientUpdatingBase {
|
4
|
+
get name(): FieldName;
|
5
|
+
protected fillResult(): boolean;
|
6
|
+
getResult(): string;
|
7
|
+
private parseParameters;
|
8
|
+
}
|
9
|
+
export declare class IfExpression {
|
10
|
+
operator: string;
|
11
|
+
leftExpression: IfExpressionParameter;
|
12
|
+
rightExpression: IfExpressionParameter;
|
13
|
+
trueText: string;
|
14
|
+
falseText: string;
|
15
|
+
static operators: string[];
|
16
|
+
constructor(operator: string, leftExpression: IfExpressionParameter, rightExpression: IfExpressionParameter, trueText?: string, falseText?: string);
|
17
|
+
static isOperator(operator: string): boolean;
|
18
|
+
evaluate(): string;
|
19
|
+
private evaluateComparison;
|
20
|
+
static compareStrings(leftValue: string, rightValue: string): number;
|
21
|
+
static compareStringsWithWildcards(leftValue: string, rightValue: string): 0 | 1;
|
22
|
+
}
|
23
|
+
export declare class IfExpressionParameter {
|
24
|
+
text: string;
|
25
|
+
number: number;
|
26
|
+
isNumber: boolean;
|
27
|
+
constructor(text: string, isQuoted?: boolean);
|
28
|
+
}
|
29
|
+
export declare class IfExpressionError extends Error {
|
30
|
+
constructor(message: string);
|
31
|
+
}
|
32
|
+
export declare class IfExpressionInvalidOperatorError extends IfExpressionError {
|
33
|
+
constructor(message?: string);
|
34
|
+
}
|
35
|
+
export declare class IfExpressionTooManyParametersError extends IfExpressionError {
|
36
|
+
constructor(message?: string);
|
37
|
+
}
|
38
|
+
export declare class IfExpressionMissingParametersError extends IfExpressionError {
|
39
|
+
constructor(message?: string);
|
40
|
+
}
|
@@ -0,0 +1,141 @@
|
|
1
|
+
import { FieldName } from '../names';
|
2
|
+
import { FieldCodeParserClientUpdatingBase } from './field-code-parser-client-updating-base';
|
3
|
+
export class FieldCodeParserIf extends FieldCodeParserClientUpdatingBase {
|
4
|
+
get name() { return FieldName.If; }
|
5
|
+
fillResult() {
|
6
|
+
this.setInputPositionState();
|
7
|
+
let result = null;
|
8
|
+
try {
|
9
|
+
result = this.getResult();
|
10
|
+
}
|
11
|
+
catch (err) {
|
12
|
+
if (err instanceof IfExpressionError) {
|
13
|
+
result = err.message;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
finally {
|
17
|
+
if (result) {
|
18
|
+
this.replaceTextByInterval(this.getTopField().getResultInterval(), result);
|
19
|
+
}
|
20
|
+
return true;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
getResult() {
|
24
|
+
const expression = this.parseParameters(this.parameterInfoList);
|
25
|
+
return expression.evaluate();
|
26
|
+
}
|
27
|
+
parseParameters(parameters) {
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
29
|
+
if (parameters.length > 5)
|
30
|
+
throw new IfExpressionTooManyParametersError();
|
31
|
+
if (parameters.length === 0)
|
32
|
+
throw new IfExpressionMissingParametersError();
|
33
|
+
let leftExpression;
|
34
|
+
let operator;
|
35
|
+
let rightExpression;
|
36
|
+
let trueText;
|
37
|
+
let falseText;
|
38
|
+
if (parameters.length <= 3 && !IfExpression.isOperator((_a = parameters[1]) === null || _a === void 0 ? void 0 : _a.text)) {
|
39
|
+
leftExpression = new IfExpressionParameter((_b = parameters[0]) === null || _b === void 0 ? void 0 : _b.text, (_c = parameters[0]) === null || _c === void 0 ? void 0 : _c.quoted);
|
40
|
+
trueText = (_d = parameters[1]) === null || _d === void 0 ? void 0 : _d.text;
|
41
|
+
falseText = (_e = parameters[2]) === null || _e === void 0 ? void 0 : _e.text;
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
leftExpression = new IfExpressionParameter((_f = parameters[0]) === null || _f === void 0 ? void 0 : _f.text, (_g = parameters[0]) === null || _g === void 0 ? void 0 : _g.quoted);
|
45
|
+
operator = (_h = parameters[1]) === null || _h === void 0 ? void 0 : _h.text;
|
46
|
+
rightExpression = new IfExpressionParameter((_j = parameters[2]) === null || _j === void 0 ? void 0 : _j.text, (_k = parameters[2]) === null || _k === void 0 ? void 0 : _k.quoted);
|
47
|
+
trueText = (_l = parameters[3]) === null || _l === void 0 ? void 0 : _l.text;
|
48
|
+
falseText = (_m = parameters[4]) === null || _m === void 0 ? void 0 : _m.text;
|
49
|
+
}
|
50
|
+
return new IfExpression(operator, leftExpression, rightExpression, trueText, falseText);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
export class IfExpression {
|
54
|
+
constructor(operator, leftExpression, rightExpression, trueText = undefined, falseText = undefined) {
|
55
|
+
this.operator = operator;
|
56
|
+
this.leftExpression = leftExpression;
|
57
|
+
this.rightExpression = rightExpression;
|
58
|
+
this.trueText = trueText;
|
59
|
+
this.falseText = falseText;
|
60
|
+
}
|
61
|
+
static isOperator(operator) {
|
62
|
+
return IfExpression.operators.includes(operator);
|
63
|
+
}
|
64
|
+
evaluate() {
|
65
|
+
if (!this.operator && !this.leftExpression.isNumber) {
|
66
|
+
return this.leftExpression.text ? this.trueText : this.falseText;
|
67
|
+
}
|
68
|
+
if (!IfExpression.isOperator(this.operator)) {
|
69
|
+
throw new IfExpressionInvalidOperatorError();
|
70
|
+
}
|
71
|
+
let difference;
|
72
|
+
if (this.leftExpression.isNumber && this.rightExpression.isNumber) {
|
73
|
+
difference = this.leftExpression.number - this.rightExpression.number;
|
74
|
+
}
|
75
|
+
else {
|
76
|
+
const isEqualityOperator = this.operator === "=" || this.operator === "<>";
|
77
|
+
const compareFunction = isEqualityOperator ? IfExpression.compareStringsWithWildcards : IfExpression.compareStrings;
|
78
|
+
difference = compareFunction(this.leftExpression.text, this.rightExpression.text);
|
79
|
+
}
|
80
|
+
return this.evaluateComparison(difference) ? this.trueText : this.falseText;
|
81
|
+
}
|
82
|
+
evaluateComparison(comparisonResult) {
|
83
|
+
switch (this.operator) {
|
84
|
+
case "<":
|
85
|
+
return comparisonResult < 0;
|
86
|
+
case ">":
|
87
|
+
return comparisonResult > 0;
|
88
|
+
case "=":
|
89
|
+
return comparisonResult === 0;
|
90
|
+
case "<=":
|
91
|
+
return comparisonResult <= 0;
|
92
|
+
case ">=":
|
93
|
+
return comparisonResult >= 0;
|
94
|
+
case "<>":
|
95
|
+
return comparisonResult != 0;
|
96
|
+
default:
|
97
|
+
return false;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
static compareStrings(leftValue, rightValue) {
|
101
|
+
return leftValue.localeCompare(rightValue);
|
102
|
+
}
|
103
|
+
static compareStringsWithWildcards(leftValue, rightValue) {
|
104
|
+
const escapedPattern = rightValue.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
105
|
+
const regexPattern = escapedPattern.replace(/\*/g, '.*').replace(/\?/g, '.');
|
106
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
107
|
+
return regex.test(leftValue) ? 0 : 1;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
IfExpression.operators = ["<", ">", "=", "<=", ">=", "<>"];
|
111
|
+
export class IfExpressionParameter {
|
112
|
+
constructor(text, isQuoted = false) {
|
113
|
+
this.text = text;
|
114
|
+
this.number = parseFloat(text);
|
115
|
+
this.isNumber = !isQuoted && !Number.isNaN(this.number);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
export class IfExpressionError extends Error {
|
119
|
+
constructor(message) {
|
120
|
+
super(message);
|
121
|
+
Object.setPrototypeOf(this, IfExpressionError.prototype);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
export class IfExpressionInvalidOperatorError extends IfExpressionError {
|
125
|
+
constructor(message) {
|
126
|
+
super(message !== null && message !== void 0 ? message : "IF field error: Invalid comparison operator");
|
127
|
+
Object.setPrototypeOf(this, IfExpressionInvalidOperatorError.prototype);
|
128
|
+
}
|
129
|
+
}
|
130
|
+
export class IfExpressionTooManyParametersError extends IfExpressionError {
|
131
|
+
constructor(message) {
|
132
|
+
super(message !== null && message !== void 0 ? message : "IF field error: Too many parameters");
|
133
|
+
Object.setPrototypeOf(this, IfExpressionTooManyParametersError.prototype);
|
134
|
+
}
|
135
|
+
}
|
136
|
+
export class IfExpressionMissingParametersError extends IfExpressionError {
|
137
|
+
constructor(message) {
|
138
|
+
super(message !== null && message !== void 0 ? message : "IF field error: Missing parameter(s)");
|
139
|
+
Object.setPrototypeOf(this, IfExpressionMissingParametersError.prototype);
|
140
|
+
}
|
141
|
+
}
|
@@ -25,7 +25,7 @@ export class FieldCodeParserMailMerge extends FieldCodeParserDocVariable {
|
|
25
25
|
}
|
26
26
|
getMergeFieldName() {
|
27
27
|
if (this.parameterInfoList.length == 0)
|
28
|
-
this.parseSwitchesAndArgs(
|
28
|
+
this.parseSwitchesAndArgs();
|
29
29
|
return this.parameterInfoList[0] ? this.parameterInfoList[0].text : '';
|
30
30
|
}
|
31
31
|
applyResponse(response) {
|
@@ -38,7 +38,8 @@ export declare class FieldSwitch {
|
|
38
38
|
export declare class FieldParameter {
|
39
39
|
interval: FixedInterval;
|
40
40
|
text: string;
|
41
|
-
|
41
|
+
quoted: boolean;
|
42
|
+
constructor(interval: FixedInterval, textRepresentation: string, quoted?: boolean);
|
42
43
|
clone(): FieldParameter;
|
43
44
|
}
|
44
45
|
export declare class FieldCodeParserHelper {
|
@@ -97,7 +98,7 @@ export declare abstract class FieldCodeParser {
|
|
97
98
|
updateInfo(): boolean;
|
98
99
|
protected needUpdateInfo(): boolean;
|
99
100
|
protected updateInfoCore(): void;
|
100
|
-
parseSwitchesAndArgs(
|
101
|
+
parseSwitchesAndArgs(): boolean;
|
101
102
|
private skipWhitespaces;
|
102
103
|
private getFieldParameterInfo;
|
103
104
|
private getSwitchInfo;
|
@@ -43,12 +43,13 @@ export class FieldSwitch {
|
|
43
43
|
}
|
44
44
|
}
|
45
45
|
export class FieldParameter {
|
46
|
-
constructor(interval, textRepresentation) {
|
46
|
+
constructor(interval, textRepresentation, quoted = false) {
|
47
47
|
this.text = textRepresentation;
|
48
48
|
this.interval = interval;
|
49
|
+
this.quoted = quoted;
|
49
50
|
}
|
50
51
|
clone() {
|
51
|
-
return new FieldParameter(this.interval.clone(), this.text);
|
52
|
+
return new FieldParameter(this.interval.clone(), this.text, this.quoted);
|
52
53
|
}
|
53
54
|
}
|
54
55
|
export class FieldCodeParserHelper {
|
@@ -313,7 +314,7 @@ export class FieldCodeParser {
|
|
313
314
|
updateInfo() {
|
314
315
|
if (!this.needUpdateInfo())
|
315
316
|
return false;
|
316
|
-
this.parseSwitchesAndArgs(
|
317
|
+
this.parseSwitchesAndArgs();
|
317
318
|
this.updateInfoCore();
|
318
319
|
return true;
|
319
320
|
}
|
@@ -321,14 +322,7 @@ export class FieldCodeParser {
|
|
321
322
|
return false;
|
322
323
|
}
|
323
324
|
updateInfoCore() { }
|
324
|
-
parseSwitchesAndArgs(
|
325
|
-
if (needAtLestOneSpaceAfterFieldName) {
|
326
|
-
var prevPos = this.modelIterator.getAbsolutePosition();
|
327
|
-
if (this.skipWhitespaces())
|
328
|
-
this.modelIterator.setPosition(prevPos);
|
329
|
-
else
|
330
|
-
return this.modelIterator.run.getType() == RunType.FieldCodeEndRun;
|
331
|
-
}
|
325
|
+
parseSwitchesAndArgs() {
|
332
326
|
while (this.skipWhitespaces() && this.modelIterator.run.getType() != RunType.FieldCodeEndRun) {
|
333
327
|
var currChar = this.modelIterator.getCurrentChar();
|
334
328
|
if (FieldCodeParserHelper.isBackslesh(currChar)) {
|
@@ -364,7 +358,7 @@ export class FieldCodeParser {
|
|
364
358
|
var argInterval = parseResult.quoted ?
|
365
359
|
FixedInterval.fromPositions(startPosition + 1, this.modelIterator.getAbsolutePosition() - 1) :
|
366
360
|
FixedInterval.fromPositions(startPosition, this.modelIterator.getAbsolutePosition());
|
367
|
-
return new FieldParameter(argInterval, parseResult.argListChars.join(""));
|
361
|
+
return new FieldParameter(argInterval, parseResult.argListChars.join(""), parseResult.quoted);
|
368
362
|
}
|
369
363
|
getSwitchInfo() {
|
370
364
|
if (!this.moveIteratorToNextChar() || this.modelIterator.run.getType() != RunType.TextRun)
|
@@ -18,6 +18,7 @@ import { FieldCodeParserTc } from './parsers/field-code-parser-tc';
|
|
18
18
|
import { FieldCodeParserTime } from './parsers/field-code-parser-time';
|
19
19
|
import { FieldCodeParserToc } from './parsers/field-code-parser-toc';
|
20
20
|
import { FieldCodeParserFillIn } from './parsers/fill-in';
|
21
|
+
import { FieldCodeParserIf } from './parsers/field-code-parser-if';
|
21
22
|
class FieldParsersAndIntervals {
|
22
23
|
constructor(interval) {
|
23
24
|
this.interval = interval;
|
@@ -182,6 +183,7 @@ export class FieldsWaitingForUpdate {
|
|
182
183
|
}
|
183
184
|
FieldsWaitingForUpdate.TOC_NAME = "TOC";
|
184
185
|
FieldsWaitingForUpdate.parsersMap = {
|
186
|
+
["IF"]: (args) => new FieldCodeParserIf(args),
|
185
187
|
["DATE"]: (args) => new FieldCodeParserDate(args),
|
186
188
|
["TIME"]: (args) => new FieldCodeParserTime(args),
|
187
189
|
["DOCVARIABLE"]: (args) => new FieldCodeParserDocVariable(args),
|
package/lib/common/model/history/items/floating-objects/insert-anchored-picture-history-item.js
CHANGED
@@ -23,6 +23,7 @@ export class InsertAnchoredTextBoxHistoryItem extends PositionBasedHistoryItem {
|
|
23
23
|
}
|
24
24
|
redo() {
|
25
25
|
this.modelManipulator.textBox.insertAnchoredTextBox(this.subDocPos, this.charPropsBundle, this.textBoxInfo);
|
26
|
+
this.modelManipulator.model.subDocumentsCollection.restore(this.textBoxInfo.innerSubDocument.id);
|
26
27
|
}
|
27
28
|
undo() {
|
28
29
|
this.modelManipulator.range.removeIntervalWithoutHistory(this.boundSubDocument, new FixedInterval(this.position, 1), false);
|
@@ -7,7 +7,6 @@ export class SwitchTextBoxSubDocumentsStateHistoryItem extends HistoryItem {
|
|
7
7
|
this.position = position;
|
8
8
|
}
|
9
9
|
redo() {
|
10
|
-
this.oldSubDocument = this.oldSubDocument.getActualSubDocument();
|
11
10
|
const newRun = this.textBoxParentSubDocument.getRunAndIndexesByPosition(this.position).run;
|
12
11
|
this.newSubDocument = this.modelManipulator.model.subDocuments[newRun.subDocId];
|
13
12
|
this.modelManipulator.model.subDocumentsCollection.replace(this.oldSubDocument.id, this.newSubDocument.id);
|
@@ -96,6 +96,7 @@ export class SubDocumentInserter {
|
|
96
96
|
this.collectTables();
|
97
97
|
this.collectFields();
|
98
98
|
this.collectBookmarks();
|
99
|
+
this.collectRangePermission();
|
99
100
|
if (this.options.overlapTableCellContent) {
|
100
101
|
const lastInsertedParagraph = this.targetSubDocument.getParagraphByPosition(this.currInsertSubDocumentPosition.position - 1);
|
101
102
|
const nextParagraph = this.targetSubDocument.getParagraphByPosition(this.currInsertSubDocumentPosition.position);
|
@@ -204,6 +205,9 @@ export class SubDocumentInserter {
|
|
204
205
|
collectBookmarks() {
|
205
206
|
this.targetModelManipulator.bookmark.insertBookmarksFromSubDocument(this.sourceSubDocument, this.targetSubDocument, this.sourceInterval, this.modelsConstOffset);
|
206
207
|
}
|
208
|
+
collectRangePermission() {
|
209
|
+
this.targetModelManipulator.rangePermission.insertRangePermissionsFromSubDocument(this.sourceSubDocument, this.targetSubDocument, this.sourceInterval, this.modelsConstOffset);
|
210
|
+
}
|
207
211
|
prependTableByParagraph() {
|
208
212
|
if (this.options.insertParagraphMarkBeforeIfStartsWithTable) {
|
209
213
|
const tbl = Table.getTableByPosition(this.sourceSubDocument.tables, this.sourceInterval.start, false);
|
@@ -4,6 +4,7 @@ import { HistoryRun } from '../../character/history-runs';
|
|
4
4
|
import { SubDocument } from '../../sub-document';
|
5
5
|
import { TableCell } from '../../tables/main-structures/table-cell';
|
6
6
|
import { ModelManipulator } from '../model-manipulator';
|
7
|
+
import { ConstRangePermission } from '../../range-permissions';
|
7
8
|
export declare class RemoveIntervalOperation {
|
8
9
|
modelManipulator: ModelManipulator;
|
9
10
|
currentSectionIndex: number;
|
@@ -42,6 +43,7 @@ export declare class RemoveIntervalOperationResult {
|
|
42
43
|
private nestingLevels;
|
43
44
|
private cellsIterator;
|
44
45
|
bookmarkItems: ConstBookmark[];
|
46
|
+
rangePermssionsItems: ConstRangePermission[];
|
45
47
|
constructor(cellsIterator: SelectedCellsIterator);
|
46
48
|
registerItem(historyRun: HistoryRun): void;
|
47
49
|
private registerItemCore;
|
@@ -23,6 +23,7 @@ export class RemoveIntervalOperation {
|
|
23
23
|
this.cellsIterator = new SelectedCellsIterator(this.subDocument, interval);
|
24
24
|
const result = new RemoveIntervalOperationResult(this.cellsIterator);
|
25
25
|
result.bookmarkItems = this.modelManipulator.bookmark.deleteBookmarks(this.subDocument, interval);
|
26
|
+
result.rangePermssionsItems = this.modelManipulator.rangePermission.deleteRangePermissions(this.subDocument, interval);
|
26
27
|
if (this.tryPackSelectionInOneRun(interval, result))
|
27
28
|
return result;
|
28
29
|
var iterator = this.subDocument.getRunIterator(interval);
|
@@ -53,8 +54,14 @@ export class RemoveIntervalOperation {
|
|
53
54
|
var accumulatedInterval = new FixedInterval(this.position, 0);
|
54
55
|
let removedTextList = [];
|
55
56
|
while (iterator.moveNext()) {
|
56
|
-
if (EnumUtils.isAnyOf(iterator.currentRun.getType(), RunType.AnchoredPictureRun, RunType.AnchoredTextBoxRun))
|
57
|
-
|
57
|
+
if (EnumUtils.isAnyOf(iterator.currentRun.getType(), RunType.AnchoredPictureRun, RunType.AnchoredTextBoxRun)) {
|
58
|
+
const currentRun = iterator.currentRun;
|
59
|
+
const position = iterator.currentInterval().start;
|
60
|
+
const change = new AnchorObjectRemovedSubDocumentChange(this.subDocument.id, currentRun.anchoredObjectID, position);
|
61
|
+
if (currentRun instanceof AnchoredTextBoxRun)
|
62
|
+
this.modelManipulator.model.subDocumentsCollection.replace(currentRun.subDocId, subDocument.id);
|
63
|
+
this.modelManipulator.notifyModelChanged(change);
|
64
|
+
}
|
58
65
|
if (iterator.currentChunk !== subDocument.chunks[this.currentChunkIndex]) {
|
59
66
|
this.removeAccumulatedInterval(accumulatedInterval, this.position, 0, removedTextList);
|
60
67
|
this.currentChunkIndex++;
|
@@ -348,6 +355,7 @@ export class RemoveIntervalOperationResult {
|
|
348
355
|
this.historyRuns = [];
|
349
356
|
this.nestingLevels = [];
|
350
357
|
this.bookmarkItems = [];
|
358
|
+
this.rangePermssionsItems = [];
|
351
359
|
this.cellsIterator = cellsIterator;
|
352
360
|
}
|
353
361
|
registerItem(historyRun) {
|
@@ -1,7 +1,11 @@
|
|
1
1
|
import { ConstRangePermission } from '../range-permissions';
|
2
2
|
import { SubDocument } from '../sub-document';
|
3
3
|
import { BaseManipulator } from './base-manipulator';
|
4
|
+
import { ConstInterval } from '@devexpress/utils/lib/intervals/const';
|
5
|
+
import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
|
4
6
|
export declare class RangePermissionManipulator extends BaseManipulator {
|
5
7
|
createRangePermission(subDocument: SubDocument, permissionTemplate: ConstRangePermission): void;
|
6
8
|
deleteRangePermission(subDocument: SubDocument, permissionTemplate: ConstRangePermission, permissionIndex?: number): void;
|
9
|
+
insertRangePermissionsFromSubDocument(fromSubDocument: SubDocument, toSubDocument: SubDocument, fromInterval: ConstInterval, modelsConstOffset: number): void;
|
10
|
+
deleteRangePermissions(subDocument: SubDocument, interval: FixedInterval): ConstRangePermission[];
|
7
11
|
}
|
@@ -2,6 +2,7 @@ import { ListUtils } from '@devexpress/utils/lib/utils/list';
|
|
2
2
|
import { RangePermissionsChangedSubDocumentChange } from '../changes/sub-document/range-permissions-changed';
|
3
3
|
import { ConstRangePermission, RangePermission } from '../range-permissions';
|
4
4
|
import { BaseManipulator } from './base-manipulator';
|
5
|
+
import { SearchUtils } from '@devexpress/utils/lib/utils/search';
|
5
6
|
export class RangePermissionManipulator extends BaseManipulator {
|
6
7
|
createRangePermission(subDocument, permissionTemplate) {
|
7
8
|
subDocument.rangePermissions.push(new RangePermission(subDocument.positionManager, permissionTemplate.interval, permissionTemplate.userName, permissionTemplate.group));
|
@@ -14,4 +15,38 @@ export class RangePermissionManipulator extends BaseManipulator {
|
|
14
15
|
subDocument.filterRangePermissions(this.modelManipulator.modelManager.richOptions.documentProtection);
|
15
16
|
this.modelManipulator.notifyModelChanged(new RangePermissionsChangedSubDocumentChange(subDocument.id, permissionTemplate));
|
16
17
|
}
|
18
|
+
insertRangePermissionsFromSubDocument(fromSubDocument, toSubDocument, fromInterval, modelsConstOffset) {
|
19
|
+
const rangePermissions = fromSubDocument.rangePermissions;
|
20
|
+
let ind = SearchUtils.normedInterpolationIndexOf(rangePermissions, (b) => b.start, fromInterval.start);
|
21
|
+
while (rangePermissions[ind] && rangePermissions[ind].start >= fromInterval.start)
|
22
|
+
ind--;
|
23
|
+
ind = Math.max(0, ind);
|
24
|
+
for (let rpm; (rpm = rangePermissions[ind]) && rpm.start <= fromInterval.end; ind++) {
|
25
|
+
if (fromInterval.containsInterval(rpm.interval)) {
|
26
|
+
const template = rpm.constRangePermission;
|
27
|
+
template.interval.start += modelsConstOffset;
|
28
|
+
template.interval.end += modelsConstOffset + 1;
|
29
|
+
this.createRangePermission(toSubDocument, template);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
toSubDocument.rangePermissions = toSubDocument.rangePermissions.sort(ConstRangePermission.comparer);
|
33
|
+
}
|
34
|
+
deleteRangePermissions(subDocument, interval) {
|
35
|
+
const rangePermissions = subDocument.rangePermissions;
|
36
|
+
const result = [];
|
37
|
+
let ind = SearchUtils.normedInterpolationIndexOf(rangePermissions, (b) => b.start, interval.start);
|
38
|
+
while (rangePermissions[ind] && rangePermissions[ind].start >= interval.start)
|
39
|
+
ind--;
|
40
|
+
ind = Math.max(0, ind);
|
41
|
+
for (let curr; (curr = rangePermissions[ind]) && curr.interval.start <= interval.end;) {
|
42
|
+
if (interval.containsInterval(curr.interval)) {
|
43
|
+
const tmpl = curr.constRangePermission;
|
44
|
+
this.deleteRangePermission(subDocument, tmpl, ind);
|
45
|
+
result.push(tmpl);
|
46
|
+
}
|
47
|
+
else
|
48
|
+
ind++;
|
49
|
+
}
|
50
|
+
return result;
|
51
|
+
}
|
17
52
|
}
|
@@ -17,6 +17,6 @@ export declare class BaseTextBoxInfo {
|
|
17
17
|
constructor(innerSubDocument: SubDocument, size: AnchorTextBoxSize, shape: Shape, anchorInfo: AnchorInfo, textBoxProperties: TextBoxProperties, containerProperties: NonVisualDrawingObjectInfo);
|
18
18
|
}
|
19
19
|
export declare class TextBoxManipulator extends RunsBaseManipulator {
|
20
|
-
|
20
|
+
insertAnchoredTextBoxViaHistory(subDocPos: SubDocumentPosition, charPropsBundle: MaskedCharacterPropertiesBundle, textBoxInfo: BaseTextBoxInfo): void;
|
21
21
|
insertAnchoredTextBox(subDocPos: SubDocumentPosition, charPropsBundle: MaskedCharacterPropertiesBundle, textBoxInfo: BaseTextBoxInfo): AnchoredTextBoxRun;
|
22
22
|
}
|
@@ -16,7 +16,7 @@ export class BaseTextBoxInfo {
|
|
16
16
|
}
|
17
17
|
}
|
18
18
|
export class TextBoxManipulator extends RunsBaseManipulator {
|
19
|
-
|
19
|
+
insertAnchoredTextBoxViaHistory(subDocPos, charPropsBundle, textBoxInfo) {
|
20
20
|
this.history.addAndRedo(new InsertAnchoredTextBoxHistoryItem(this.modelManipulator, subDocPos, charPropsBundle, textBoxInfo));
|
21
21
|
}
|
22
22
|
insertAnchoredTextBox(subDocPos, charPropsBundle, textBoxInfo) {
|
@@ -33,6 +33,7 @@ export class TextBoxManipulator extends RunsBaseManipulator {
|
|
33
33
|
let textBoxSubDoc = textBoxInfo.innerSubDocument ?
|
34
34
|
textBoxInfo.innerSubDocument :
|
35
35
|
this.model.createSubDocument(SubDocumentInfoType.TextBox, subDocument.id);
|
36
|
+
textBoxInfo.innerSubDocument = textBoxSubDoc;
|
36
37
|
textBoxRun.subDocId = textBoxSubDoc.id;
|
37
38
|
subDocument.chunks[insertedRun.chunkIndex].textRuns[insertedRun.runIndex].paragraph.length++;
|
38
39
|
this.modelManipulator.notifyModelChanged(new AnchoredTextBoxInsertedSubDocumentChange(subDocument.id, textBoxRun.anchoredObjectID, textBoxRun.subDocId, insertPositionAtStartDocument, textBoxInfo.anchorInfo, textBoxRun.containerProperties));
|
@@ -39,7 +39,7 @@ export class TextManipulator extends RunsBaseManipulator {
|
|
39
39
|
return null;
|
40
40
|
const historyItems = history.historyItems;
|
41
41
|
const result = history.currentIndex == historyItems.length - 1 ? this.getLastHistoryItemNode(historyItems, null, checkType) : null;
|
42
|
-
return
|
42
|
+
return (result === null || result === void 0 ? void 0 : result.empty) ? null : result;
|
43
43
|
}
|
44
44
|
getLastHistoryItemNode(historyItems, parent, checkType) {
|
45
45
|
for (let ind = historyItems.length - 1, item; item = historyItems[ind]; ind--) {
|
@@ -6,8 +6,7 @@ export declare class FieldsSettings {
|
|
6
6
|
defaultTimeFormat: string;
|
7
7
|
defaultDateFormat: string;
|
8
8
|
openHyperlinkOnClick: boolean;
|
9
|
-
|
10
|
-
allowedHyperlinkUriProtocols: string[];
|
9
|
+
allowedHyperlinkUriSchemes: string[];
|
11
10
|
keepHyperlinkResultForInvalidReference: boolean;
|
12
11
|
createHyperlinkTooltip: (hyperlinkTooltip: string, hint: string) => string;
|
13
12
|
constructor();
|
@@ -4,7 +4,6 @@ export class FieldsSettings {
|
|
4
4
|
;
|
5
5
|
constructor() {
|
6
6
|
this.openHyperlinkOnClick = false;
|
7
|
-
this.disableRelativeHyperlinkUri = false;
|
8
7
|
this.updateFieldsBeforePrint = true;
|
9
8
|
this.updateFieldsOnPaste = true;
|
10
9
|
this.defaultTimeFormat = FieldsSettings.DEFAULT_TIME_FORMAT;
|
@@ -30,10 +29,8 @@ export class FieldsSettings {
|
|
30
29
|
this.keepHyperlinkResultForInvalidReference = obj.keepHyperlinkResultForInvalidReference;
|
31
30
|
if (isDefined(obj.createHyperlinkTooltip) && obj.createHyperlinkTooltip !== '')
|
32
31
|
this.createHyperlinkTooltip = convertToFunction(obj.createHyperlinkTooltip);
|
33
|
-
if (isDefined(obj.
|
34
|
-
this.
|
35
|
-
if (isDefined(obj.allowedHyperlinkUriProtocols))
|
36
|
-
this.allowedHyperlinkUriProtocols = obj.allowedHyperlinkUriProtocols;
|
32
|
+
if (isDefined(obj.allowedHyperlinkUriSchemes))
|
33
|
+
this.allowedHyperlinkUriSchemes = obj.allowedHyperlinkUriSchemes;
|
37
34
|
}
|
38
35
|
clone() {
|
39
36
|
const result = new FieldsSettings();
|
@@ -7,8 +7,8 @@ import { BookmarkBase } from './bookmarks';
|
|
7
7
|
export class RangePermission extends BookmarkBase {
|
8
8
|
constructor(positionManager, interval, userName, group) {
|
9
9
|
super(positionManager, interval);
|
10
|
-
this.userName = userName
|
11
|
-
this.group = group
|
10
|
+
this.userName = userName;
|
11
|
+
this.group = group;
|
12
12
|
}
|
13
13
|
isGranted(settings) {
|
14
14
|
return RangePermission.allow(this.group, RangePermission.Everyone_GROUP_NAME) ||
|
@@ -17,7 +17,7 @@ export class RangePermission extends BookmarkBase {
|
|
17
17
|
RangePermission.allow(this.group, settings.authenticationGroup);
|
18
18
|
}
|
19
19
|
static allow(permissionValue, settingsValue) {
|
20
|
-
return settingsValue != "" && permissionValue ==
|
20
|
+
return settingsValue != "" && Comparers.stringIgnoreCase(permissionValue, settingsValue) == 0;
|
21
21
|
}
|
22
22
|
get end() { return this._interval.end - 1; }
|
23
23
|
get length() { return this.end - this.start; }
|
@@ -42,7 +42,9 @@ export class RangePermission extends BookmarkBase {
|
|
42
42
|
return new RangePermission(positionManager, this.interval, this.userName, this.group);
|
43
43
|
}
|
44
44
|
equals(obj) {
|
45
|
-
return super.equals(obj) && (StringUtils.isNullOrEmpty(this.userName) ?
|
45
|
+
return super.equals(obj) && (StringUtils.isNullOrEmpty(this.userName) ?
|
46
|
+
Comparers.stringIgnoreCase(obj.group, this.group) == 0 :
|
47
|
+
Comparers.stringIgnoreCase(obj.userName, this.userName) == 0);
|
46
48
|
}
|
47
49
|
}
|
48
50
|
RangePermission.Everyone_GROUP_NAME = "Everyone".toLowerCase();
|
@@ -123,6 +123,7 @@ export class StylesManager {
|
|
123
123
|
}
|
124
124
|
addTableCellStyleCore(oldStyle) {
|
125
125
|
var newStyle = oldStyle.clone();
|
126
|
+
this.tableCellStyleNameToIndex[newStyle.styleName] = this.documentModel.tableCellStyles.push(newStyle) - 1;
|
126
127
|
newStyle.characterProperties = this.documentModel.cache.mergedCharacterPropertiesCache.getItem(oldStyle.characterProperties);
|
127
128
|
newStyle.tableCellProperties = this.documentModel.cache.tableCellPropertiesCache.getItem(oldStyle.tableCellProperties);
|
128
129
|
return newStyle;
|