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.
Files changed (107) hide show
  1. package/bin/gulpfile.js +1 -1
  2. package/bin/index-custom.js +1 -1
  3. package/bin/localization-builder.js +1 -1
  4. package/bin/nspell-index.js +1 -1
  5. package/bin/nspell.webpack.config.js +1 -1
  6. package/bin/webpack-externals.js +1 -1
  7. package/bin/webpack.config.js +1 -1
  8. package/dist/dx.richedit.d.ts +12 -1
  9. package/dist/dx.richedit.js +5908 -406
  10. package/dist/dx.richedit.min.js +2 -2
  11. package/index.d.ts +1 -1
  12. package/index.js +1 -1
  13. package/lib/client/bars/rich-edit-ribbon/ribbon-items-data.js +2 -1
  14. package/lib/client/client-rich-edit.js +6 -6
  15. package/lib/client/commands/commands.js +3 -0
  16. package/lib/client/commands/mail-merge-command.d.ts +4 -1
  17. package/lib/client/commands/mail-merge-command.js +51 -18
  18. package/lib/client/commands/new-document-command.js +2 -1
  19. package/lib/client/default-localization.js +2 -0
  20. package/lib/client/dialogs/hyperlink-dialog.js +13 -6
  21. package/lib/client/formats/docx/export/exporters/styles.d.ts +5 -0
  22. package/lib/client/formats/docx/export/exporters/styles.js +30 -1
  23. package/lib/client/formats/docx/import/color/open-xml-color-import-helper.js +2 -2
  24. package/lib/client/formats/docx/import/importers/styles-importer.js +2 -1
  25. package/lib/client/formatters-options.js +2 -2
  26. package/lib/client/i-rich-constructor-settings.d.ts +1 -2
  27. package/lib/client/model-api/api-utils/range-permission-finder.js +3 -1
  28. package/lib/client/model-api/collections/drawing-object-collection.js +1 -1
  29. package/lib/client/model-api/collections/hyperlink-collection.js +1 -1
  30. package/lib/client/model-api/collections/range-permission-collection.js +3 -2
  31. package/lib/client/public/commands/enum.d.ts +1 -0
  32. package/lib/client/public/commands/enum.js +1 -0
  33. package/lib/client/public/options.d.ts +1 -2
  34. package/lib/client/public/ribbon/item-ids.d.ts +1 -0
  35. package/lib/client/public/ribbon/item-ids.js +1 -0
  36. package/lib/client/public/rich-edit.js +1 -1
  37. package/lib/client/settings.js +2 -4
  38. package/lib/common/commands/client-command.d.ts +2 -1
  39. package/lib/common/commands/client-command.js +1 -0
  40. package/lib/common/commands/command-manager.js +2 -1
  41. package/lib/common/commands/dialogs/dialog-hyperlink-command.js +10 -4
  42. package/lib/common/commands/fields/create-field-command.d.ts +4 -0
  43. package/lib/common/commands/fields/create-field-command.js +8 -0
  44. package/lib/common/commands/fields/open-hyperlink-command.js +9 -6
  45. package/lib/common/commands/floating-objects/floating-object-drag-drop-change-position-command.js +1 -1
  46. package/lib/common/commands/floating-objects/insert-anchored-text-box-command.js +1 -1
  47. package/lib/common/formats/html/export/html-export.d.ts +7 -1
  48. package/lib/common/formats/html/export/html-export.js +35 -35
  49. package/lib/common/formats/html/import/html-importer.js +1 -1
  50. package/lib/common/formats/html/import/importers/list-base.js +4 -4
  51. package/lib/common/formats/rtf/export/helpers/rtf-export-helper.js +3 -2
  52. package/lib/common/input-controller.d.ts +14 -1
  53. package/lib/common/input-controller.js +58 -20
  54. package/lib/common/layout/document-layout.js +1 -1
  55. package/lib/common/layout/main-structures/layout-boxes/layout-space-box.js +1 -1
  56. package/lib/common/model/color/color-model-info.d.ts +1 -1
  57. package/lib/common/model/color/color-model-info.js +2 -1
  58. package/lib/common/model/fields/field.d.ts +4 -1
  59. package/lib/common/model/fields/field.js +18 -2
  60. package/lib/common/model/fields/names.d.ts +2 -1
  61. package/lib/common/model/fields/names.js +1 -0
  62. package/lib/common/model/fields/parsers/field-code-parser-client-updating-base.js +1 -1
  63. package/lib/common/model/fields/parsers/field-code-parser-doc-variable.js +1 -1
  64. package/lib/common/model/fields/parsers/field-code-parser-hyperlink.js +32 -38
  65. package/lib/common/model/fields/parsers/field-code-parser-if.d.ts +40 -0
  66. package/lib/common/model/fields/parsers/field-code-parser-if.js +141 -0
  67. package/lib/common/model/fields/parsers/field-code-parser-merge-field.js +1 -1
  68. package/lib/common/model/fields/parsers/field-code-parser.d.ts +3 -2
  69. package/lib/common/model/fields/parsers/field-code-parser.js +6 -12
  70. package/lib/common/model/fields/tree-creator.js +2 -0
  71. package/lib/common/model/history/items/floating-objects/insert-anchored-picture-history-item.js +1 -0
  72. package/lib/common/model/history/items/switch-text-box-sub-documents-state-history-item.js +0 -1
  73. package/lib/common/model/manipulators/document/sub-document-inserter.d.ts +1 -0
  74. package/lib/common/model/manipulators/document/sub-document-inserter.js +4 -0
  75. package/lib/common/model/manipulators/range/remove-interval-operation.d.ts +2 -0
  76. package/lib/common/model/manipulators/range/remove-interval-operation.js +10 -2
  77. package/lib/common/model/manipulators/range-permission-manipulator.d.ts +4 -0
  78. package/lib/common/model/manipulators/range-permission-manipulator.js +35 -0
  79. package/lib/common/model/manipulators/text-box-manipulator.d.ts +1 -1
  80. package/lib/common/model/manipulators/text-box-manipulator.js +2 -1
  81. package/lib/common/model/manipulators/text-manipulator/text-manipulator.js +1 -1
  82. package/lib/common/model/options/fields.d.ts +1 -2
  83. package/lib/common/model/options/fields.js +2 -5
  84. package/lib/common/model/range-permissions.js +6 -4
  85. package/lib/common/model/styles-manager.js +1 -0
  86. package/lib/common/selection/selection.js +2 -1
  87. package/lib/common/ui/ruler/controls/indent/first-line.js +5 -5
  88. package/lib/common/ui/ruler/controls/indent/left.js +6 -6
  89. package/lib/common/ui/ruler/controls/indent/right.js +4 -4
  90. package/lib/common/ui/ruler/controls/margin/left.js +1 -1
  91. package/lib/common/ui/ruler/controls/margin/right.js +1 -1
  92. package/lib/common/ui/ruler/controls/ruler.js +2 -2
  93. package/lib/common/ui/ruler/controls/tab/tab-type.js +3 -3
  94. package/lib/common/ui/ruler/controls/tab/tab.js +7 -7
  95. package/lib/common/ui/ruler/controls/tab/utils.d.ts +2 -2
  96. package/lib/common/ui/ruler/controls/tab/utils.js +5 -5
  97. package/lib/common/ui/ruler/controls/table.js +1 -1
  98. package/lib/common/ui/ruler/controls/vertical-line.d.ts +1 -2
  99. package/lib/common/ui/ruler/controls/vertical-line.js +2 -2
  100. package/lib/common/ui/ruler/controls/wrapper.js +1 -1
  101. package/lib/common/ui/ruler/manager.js +1 -1
  102. package/lib/common/ui/ruler/model-data.d.ts +8 -2
  103. package/lib/common/ui/ruler/model-data.js +6 -0
  104. package/lib/common/ui/ruler/ruler.js +2 -1
  105. package/lib/common/utils/utils.d.ts +10 -5
  106. package/lib/common/utils/utils.js +46 -18
  107. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * DevExpress WebRichEdit (index.d.ts)
3
- * Version: 24.2.1
3
+ * Version: 24.2.3
4
4
  * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
5
5
  * License: https://www.devexpress.com/Support/EULAs
6
6
  */
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * DevExpress WebRichEdit (index.js)
3
- * Version: 24.2.1
3
+ * Version: 24.2.3
4
4
  * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
5
5
  * License: https://www.devexpress.com/Support/EULAs
6
6
  */
@@ -256,7 +256,8 @@ export class RibbonItemsData {
256
256
  { text: formatMessage('ASPxRichEditStringId.CreatePageField'), name: Command.CreatePageField },
257
257
  { text: formatMessage('ASPxRichEditStringId.CreatePageCountField'), name: Command.InsertPageCountField },
258
258
  { text: formatMessage('ASPxRichEditStringId.CreateEmptyMergeField'), name: Command.CreateEmptyMergeField },
259
- { text: formatMessage('ASPxRichEditStringId.CreateEmptyDocVariableField'), name: Command.CreateEmptyDocVariableField }
259
+ { text: formatMessage('ASPxRichEditStringId.CreateEmptyDocVariableField'), name: Command.CreateEmptyDocVariableField },
260
+ { text: formatMessage('ASPxRichEditStringId.CreateEmptyIfField'), name: Command.CreateEmptyIfField }
260
261
  ]
261
262
  },
262
263
  { type: 'Button', text: formatMessage('ASPxRichEditStringId.InsertMergeFieldTitle'), icon: 'dxre-icon-InsertDataField', alwaysShowText: true, name: Command.ShowInsertMergeFieldForm, },
@@ -61,8 +61,8 @@ export class ClientRichEdit {
61
61
  this.rawDataSource = settings.rawDataSource;
62
62
  this.contextMenuSettings = settings.contextMenuSettings;
63
63
  this.fullScreenHelper = new FullScreenHelper(element);
64
- if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFYWkdXQzFTVkdFeU1IbFVPRGh0YzAxNmRsQTJaeUlLZlE9PS5GYjZ4U0JwU3BSVHBWajZ0dWtlQTJZaU1WVW5tb0ZoSDJKV3Ryak5iN3p6VlNrNzhKa294RVFKOW9rVlErYnh0SzM1WWlFZkpEWGJnNktrYVA1ZEljcnp0ZHlsOFlGL2ltc3BIWkY5aWlaeGtVK0FXbFVrV1RUb2c0ZnZDbWlxMTl2MWhIdz09In0=")
65
- config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFYWkdXQzFTVkdFeU1IbFVPRGh0YzAxNmRsQTJaeUlLZlE9PS5GYjZ4U0JwU3BSVHBWajZ0dWtlQTJZaU1WVW5tb0ZoSDJKV3Ryak5iN3p6VlNrNzhKa294RVFKOW9rVlErYnh0SzM1WWlFZkpEWGJnNktrYVA1ZEljcnp0ZHlsOFlGL2ltc3BIWkY5aWlaeGtVK0FXbFVrV1RUb2c0ZnZDbWlxMTl2MWhIdz09In0=")));
64
+ if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFIaHFVV1ZWV0RGWFJVZFJTM1ZrTFU1bVQxbE5aeUlLZlE9PS5VMEV0VjZRMUNKaDR1WDIzbXZzcEl1d1prYVhDbzZKQittWFJqQTNZZ3pHOWxIL3dCQ2hNeDJ3RFdxdG1BQnpzYXdJc3hqME0yN2FDaFRCMTlJamR2L2ozRzE2Rk9zQTdJampEOTZjcGpWS29VZnkvS1I4K2dVcDFHSTEybnF3czZDWGNFdz09In0=")
65
+ config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFIaHFVV1ZWV0RGWFJVZFJTM1ZrTFU1bVQxbE5aeUlLZlE9PS5VMEV0VjZRMUNKaDR1WDIzbXZzcEl1d1prYVhDbzZKQittWFJqQTNZZ3pHOWxIL3dCQ2hNeDJ3RFdxdG1BQnpzYXdJc3hqME0yN2FDaFRCMTlJamR2L2ozRzE2Rk9zQTdJampEOTZjcGpWS29VZnkvS1I4K2dVcDFHSTEybnF3czZDWGNFdz09In0=")));
66
66
  this.prepareElement(element, settings);
67
67
  this.initDefaultFontsAndStyles();
68
68
  this.initBars(settings.ribbon, settings.fonts);
@@ -589,11 +589,11 @@ export class ClientRichEdit {
589
589
  return this.barHolder.ribbon;
590
590
  }
591
591
  getLinkType(hyperlinkInfo) {
592
- if (hyperlinkInfo.anchor)
593
- return DocumentLinkType.Bookmark;
594
- if (hyperlinkInfo.uri && hyperlinkInfo.uri.substr(0, 7) === "mailto:")
592
+ if (hyperlinkInfo.isMail())
595
593
  return DocumentLinkType.EmailAddress;
596
- return DocumentLinkType.Hyperlink;
594
+ if (hyperlinkInfo.isUri())
595
+ return DocumentLinkType.Hyperlink;
596
+ return DocumentLinkType.Bookmark;
597
597
  }
598
598
  setFullScreenMode() {
599
599
  this.fullScreenHelper.prepareFullScreenMode();
@@ -387,6 +387,9 @@ export function executeApiCommandCore(commandManager, commandId, parameter) {
387
387
  case MailMergeTabCommandId.CreateEmptyDocVariableField:
388
388
  parameter = undefined;
389
389
  break;
390
+ case MailMergeTabCommandId.CreateEmptyIfField:
391
+ parameter = undefined;
392
+ break;
390
393
  case MailMergeTabCommandId.ShowInsertMergeFieldDialog:
391
394
  parameter = undefined;
392
395
  break;
@@ -11,8 +11,11 @@ export declare class MailMergeCommand extends CommandBase<SimpleCommandState> {
11
11
  executeCore(_state: SimpleCommandState, options: CommandSimpleOptions<MailMergeCommandParameters>): boolean;
12
12
  prepareMergedDocument(modelManager: IModelManager, param: MailMergeCommandParameters): void;
13
13
  private getDataSource;
14
- private replaceMergeFieldsInModel;
14
+ private replaceFieldsInModel;
15
+ private processFieldsInSubDocument;
15
16
  private replaceMergeFieldsInSubDocument;
17
+ private replaceIfFieldsInSubDocument;
18
+ private replaceFieldWithText;
16
19
  private getResultByFieldName;
17
20
  private insertSeparator;
18
21
  private createModelManager;
@@ -24,6 +24,7 @@ import { DocxExporter } from '../formats/docx/export/exporter';
24
24
  import { Importer } from '../formats/docx/import/importer';
25
25
  import { ImporterOptions } from '../formats/docx/import/importer-options';
26
26
  import { exportModelToBlob } from '../model-api/formats/exporter';
27
+ import { FieldCodeParserIf } from '../../common/model/fields/parsers/field-code-parser-if';
27
28
  export class MailMergeCommand extends CommandBase {
28
29
  getState() {
29
30
  var state = new SimpleCommandState(this.isEnabled());
@@ -34,8 +35,10 @@ export class MailMergeCommand extends CommandBase {
34
35
  return true;
35
36
  }
36
37
  isEnabled() {
37
- return super.isEnabled() && ControlOptions.isEnabled(this.control.modelManager.richOptions.control.fields) &&
38
- this.control.modelManager.model.mainSubDocument.getDocumentEndPosition() > 1 && !!this.getDataSource();
38
+ return (super.isEnabled() &&
39
+ ControlOptions.isEnabled(this.control.modelManager.richOptions.control.fields) &&
40
+ this.control.modelManager.model.mainSubDocument.getDocumentEndPosition() > 1 &&
41
+ !!this.getDataSource());
39
42
  }
40
43
  canModify() {
41
44
  return true;
@@ -58,7 +61,7 @@ export class MailMergeCommand extends CommandBase {
58
61
  throw new Error(Errors.InternalException);
59
62
  const param = options.param;
60
63
  this.prepareMergedDocument(exportModelOptions.modelManager, param);
61
- exportModelToBlob(exportModelOptions, blob => param.callback(blob));
64
+ exportModelToBlob(exportModelOptions, (blob) => param.callback(blob));
62
65
  }, 3000);
63
66
  formatImagesImporter.import(exportModelOptions.modelManager.modelManipulator);
64
67
  }, () => { });
@@ -79,7 +82,7 @@ export class MailMergeCommand extends CommandBase {
79
82
  if (index > param.exportFrom)
80
83
  rangeCopy.insertTo(modelManager.modelManipulator, new SubDocumentPosition(subDoc, subDoc.getDocumentEndPosition() - 1));
81
84
  const record = dataSource.items()[index];
82
- this.replaceMergeFieldsInModel(modelManager, record, lastProcessedPositionInMainSubDocument, processedSubDocIds);
85
+ this.replaceFieldsInModel(modelManager, record, lastProcessedPositionInMainSubDocument, processedSubDocIds);
83
86
  if (index < exportToIndex)
84
87
  this.insertSeparator(modelManager, param.mergeMode);
85
88
  lastProcessedPositionInMainSubDocument = subDoc.getDocumentEndPosition() - 1;
@@ -88,41 +91,71 @@ export class MailMergeCommand extends CommandBase {
88
91
  getDataSource() {
89
92
  return this.control.owner.dataSource;
90
93
  }
91
- replaceMergeFieldsInModel(modelManager, record, lastProcessedPositionInMainSubDocument, processedSubDocIds) {
94
+ replaceFieldsInModel(modelManager, record, lastProcessedPositionInMainSubDocument, processedSubDocIds) {
92
95
  NumberMapUtils.forEach(modelManager.model.subDocuments, (subDoc) => {
93
- if (!ListUtils.anyOf(processedSubDocIds, id => id === subDoc.id)) {
96
+ if (!ListUtils.anyOf(processedSubDocIds, (id) => id === subDoc.id)) {
94
97
  this.replaceMergeFieldsInSubDocument(modelManager, record, lastProcessedPositionInMainSubDocument, subDoc);
98
+ this.replaceIfFieldsInSubDocument(modelManager, lastProcessedPositionInMainSubDocument, subDoc);
95
99
  if (!subDoc.isMain())
96
100
  processedSubDocIds.push(subDoc.id);
97
101
  }
98
102
  });
99
103
  }
100
- replaceMergeFieldsInSubDocument(modelManager, record, lastProcessedPositionInMainSubDocument, subDoc) {
104
+ processFieldsInSubDocument(modelManager, lastProcessedPositionInMainSubDocument, subDoc, processField) {
101
105
  for (let i = subDoc.fields.length - 1; i >= 0; i--) {
102
106
  const field = subDoc.fields[i];
103
- if (subDoc.isMain() && field.getFieldStartPosition() < lastProcessedPositionInMainSubDocument)
107
+ if (subDoc.isMain() && field.getFieldStartPosition() < lastProcessedPositionInMainSubDocument) {
104
108
  return;
109
+ }
105
110
  const parser = FieldsWaitingForUpdate.getParser(modelManager, null, null, subDoc, field);
106
111
  if (parser) {
107
- if (parser instanceof FieldCodeParserMailMerge) {
108
- const fieldName = parser.getMergeFieldName();
109
- const pos = field.getFieldStartPosition();
110
- const text = RichUtils.replaceParagraphEndCharsWithLineBreak(this.getResultByFieldName(record, fieldName));
111
- if (!StringUtils.isNullOrEmpty(text)) {
112
- const insertParams = new InsertTextManipulatorParams(new SubDocumentPosition(subDoc, pos), subDoc.getRunByPosition(pos).getCharPropsBundle(modelManager.model), RunType.TextRun, text);
113
- modelManager.modelManipulator.text.insertTextInner(insertParams);
112
+ try {
113
+ const text = processField(parser);
114
+ if (text !== null) {
115
+ this.replaceFieldWithText(modelManager, subDoc, field, text);
114
116
  }
115
- modelManager.modelManipulator.range.removeIntervalWithoutHistory(subDoc, field.getAllFieldInterval(), false);
116
117
  }
117
- parser.destructor();
118
+ finally {
119
+ parser.destructor();
120
+ }
118
121
  }
119
122
  }
120
123
  }
124
+ replaceMergeFieldsInSubDocument(modelManager, record, lastProcessedPositionInMainSubDocument, subDoc) {
125
+ const processField = (parser) => {
126
+ if (parser instanceof FieldCodeParserMailMerge) {
127
+ const fieldName = parser.getMergeFieldName();
128
+ return RichUtils.replaceParagraphEndCharsWithLineBreak(this.getResultByFieldName(record, fieldName));
129
+ }
130
+ return null;
131
+ };
132
+ this.processFieldsInSubDocument(modelManager, lastProcessedPositionInMainSubDocument, subDoc, processField);
133
+ }
134
+ replaceIfFieldsInSubDocument(modelManager, lastProcessedPositionInMainSubDocument, subDoc) {
135
+ const processField = (parser) => {
136
+ if (parser instanceof FieldCodeParserIf) {
137
+ parser.parseSwitchesAndArgs();
138
+ return parser.getResult();
139
+ }
140
+ return null;
141
+ };
142
+ this.processFieldsInSubDocument(modelManager, lastProcessedPositionInMainSubDocument, subDoc, processField);
143
+ }
144
+ replaceFieldWithText(modelManager, subDoc, field, text) {
145
+ if (!StringUtils.isNullOrEmpty(text)) {
146
+ const pos = field.getFieldStartPosition();
147
+ const runProps = subDoc.getRunByPosition(pos).getCharPropsBundle(modelManager.model);
148
+ const insertParams = new InsertTextManipulatorParams(new SubDocumentPosition(subDoc, pos), runProps, RunType.TextRun, text);
149
+ modelManager.modelManipulator.text.insertTextInner(insertParams);
150
+ }
151
+ modelManager.modelManipulator.range.removeIntervalWithoutHistory(subDoc, field.getAllFieldInterval(), false);
152
+ }
121
153
  getResultByFieldName(record, fieldName) {
122
154
  const keys = Object.keys(record);
123
- for (let i = 0, key; key = keys[i]; i++)
155
+ for (let i = 0, key; (key = keys[i]); i++) {
124
156
  if (key.toLowerCase() == fieldName.toLowerCase())
125
157
  return record[key] + '';
158
+ }
126
159
  return '';
127
160
  }
128
161
  insertSeparator(modelManager, mergeMode) {
@@ -19,9 +19,10 @@ export class NewDocumentCommand extends CommandBase {
19
19
  return true;
20
20
  }
21
21
  static newDocumentInner() {
22
+ var _a;
22
23
  this.control.closeDocument();
23
24
  this.control.loadingPanelManager.loadingPanel.setVisible(true);
24
- const documentInfo = new DocumentInfo(DocumentInfo.defaultDocumentName, false);
25
+ const documentInfo = new DocumentInfo((_a = this.control.documentInfo) === null || _a === void 0 ? void 0 : _a.fileName, false);
25
26
  this.control.initialize("", documentInfo, 1, null);
26
27
  const options = new ModelCreatorOptions();
27
28
  new ModelCreator(options).setModel(this.control.modelManager.model).fillModel();
@@ -2030,6 +2030,8 @@ export function loadDefaultMessages() {
2030
2030
  "ASPxRichEditStringId.CreateEmptyMergeFieldDescription": "Retrieves a value from the bound data source.",
2031
2031
  "ASPxRichEditStringId.CreateEmptyDocVariableField": "DOCVARIABLE",
2032
2032
  "ASPxRichEditStringId.CreateEmptyDocVariableFieldDescription": "Enables you to programmatically insert complex content when this field is updated.",
2033
+ "ASPxRichEditStringId.CreateEmptyIfField": "IF",
2034
+ "ASPxRichEditStringId.CreateEmptyIfFieldDescription": "Compares two values and inserts text related to the comparison result.",
2033
2035
  "ASPxRichEditStringId.MenuCmd_Font_settings": "Font settings",
2034
2036
  "ASPxRichEditStringId.MenuCmd_Align_Paragraph": "Align Paragraph",
2035
2037
  "ASPxRichEditStringId.MenuCmd_Empty": "Empty",
@@ -1,5 +1,6 @@
1
1
  import { formatMessage } from 'devextreme/localization';
2
2
  import { DialogBase } from './dialog-base';
3
+ import { UrlUtils } from '../../common/utils/utils';
3
4
  export class HyperlinkDialog extends DialogBase {
4
5
  constructor() {
5
6
  super(...arguments);
@@ -146,13 +147,19 @@ export class HyperlinkDialog extends DialogBase {
146
147
  parameters.text = data.text;
147
148
  parameters.tooltip = data.tooltip;
148
149
  const tabPanelSelectedIndex = this.tabPanel.option('selectedIndex');
149
- if (tabPanelSelectedIndex == 0)
150
- parameters.url = data.url;
151
- else if (tabPanelSelectedIndex == 1)
152
- parameters.anchor = data.anchor;
150
+ if (tabPanelSelectedIndex == 0) {
151
+ [parameters.url, parameters.anchor] = UrlUtils.splitUrlByAnchor(data.url);
152
+ }
153
153
  else {
154
- const subject = data.subject ? this.subjectPrefix + data.subject : '';
155
- parameters.url = this.mailtoPrefix + data.email + subject;
154
+ if (tabPanelSelectedIndex == 1) {
155
+ parameters.url = "";
156
+ parameters.anchor = data.anchor;
157
+ }
158
+ else {
159
+ const subject = data.subject ? this.subjectPrefix + data.subject : '';
160
+ parameters.url = this.mailtoPrefix + data.email + subject;
161
+ parameters.anchor = "";
162
+ }
156
163
  }
157
164
  }
158
165
  }
@@ -4,8 +4,13 @@ export declare class StylesExporter extends ExporterBaseWithRootElement {
4
4
  get rootElement(): string;
5
5
  get rootNSPrefix(): string;
6
6
  get rootNSValue(): string;
7
+ private styleNameToIndex;
8
+ private sortedStyleIndexes;
9
+ private processedStyleNames;
7
10
  protected fillWriter(): void;
8
11
  private exportDocumentDefaults;
9
12
  private exportDocumentCharacterDefaults;
10
13
  private exportDocumentParagraphDefaults;
14
+ private getSortedStyleIndexes;
15
+ private sortStyleIndexRecursive;
11
16
  }
@@ -3,13 +3,20 @@ import { ListUtils } from '@devexpress/utils/lib/utils/list';
3
3
  import { DocxNsType } from '../../utils/constants';
4
4
  import { ExporterBaseWithRootElement } from './base';
5
5
  export class StylesExporter extends ExporterBaseWithRootElement {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.styleNameToIndex = new Map();
9
+ this.sortedStyleIndexes = [];
10
+ this.processedStyleNames = new Set();
11
+ }
6
12
  get filePath() { return 'word/styles.xml'; }
7
13
  get rootElement() { return 'styles'; }
8
14
  get rootNSPrefix() { return this.data.constants.namespaces[DocxNsType.WordProcessing].prefix; }
9
15
  get rootNSValue() { return this.data.constants.namespaces[DocxNsType.WordProcessing].namespace; }
10
16
  fillWriter() {
11
17
  this.exportDocumentDefaults();
12
- ListUtils.forEach(this.data.model.paragraphStyles, (style, index) => this.data.parStyleExporter.export(style, index));
18
+ const paragraphStyleIndexes = this.getSortedStyleIndexes();
19
+ ListUtils.forEach(paragraphStyleIndexes, (index) => this.data.parStyleExporter.export(this.data.model.paragraphStyles[index], index));
13
20
  ListUtils.forEach(this.data.model.characterStyles, (style, index) => this.data.charStyleExporter.export(style, index));
14
21
  ListUtils.forEach(this.data.model.tableStyles, (style, index) => this.data.tblStyleExporter.export(style, index));
15
22
  }
@@ -33,4 +40,26 @@ export class StylesExporter extends ExporterBaseWithRootElement {
33
40
  this.writer.endElement();
34
41
  this.writer.endElement();
35
42
  }
43
+ getSortedStyleIndexes() {
44
+ this.styleNameToIndex = new Map();
45
+ this.sortedStyleIndexes = [];
46
+ this.processedStyleNames = new Set();
47
+ const styles = this.data.model.paragraphStyles;
48
+ styles.forEach((style, index) => this.styleNameToIndex.set(style.styleName, index));
49
+ for (let index = 0; index < styles.length; index++)
50
+ this.sortStyleIndexRecursive(index);
51
+ return this.sortedStyleIndexes;
52
+ }
53
+ sortStyleIndexRecursive(index) {
54
+ const styles = this.data.model.paragraphStyles;
55
+ const style = styles[index];
56
+ if (this.processedStyleNames.has(style.styleName))
57
+ return;
58
+ this.processedStyleNames.add(style.styleName);
59
+ if (style.parent) {
60
+ const parentIndex = this.styleNameToIndex.get(style.parent.styleName);
61
+ this.sortStyleIndexRecursive(parentIndex);
62
+ }
63
+ this.sortedStyleIndexes.push(index);
64
+ }
36
65
  }
@@ -11,7 +11,7 @@ export class OpenXmlColorImportHelper {
11
11
  if (themeValue != ThemeColorValues.None) {
12
12
  const themeColorIndex = ThemeColorIndexCalculator.calculateThemeColorIndex(themeValue);
13
13
  return themeColorIndex != ThemeColorIndexConstants.None ?
14
- ColorModelInfo.makeByThemeColorIndex(themeColorIndex, OpenXmlColorImportHelper.getTint(data, reader, 'themeTint', 'themeShade')) :
14
+ ColorModelInfo.makeByThemeColorIndex(themeColorIndex, OpenXmlColorImportHelper.getTint(data, reader, 'themeTint', 'themeShade'), themeValue) :
15
15
  ColorModelInfo.makeByThemeColorIndex(DXColor.empty);
16
16
  }
17
17
  else {
@@ -42,7 +42,7 @@ export class OpenXmlColorImportHelper {
42
42
  if (themeValue != ThemeColorValues.None) {
43
43
  const themeColorIndex = ThemeColorIndexCalculator.calculateThemeColorIndex(themeValue);
44
44
  if (themeColorIndex != ThemeColorIndexConstants.None)
45
- return ColorModelInfo.makeByThemeColorIndex(themeColorIndex, tint);
45
+ return ColorModelInfo.makeByThemeColorIndex(themeColorIndex, tint, themeValue);
46
46
  }
47
47
  return ColorModelInfo.makeByColor(data.readerHelper.getWpSTColorValue(reader, 'fill', DXColor.empty), tint);
48
48
  }
@@ -77,9 +77,10 @@ export class StyleManager {
77
77
  StringMapUtils.forEach(this.info, (info) => action(info));
78
78
  }
79
79
  addStyle(dest) {
80
+ var _a;
80
81
  if (this.currInfo.isDefault && !this.isDefaultProcessed) {
81
82
  this.isDefaultProcessed = true;
82
- if (this.defaultStyle.styleName === this.currInfo.name)
83
+ if (((_a = this.defaultStyle) === null || _a === void 0 ? void 0 : _a.styleName) === this.currInfo.name)
83
84
  this.applyProperties(dest, this.defaultStyle);
84
85
  else
85
86
  this.defaultStyle = this.addToModel(this.applyProperties(dest, this.createEmpty()));
@@ -1,5 +1,5 @@
1
- import * as DxLocDate from 'devextreme/localization/date';
2
- import * as DxLocNumber from 'devextreme/localization/number';
1
+ import * as DxLocDate from 'devextreme/common/core/localization/date';
2
+ import * as DxLocNumber from 'devextreme/common/core/localization/number';
3
3
  export class ClientFormattersOptions {
4
4
  get locDate() { var _a; return (_a = DxLocDate.default) !== null && _a !== void 0 ? _a : DxLocDate; }
5
5
  get locNumber() { var _a; return (_a = DxLocNumber.default) !== null && _a !== void 0 ? _a : DxLocNumber; }
@@ -80,8 +80,7 @@ export interface IRichEditFieldsSettings {
80
80
  defaultDateFormat?: string;
81
81
  openHyperlinkOnClick?: boolean;
82
82
  keepHyperlinkResultForInvalidReference?: boolean;
83
- disableRelativeHyperlinkUri?: boolean;
84
- allowedHyperlinkUriProtocols?: string[];
83
+ allowedHyperlinkUriSchemes?: string[];
85
84
  createHyperlinkTooltip?: (hyperlinkTooltip: string, hint: string) => string;
86
85
  }
87
86
  export interface IRichEditRangePermissionsSettings {
@@ -1,4 +1,5 @@
1
1
  import { IntervalAlgorithms } from '@devexpress/utils/lib/intervals/algorithms';
2
+ import { Comparers } from '@devexpress/utils/lib/utils/comparers';
2
3
  import { ListUtils } from '@devexpress/utils/lib/utils/list';
3
4
  export function findRangePermissionsByIntervals(sourceCollection, intervals) {
4
5
  const permissions = [];
@@ -19,5 +20,6 @@ export function findRangePermissions(sourceCollection, check) {
19
20
  }
20
21
  export function findRangePermission(sourceCollection, coreInterval, userName, group) {
21
22
  const intervals = findRangePermissionsByIntervals(sourceCollection, [coreInterval]);
22
- return ListUtils.elementBy(intervals, (permission) => permission.userName == userName && permission.group == group);
23
+ return ListUtils.elementBy(intervals, (permission) => Comparers.stringIgnoreCase(permission.userName, userName) == 0 &&
24
+ Comparers.stringIgnoreCase(permission.group, group) == 0);
23
25
  }
@@ -59,7 +59,7 @@ export class TextBoxCollection extends DrawingObjectCollectionBase {
59
59
  const anchorInfo = new AnchorInfo();
60
60
  anchorInfo.zOrder = this._processor.modelManager.modelManipulator.floatingObject.zOrder.getNewZOrder(this._subDocument);
61
61
  const inputPos = new InputPositionBase().setIntervals(SelectionIntervalsInfo.fromPosition(this._subDocument, position));
62
- this._processor.modelManager.modelManipulator.textBox.insertAnchoredTextBoxViaHistoty(new SubDocumentPosition(this._subDocument, position), inputPos.charPropsBundle, new BaseTextBoxInfo(null, size, new Shape(ColorUtils.fromString(ColorUtils.colorNames.white), ColorHelper.BLACK_COLOR, UnitConverter.pointsToTwips(3.0 / 4)), anchorInfo, textBoxProperties, new NonVisualDrawingObjectInfo()));
62
+ this._processor.modelManager.modelManipulator.textBox.insertAnchoredTextBoxViaHistory(new SubDocumentPosition(this._subDocument, position), inputPos.charPropsBundle, new BaseTextBoxInfo(null, size, new Shape(ColorUtils.fromString(ColorUtils.colorNames.white), ColorHelper.BLACK_COLOR, UnitConverter.pointsToTwips(3.0 / 4)), anchorInfo, textBoxProperties, new NonVisualDrawingObjectInfo()));
63
63
  const textBoxRun = this._subDocument.getRunByPosition(position);
64
64
  return new TextBoxApi(this._processor.modelManager, this._subDocument, textBoxRun, position);
65
65
  }
@@ -60,7 +60,7 @@ export class HyperlinkCollection extends Collection {
60
60
  subDocument.insertText(field.getCodeInterval().start, HyperlinkInfo.getNewCodeText(info));
61
61
  if (canChangeHyperlinkDisplayText && hyperlinkInfo.text || field.getResultInterval().length == 0) {
62
62
  subDocument.deleteText(convertToIntervalApi(field.getResultInterval()));
63
- subDocument.insertText(field.getResultInterval().start, !hyperlinkInfo.text || hyperlinkInfo.text == "" ? info.getUriPlusAnchor() : hyperlinkInfo.text);
63
+ subDocument.insertText(field.getResultInterval().start, !hyperlinkInfo.text || hyperlinkInfo.text == "" ? info.getUriWithAnchor() : hyperlinkInfo.text);
64
64
  }
65
65
  this._processor.modelManager.history.addAndRedo(new ApplyFieldHyperlinkStyleHistoryItem(this._processor.modelManager.modelManipulator, new SubDocumentInterval(this._subDocument, field.getResultInterval())));
66
66
  this._processor.modelManager.history.endTransaction();
@@ -10,6 +10,7 @@ import { ModelParametersChecker } from '../api-utils/model-parameter-checker';
10
10
  import { findRangePermission, findRangePermissions, findRangePermissionsByIntervals } from '../api-utils/range-permission-finder';
11
11
  import { RangePermissionApi } from '../range-permission';
12
12
  import { Collection } from './collection';
13
+ import { Comparers } from '@devexpress/utils/lib/utils/comparers';
13
14
  export class RangePermissionCollection extends Collection {
14
15
  constructor(processor, subDocument) {
15
16
  super(processor);
@@ -81,13 +82,13 @@ function findByPosition(position, canBeUndefined, sourceCollection) {
81
82
  }
82
83
  function findByUserName(value, permissions) {
83
84
  return ListUtils.map(ApiParametersChecker.check(value, 1, true, [
84
- ApiParametersChecker.stringDescriptor("userName", (userName) => findRangePermissions(permissions, permission => permission.userName == userName), false),
85
+ ApiParametersChecker.stringDescriptor("userName", (userName) => findRangePermissions(permissions, permission => Comparers.stringIgnoreCase(permission.userName, userName) == 0), false),
85
86
  ApiParametersChecker.regExpDescriptor('regexp', (regexp) => findRangePermissions(permissions, permission => regexp.test(permission.userName)))
86
87
  ]), (b) => b);
87
88
  }
88
89
  function findByGroup(value, permissions) {
89
90
  return ListUtils.map(ApiParametersChecker.check(value, 1, true, [
90
- ApiParametersChecker.stringDescriptor("group", (group) => findRangePermissions(permissions, permission => permission.group == group), false),
91
+ ApiParametersChecker.stringDescriptor("group", (group) => findRangePermissions(permissions, permission => Comparers.stringIgnoreCase(permission.group, group) == 0), false),
91
92
  ApiParametersChecker.regExpDescriptor('regexp', (regexp) => findRangePermissions(permissions, permission => regexp.test(permission.group)))
92
93
  ]), (b) => b);
93
94
  }
@@ -133,6 +133,7 @@ export declare enum MailMergeTabCommandId {
133
133
  CreateNumPagesField = 236,
134
134
  CreateEmptyMergeField = 372,
135
135
  CreateEmptyDocVariableField = 373,
136
+ CreateEmptyIfField = 459,
136
137
  ShowInsertMergeFieldDialog = 214,
137
138
  ToggleViewMergedData = 213,
138
139
  ShowAllFieldCodes = 186,
@@ -139,6 +139,7 @@ export var MailMergeTabCommandId;
139
139
  MailMergeTabCommandId[MailMergeTabCommandId["CreateNumPagesField"] = 236] = "CreateNumPagesField";
140
140
  MailMergeTabCommandId[MailMergeTabCommandId["CreateEmptyMergeField"] = 372] = "CreateEmptyMergeField";
141
141
  MailMergeTabCommandId[MailMergeTabCommandId["CreateEmptyDocVariableField"] = 373] = "CreateEmptyDocVariableField";
142
+ MailMergeTabCommandId[MailMergeTabCommandId["CreateEmptyIfField"] = 459] = "CreateEmptyIfField";
142
143
  MailMergeTabCommandId[MailMergeTabCommandId["ShowInsertMergeFieldDialog"] = 214] = "ShowInsertMergeFieldDialog";
143
144
  MailMergeTabCommandId[MailMergeTabCommandId["ToggleViewMergedData"] = 213] = "ToggleViewMergedData";
144
145
  MailMergeTabCommandId[MailMergeTabCommandId["ShowAllFieldCodes"] = 186] = "ShowAllFieldCodes";
@@ -93,8 +93,7 @@ export interface IFieldsSettings {
93
93
  defaultDateFormat?: string;
94
94
  openHyperlinkOnClick?: boolean;
95
95
  keepHyperlinkResultForInvalidReference?: boolean;
96
- disableRelativeHyperlinkUri?: boolean;
97
- allowedHyperlinkUriProtocols?: string[];
96
+ allowedHyperlinkUriSchemes?: string[];
98
97
  createHyperlinkTooltip?: (hyperlinkTooltip: string, hint: string) => string;
99
98
  }
100
99
  export interface IBookmarkSettings {
@@ -133,6 +133,7 @@ export declare enum MailMergeTabItemId {
133
133
  CreateNumPagesField = 236,
134
134
  CreateEmptyMergeField = 372,
135
135
  CreateEmptyDocVariableField = 373,
136
+ CreateEmptyIfField = 459,
136
137
  ShowInsertMergeFieldDialog = 214,
137
138
  ToggleViewMergedData = 213,
138
139
  ShowAllFieldCodes = 186,
@@ -139,6 +139,7 @@ export var MailMergeTabItemId;
139
139
  MailMergeTabItemId[MailMergeTabItemId["CreateNumPagesField"] = 236] = "CreateNumPagesField";
140
140
  MailMergeTabItemId[MailMergeTabItemId["CreateEmptyMergeField"] = 372] = "CreateEmptyMergeField";
141
141
  MailMergeTabItemId[MailMergeTabItemId["CreateEmptyDocVariableField"] = 373] = "CreateEmptyDocVariableField";
142
+ MailMergeTabItemId[MailMergeTabItemId["CreateEmptyIfField"] = 459] = "CreateEmptyIfField";
142
143
  MailMergeTabItemId[MailMergeTabItemId["ShowInsertMergeFieldDialog"] = 214] = "ShowInsertMergeFieldDialog";
143
144
  MailMergeTabItemId[MailMergeTabItemId["ToggleViewMergedData"] = 213] = "ToggleViewMergedData";
144
145
  MailMergeTabItemId[MailMergeTabItemId["ShowAllFieldCodes"] = 186] = "ShowAllFieldCodes";
@@ -118,7 +118,7 @@ class RichEditPublic {
118
118
  mimeType = HtmlMimeType;
119
119
  break;
120
120
  }
121
- const fileName = OpenDocumentCommand.getFileNameWithoutExtension(this.documentName);
121
+ const fileName = OpenDocumentCommand.getFileNameWithoutExtension(this._native.core.documentInfo.fileName);
122
122
  const extension = Utils.documentFormatToExtension(format);
123
123
  const exportModelOptions = this._native.core.getExportModelOptions({ documentFormat: format });
124
124
  exportModelToBlob(exportModelOptions, blob => callback(FileUtils.createFile([blob], fileName + extension, { type: mimeType })));
@@ -146,10 +146,8 @@ export class Settings {
146
146
  result.fields.createHyperlinkTooltip = this.parseEventHandler(settings.fields.createHyperlinkTooltip);
147
147
  if (isDefined(settings.fields.keepHyperlinkResultForInvalidReference))
148
148
  result.fields.keepHyperlinkResultForInvalidReference = settings.fields.keepHyperlinkResultForInvalidReference;
149
- if (isDefined(settings.fields.disableRelativeHyperlinkUri))
150
- result.fields.disableRelativeHyperlinkUri = settings.fields.disableRelativeHyperlinkUri;
151
- if (isDefined(settings.fields.allowedHyperlinkUriProtocols))
152
- result.fields.allowedHyperlinkUriProtocols = settings.fields.allowedHyperlinkUriProtocols;
149
+ if (isDefined(settings.fields.allowedHyperlinkUriSchemes))
150
+ result.fields.allowedHyperlinkUriSchemes = settings.fields.allowedHyperlinkUriSchemes;
153
151
  }
154
152
  }
155
153
  static parsePrintingSettings(settings, result) {
@@ -418,5 +418,6 @@ export declare enum RichEditClientCommand {
418
418
  FloatingObjectBringForwardMenu = 455,
419
419
  FloatingObjectSendBackwardMenu = 456,
420
420
  NoSpellingSuggestions = 457,
421
- GetHtml = 458
421
+ GetHtml = 458,
422
+ CreateEmptyIfField = 459
422
423
  }
@@ -420,4 +420,5 @@ export var RichEditClientCommand;
420
420
  RichEditClientCommand[RichEditClientCommand["FloatingObjectSendBackwardMenu"] = 456] = "FloatingObjectSendBackwardMenu";
421
421
  RichEditClientCommand[RichEditClientCommand["NoSpellingSuggestions"] = 457] = "NoSpellingSuggestions";
422
422
  RichEditClientCommand[RichEditClientCommand["GetHtml"] = 458] = "GetHtml";
423
+ RichEditClientCommand[RichEditClientCommand["CreateEmptyIfField"] = 459] = "CreateEmptyIfField";
423
424
  })(RichEditClientCommand || (RichEditClientCommand = {}));
@@ -35,7 +35,7 @@ import { ShowQuickSearchPanelCommand } from './dialogs/show-quick-search-panel-c
35
35
  import { ChangePageColorCommand } from './document-properties/change-page-color-command';
36
36
  import { PrintDocumentOnClient } from './document/print-document-on-client-command';
37
37
  import { ChangeHyperlinkCommand } from './fields/change-hyperlink-command';
38
- import { CreateDateFieldCommand, CreateEmptyDocVariableFieldCommand, CreateEmptyMergeFieldCommand, CreateEquationCaptionFieldCommand, CreateFieldCommand, CreateFieldWithCodeCommand, CreateFigureCaptionFieldCommand, CreateMergeFieldCommand, CreatePageCountFieldCommand, CreatePageFieldCommand, CreateTableCaptionFieldCommand, CreateTableOfEquationsFieldCommand, CreateTableOfFiguresFieldCommand, CreateTableOfTablesFieldCommand, CreateTimeFieldCommand, CreateTocFieldCommand } from './fields/create-field-command';
38
+ import { CreateDateFieldCommand, CreateEmptyDocVariableFieldCommand, CreateEmptyIfFieldCommand, CreateEmptyMergeFieldCommand, CreateEquationCaptionFieldCommand, CreateFieldCommand, CreateFieldWithCodeCommand, CreateFigureCaptionFieldCommand, CreateMergeFieldCommand, CreatePageCountFieldCommand, CreatePageFieldCommand, CreateTableCaptionFieldCommand, CreateTableOfEquationsFieldCommand, CreateTableOfFiguresFieldCommand, CreateTableOfTablesFieldCommand, CreateTimeFieldCommand, CreateTocFieldCommand } from './fields/create-field-command';
39
39
  import { GoToFirstDataRecordCommand, GoToLastDataRecordCommand, GoToNextDataRecordCommand, GoToPreviousDataRecordCommand, GoToRecordCommandBase } from './fields/go-to-record-command';
40
40
  import { OpenHyperlinkCommand } from './fields/open-hyperlink-command';
41
41
  import { RemoveHyperlinkCommand } from './fields/remove-hyperlink-command';
@@ -524,6 +524,7 @@ export class CommandManager {
524
524
  this.createCommand(control, RichEditClientCommand.ChangeTextBoxProperties, ChangeTextBoxPropertiesCommand);
525
525
  this.createCommand(control, RichEditClientCommand.CreateEmptyMergeField, CreateEmptyMergeFieldCommand);
526
526
  this.createCommand(control, RichEditClientCommand.CreateEmptyDocVariableField, CreateEmptyDocVariableFieldCommand);
527
+ this.createCommand(control, RichEditClientCommand.CreateEmptyIfField, CreateEmptyIfFieldCommand);
527
528
  this.createCommand(control, RichEditClientCommand.FloatingObjectDragDropChangePosition, FloatingObjectDragDropChangePositionCommand);
528
529
  this.createCommand(control, RichEditClientCommand.InsertHtml, InsertHtmlCommand);
529
530
  this.createCommand(control, RichEditClientCommand.CreateTocField, CreateTocFieldCommand);
@@ -36,8 +36,14 @@ export class DialogHyperlinkCommandBase extends ShowDialogCommandBase {
36
36
  var field = this.getState().value;
37
37
  if (field) {
38
38
  var hyperlinkInfo = field.getHyperlinkInfo();
39
- parameters.url = hyperlinkInfo.uri;
40
- parameters.anchor = hyperlinkInfo.anchor;
39
+ if (hyperlinkInfo.isUri()) {
40
+ parameters.url = hyperlinkInfo.getUriWithAnchor();
41
+ parameters.anchor = "";
42
+ }
43
+ else {
44
+ parameters.url = "";
45
+ parameters.anchor = hyperlinkInfo.anchor;
46
+ }
41
47
  parameters.tooltip = hyperlinkInfo.tip;
42
48
  parameters.text = FieldContextMenuHelper.getHyperlinkResultText(options.subDocument, field);
43
49
  }
@@ -50,7 +56,7 @@ export class DialogHyperlinkCommandBase extends ShowDialogCommandBase {
50
56
  if (newParams.tooltip == initParams.tooltip && newParams.url == initParams.url && newParams.anchor == initParams.anchor && newParams.text == initParams.text)
51
57
  return false;
52
58
  var hyperlinkInfo = new HyperlinkInfo(newParams.url, newParams.anchor, newParams.tooltip, false);
53
- if (hyperlinkInfo.anchor == "" && hyperlinkInfo.uri == "")
59
+ if (!hyperlinkInfo.isValid())
54
60
  return false;
55
61
  var modelManipulator = this.modelManipulator;
56
62
  var selection = this.selection;
@@ -72,7 +78,7 @@ export class DialogHyperlinkCommandBase extends ShowDialogCommandBase {
72
78
  }
73
79
  if (initParams.canChangeDisplayText && newParams.text != initParams.text || field.getResultInterval().length == 0) {
74
80
  selection.deprecatedSetSelection(field.getResultStartPosition(), field.getResultEndPosition(), false, selection.keepX, false, false);
75
- this.control.commandManager.getCommand(RichEditClientCommand.InsertText).execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, !newParams.text || newParams.text == "" ? hyperlinkInfo.getUriPlusAnchor() : newParams.text));
81
+ this.control.commandManager.getCommand(RichEditClientCommand.InsertText).execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, !newParams.text || newParams.text == "" ? hyperlinkInfo.getUriWithAnchor() : newParams.text));
76
82
  }
77
83
  history.addAndRedo(new ApplyFieldHyperlinkStyleHistoryItem(modelManipulator, new SubDocumentInterval(this.selection.activeSubDocument, field.getResultInterval())));
78
84
  selection.deprecatedSetSelection(field.getFieldEndPosition(), field.getFieldEndPosition(), false, selection.keepX, false, false);
@@ -47,6 +47,10 @@ export declare class CreateEmptyDocVariableFieldCommand extends CreatePredefined
47
47
  getInsertedText(_parameter: string): string;
48
48
  needUpdate(): boolean;
49
49
  }
50
+ export declare class CreateEmptyIfFieldCommand extends CreatePredefinedFieldCommand {
51
+ getInsertedText(_parameter: string): string;
52
+ needUpdate(): boolean;
53
+ }
50
54
  export declare abstract class CreateTableOfContentCommandBase extends CreatePredefinedFieldCommand {
51
55
  isEnabled(): boolean;
52
56
  getInsertedText(_parameter: string): string;
@@ -170,6 +170,14 @@ export class CreateEmptyDocVariableFieldCommand extends CreatePredefinedFieldCom
170
170
  return false;
171
171
  }
172
172
  }
173
+ export class CreateEmptyIfFieldCommand extends CreatePredefinedFieldCommand {
174
+ getInsertedText(_parameter) {
175
+ return "IF";
176
+ }
177
+ needUpdate() {
178
+ return false;
179
+ }
180
+ }
173
181
  export class CreateTableOfContentCommandBase extends CreatePredefinedFieldCommand {
174
182
  isEnabled() {
175
183
  const currentTocField = FieldCommandHelper.findTocFieldBySelection(this.selection.activeSubDocument, this.selection);