devexpress-richedit 24.1.7-build-24288-0102 → 24.1.7

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.
@@ -10323,6 +10323,12 @@ class UrlUtils {
10323
10323
  catch (_a) { }
10324
10324
  return false;
10325
10325
  }
10326
+ static splitUrlByAnchor(url) {
10327
+ const hashTagPosition = url.indexOf("#");
10328
+ if (hashTagPosition < 0)
10329
+ return [url, ""];
10330
+ return [url.substring(0, hashTagPosition), url.substring(hashTagPosition + 1)];
10331
+ }
10326
10332
  }
10327
10333
  UrlUtils.EmptyPage = "about:blank";
10328
10334
 
@@ -25039,6 +25045,8 @@ class FieldDeletedSubDocumentChange {
25039
25045
  }
25040
25046
  }
25041
25047
 
25048
+ // EXTERNAL MODULE: ./src/common/utils/utils.ts
25049
+ var utils = __webpack_require__(5929);
25042
25050
  ;// CONCATENATED MODULE: ./src/common/model/fields/field.ts
25043
25051
 
25044
25052
 
@@ -25046,6 +25054,7 @@ class FieldDeletedSubDocumentChange {
25046
25054
 
25047
25055
 
25048
25056
 
25057
+
25049
25058
  var FieldNameType;
25050
25059
  (function (FieldNameType) {
25051
25060
  FieldNameType[FieldNameType["None"] = 0] = "None";
@@ -25075,8 +25084,8 @@ class HyperlinkInfo {
25075
25084
  clone() {
25076
25085
  return new HyperlinkInfo(this.uri, this.anchor, this.tip, this.visited);
25077
25086
  }
25078
- getUriPlusAnchor() {
25079
- return this.uri + (this.anchor == "" ? "" : "#" + this.anchor);
25087
+ getUriWithAnchor() {
25088
+ return this.uri + (this.anchor.length > 0 ? "#" + this.anchor : "");
25080
25089
  }
25081
25090
  static getNewCodeText(hyperlinkInfo) {
25082
25091
  return [
@@ -25087,6 +25096,21 @@ class HyperlinkInfo {
25087
25096
  hyperlinkInfo.anchor == "" ? "" : " \\l \"" + hyperlinkInfo.anchor + "\""
25088
25097
  ].join("");
25089
25098
  }
25099
+ isUri() {
25100
+ if (this.uri.length === 0)
25101
+ return false;
25102
+ if (this.uri.startsWith("#"))
25103
+ return false;
25104
+ if (this.isMail())
25105
+ return false;
25106
+ return utils/* UrlUtils */.jE.isValid(this.uri);
25107
+ }
25108
+ isMail() {
25109
+ return this.uri.startsWith("mailto:");
25110
+ }
25111
+ isValid() {
25112
+ return !!(this.uri || this.anchor);
25113
+ }
25090
25114
  }
25091
25115
  class SequenceInfo {
25092
25116
  constructor(identifier, repeats, hidesResult, resets, resetsWith) {
@@ -33625,6 +33649,7 @@ ApplyFieldHyperlinkStyleHistoryItem.mask = CharacterPropertiesMask.UseAll & ~(Ch
33625
33649
 
33626
33650
 
33627
33651
 
33652
+
33628
33653
  class FieldCodeParserHyperlink extends FieldCodeParserClientUpdatingBase {
33629
33654
  get name() { return FieldName.Hyperlink; }
33630
33655
  parseCodeCurrentFieldInternal(_responce) {
@@ -33636,55 +33661,48 @@ class FieldCodeParserHyperlink extends FieldCodeParserClientUpdatingBase {
33636
33661
  return true;
33637
33662
  }
33638
33663
  fillResult() {
33639
- var field = this.getTopField();
33640
- var text = this.parameterInfoList[0] ? this.parameterInfoList[0].text : "";
33641
- var newHyperlinkInfo = this.updateHyperlinkInfo(field, text);
33664
+ var _a, _b;
33665
+ const field = this.getTopField();
33666
+ const text = (_b = (_a = this.parameterInfoList[0]) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : "";
33667
+ const newHyperlinkInfo = this.updateHyperlinkInfo(text);
33642
33668
  if (!newHyperlinkInfo) {
33643
- if (!this.modelManager.richOptions.fields.keepHyperlinkResultForInvalidReference)
33669
+ if (!this.modelManager.richOptions.fields.keepHyperlinkResultForInvalidReference) {
33644
33670
  this.removeInterval(this.getTopField().getResultInterval());
33671
+ }
33645
33672
  return true;
33646
33673
  }
33647
- var modelManipulator = this.modelManager.modelManipulator;
33648
- var resultInterval = field.getResultInterval();
33649
- if (resultInterval.length == 0) {
33650
- var resultText = text.length > 0 ? text : "#" + newHyperlinkInfo.anchor;
33651
- var newResultInterval = new fixed.FixedInterval(resultInterval.start, resultText.length);
33674
+ const modelManipulator = this.modelManager.modelManipulator;
33675
+ const resultInterval = field.getResultInterval();
33676
+ if (resultInterval.length === 0) {
33677
+ const resultText = text !== null && text !== void 0 ? text : "#" + newHyperlinkInfo.anchor;
33678
+ const newResultInterval = new fixed.FixedInterval(resultInterval.start, resultText.length);
33652
33679
  this.setInputPositionState();
33653
33680
  this.replaceTextByInterval(resultInterval, resultText);
33654
- this.modelManager.history.addAndRedo(new ApplyFieldHyperlinkStyleHistoryItem(modelManipulator, new SubDocumentInterval(this.subDocument, newResultInterval)));
33681
+ const subDocumentInterval = new SubDocumentInterval(this.subDocument, newResultInterval);
33682
+ const historyItem = new ApplyFieldHyperlinkStyleHistoryItem(modelManipulator, subDocumentInterval);
33683
+ this.modelManager.history.addAndRedo(historyItem);
33655
33684
  }
33656
- this.modelManager.history.addAndRedo(new ChangeFieldHyperlinkInfoHistoryItem(modelManipulator, this.subDocument, field.index, newHyperlinkInfo));
33685
+ const historyItem = new ChangeFieldHyperlinkInfoHistoryItem(modelManipulator, this.subDocument, field.index, newHyperlinkInfo);
33686
+ this.modelManager.history.addAndRedo(historyItem);
33657
33687
  return true;
33658
33688
  }
33659
- updateHyperlinkInfo(field, text) {
33660
- var newHyperlinkInfo = field.isHyperlinkField() ? field.getHyperlinkInfo().clone() : new HyperlinkInfo("", "", "", false);
33689
+ updateHyperlinkInfo(text) {
33690
+ const newHyperlinkInfo = new HyperlinkInfo("", "", "", false);
33691
+ [newHyperlinkInfo.uri, newHyperlinkInfo.anchor] = utils/* UrlUtils */.jE.splitUrlByAnchor(text);
33661
33692
  newHyperlinkInfo.visited = false;
33662
- var tipSwitch;
33663
- var bookmarkSwitch;
33664
- for (var i = 0, switchInfo; switchInfo = this.switchInfoList[i]; i++)
33665
- if (switchInfo.type == FieldSwitchType.FieldSpecific) {
33666
- switch (switchInfo.name.toLocaleUpperCase()) {
33667
- case "O":
33668
- tipSwitch = switchInfo;
33669
- break;
33670
- case "L":
33671
- bookmarkSwitch = switchInfo;
33672
- break;
33673
- }
33693
+ for (const switchInfo of this.switchInfoList) {
33694
+ if (switchInfo.type != FieldSwitchType.FieldSpecific)
33695
+ continue;
33696
+ switch (switchInfo.name.toLocaleUpperCase()) {
33697
+ case "O":
33698
+ newHyperlinkInfo.tip = switchInfo.arg;
33699
+ break;
33700
+ case "L":
33701
+ newHyperlinkInfo.anchor = switchInfo.arg;
33702
+ break;
33674
33703
  }
33675
- newHyperlinkInfo.tip = tipSwitch ? tipSwitch.arg : "";
33676
- var splitted = text.split("#");
33677
- if (splitted.length == 1) {
33678
- newHyperlinkInfo.uri = splitted[0];
33679
- newHyperlinkInfo.anchor = bookmarkSwitch ? bookmarkSwitch.arg : "";
33680
- if (newHyperlinkInfo.uri == "" && newHyperlinkInfo.anchor == "")
33681
- return null;
33682
33704
  }
33683
- else {
33684
- newHyperlinkInfo.uri = splitted[0];
33685
- newHyperlinkInfo.anchor = splitted[1];
33686
- }
33687
- return newHyperlinkInfo;
33705
+ return newHyperlinkInfo.isValid() ? newHyperlinkInfo : null;
33688
33706
  }
33689
33707
  }
33690
33708
 
@@ -69148,8 +69166,6 @@ class HtmlThTagImporter extends HtmlTdTagImporter {
69148
69166
  }
69149
69167
  }
69150
69168
 
69151
- // EXTERNAL MODULE: ./src/common/utils/utils.ts
69152
- var utils = __webpack_require__(5929);
69153
69169
  ;// CONCATENATED MODULE: ./src/common/formats/html/import/importers/text-node.ts
69154
69170
 
69155
69171
 
@@ -71305,7 +71321,7 @@ class HyperlinkCollection extends Collection {
71305
71321
  subDocument.insertText(field.getCodeInterval().start, HyperlinkInfo.getNewCodeText(info));
71306
71322
  if (canChangeHyperlinkDisplayText && hyperlinkInfo.text || field.getResultInterval().length == 0) {
71307
71323
  subDocument.deleteText(convertToIntervalApi(field.getResultInterval()));
71308
- subDocument.insertText(field.getResultInterval().start, !hyperlinkInfo.text || hyperlinkInfo.text == "" ? info.getUriPlusAnchor() : hyperlinkInfo.text);
71324
+ subDocument.insertText(field.getResultInterval().start, !hyperlinkInfo.text || hyperlinkInfo.text == "" ? info.getUriWithAnchor() : hyperlinkInfo.text);
71309
71325
  }
71310
71326
  this._processor.modelManager.history.addAndRedo(new ApplyFieldHyperlinkStyleHistoryItem(this._processor.modelManager.modelManipulator, new SubDocumentInterval(this._subDocument, field.getResultInterval())));
71311
71327
  this._processor.modelManager.history.endTransaction();
@@ -128145,8 +128161,14 @@ class DialogHyperlinkCommandBase extends ShowDialogCommandBase {
128145
128161
  var field = this.getState().value;
128146
128162
  if (field) {
128147
128163
  var hyperlinkInfo = field.getHyperlinkInfo();
128148
- parameters.url = hyperlinkInfo.uri;
128149
- parameters.anchor = hyperlinkInfo.anchor;
128164
+ if (hyperlinkInfo.isUri()) {
128165
+ parameters.url = hyperlinkInfo.getUriWithAnchor();
128166
+ parameters.anchor = "";
128167
+ }
128168
+ else {
128169
+ parameters.url = "";
128170
+ parameters.anchor = hyperlinkInfo.anchor;
128171
+ }
128150
128172
  parameters.tooltip = hyperlinkInfo.tip;
128151
128173
  parameters.text = FieldContextMenuHelper.getHyperlinkResultText(options.subDocument, field);
128152
128174
  }
@@ -128159,7 +128181,7 @@ class DialogHyperlinkCommandBase extends ShowDialogCommandBase {
128159
128181
  if (newParams.tooltip == initParams.tooltip && newParams.url == initParams.url && newParams.anchor == initParams.anchor && newParams.text == initParams.text)
128160
128182
  return false;
128161
128183
  var hyperlinkInfo = new HyperlinkInfo(newParams.url, newParams.anchor, newParams.tooltip, false);
128162
- if (hyperlinkInfo.anchor == "" && hyperlinkInfo.uri == "")
128184
+ if (!hyperlinkInfo.isValid())
128163
128185
  return false;
128164
128186
  var modelManipulator = this.modelManipulator;
128165
128187
  var selection = this.selection;
@@ -128181,7 +128203,7 @@ class DialogHyperlinkCommandBase extends ShowDialogCommandBase {
128181
128203
  }
128182
128204
  if (initParams.canChangeDisplayText && newParams.text != initParams.text || field.getResultInterval().length == 0) {
128183
128205
  selection.deprecatedSetSelection(field.getResultStartPosition(), field.getResultEndPosition(), false, selection.keepX, false, false);
128184
- this.control.commandManager.getCommand(RichEditClientCommand.InsertText).execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, !newParams.text || newParams.text == "" ? hyperlinkInfo.getUriPlusAnchor() : newParams.text));
128206
+ this.control.commandManager.getCommand(RichEditClientCommand.InsertText).execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, !newParams.text || newParams.text == "" ? hyperlinkInfo.getUriWithAnchor() : newParams.text));
128185
128207
  }
128186
128208
  history.addAndRedo(new ApplyFieldHyperlinkStyleHistoryItem(modelManipulator, new SubDocumentInterval(this.selection.activeSubDocument, field.getResultInterval())));
128187
128209
  selection.deprecatedSetSelection(field.getFieldEndPosition(), field.getFieldEndPosition(), false, selection.keepX, false, false);
@@ -130311,7 +130333,7 @@ class GoToLastDataRecordCommand extends GoToRecordCommandBase {
130311
130333
  }
130312
130334
 
130313
130335
  // EXTERNAL MODULE: ./node_modules/@devexpress/utils/lib/utils/url.js
130314
- var utils_url = __webpack_require__(6795);
130336
+ var url = __webpack_require__(6795);
130315
130337
  ;// CONCATENATED MODULE: ./src/common/commands/fields/hyperlink-command-base.ts
130316
130338
 
130317
130339
 
@@ -130358,12 +130380,15 @@ class OpenHyperlinkCommand extends HyperlinkCommandBase {
130358
130380
  this.history.endTransaction();
130359
130381
  this.aspxForceSendingRequest();
130360
130382
  }
130361
- if (hyperlinkInfo.anchor)
130383
+ if (hyperlinkInfo.isUri()) {
130384
+ let uri = hyperlinkInfo.getUriWithAnchor();
130385
+ if (!utils/* UrlUtils */.jE.isValid(uri))
130386
+ uri = utils/* UrlUtils */.jE.EmptyPage;
130387
+ url/* Url */.R.navigate(uri, "_blank");
130388
+ }
130389
+ else {
130362
130390
  this.control.commandManager.getCommand(RichEditClientCommand.GoToBookmark)
130363
130391
  .execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, hyperlinkInfo.anchor));
130364
- else {
130365
- const url = utils/* UrlUtils */.jE.isValid(hyperlinkInfo.uri) ? hyperlinkInfo.uri : utils/* UrlUtils */.jE.EmptyPage;
130366
- utils_url/* Url */.R.navigate(url, "_blank");
130367
130392
  }
130368
130393
  return true;
130369
130394
  }
@@ -141436,6 +141461,7 @@ class FontDialog extends DialogBase {
141436
141461
  ;// CONCATENATED MODULE: ./src/client/dialogs/hyperlink-dialog.ts
141437
141462
 
141438
141463
 
141464
+
141439
141465
  class HyperlinkDialog extends DialogBase {
141440
141466
  constructor() {
141441
141467
  super(...arguments);
@@ -141582,13 +141608,19 @@ class HyperlinkDialog extends DialogBase {
141582
141608
  parameters.text = data.text;
141583
141609
  parameters.tooltip = data.tooltip;
141584
141610
  const tabPanelSelectedIndex = this.tabPanel.option('selectedIndex');
141585
- if (tabPanelSelectedIndex == 0)
141586
- parameters.url = data.url;
141587
- else if (tabPanelSelectedIndex == 1)
141588
- parameters.anchor = data.anchor;
141611
+ if (tabPanelSelectedIndex == 0) {
141612
+ [parameters.url, parameters.anchor] = utils/* UrlUtils */.jE.splitUrlByAnchor(data.url);
141613
+ }
141589
141614
  else {
141590
- const subject = data.subject ? this.subjectPrefix + data.subject : '';
141591
- parameters.url = this.mailtoPrefix + data.email + subject;
141615
+ if (tabPanelSelectedIndex == 1) {
141616
+ parameters.url = "";
141617
+ parameters.anchor = data.anchor;
141618
+ }
141619
+ else {
141620
+ const subject = data.subject ? this.subjectPrefix + data.subject : '';
141621
+ parameters.url = this.mailtoPrefix + data.email + subject;
141622
+ parameters.anchor = "";
141623
+ }
141592
141624
  }
141593
141625
  }
141594
141626
  }
@@ -143833,7 +143865,7 @@ class ClientRichEdit {
143833
143865
  this.contextMenuSettings = settings.contextMenuSettings;
143834
143866
  this.fullScreenHelper = new FullScreenHelper(element);
143835
143867
  if (true)
143836
- external_DevExpress_config_default()(JSON.parse(atob('eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWNIQktkR3hUTlRaeU1HRjZNV3R4VldwWFNuTXRaeUlLZlE9PS5GSzV0WCtSUkt0akY2Q2NwaExOa0R2V0RCTHVkb0ZrdTN3LzJEMGMxRVlWMXp4KzJEYURkYnA0MGtPbXpKTnBRMXB0TUpiT1NTUm1JVmJaSU5VejRINDE3ejZMTDF4cDRZdWpyL2hQU3RiZlNodkNJMGFmemN4TzhXL1ZaVUJUR2gyZUh6UT09In0=')));
143868
+ external_DevExpress_config_default()(JSON.parse(atob('eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWNsQXpXRVkxYm5aUmEyRjVjRTk1UWt4d2RXTlVRU0lLZlE9PS5mRVhyTm1adGMwdWRsdzlOa3hheDBPejFzTEdNU0RwUHBXWGhVdEllc0xvU21lMVhxTC9jZWw2QUtMVVFjVFJERURuN0dRM1k0ZzVMRTlVSGJsK0lUM09zbmpOZnBxYS9nTFY2bmpHbWt2NytLQnVvWWtyTE9LbGtyQjRWQ00rVVZYdDNKZz09In0=')));
143837
143869
  this.prepareElement(element, settings);
143838
143870
  this.initDefaultFontsAndStyles();
143839
143871
  this.initBars(settings.ribbon, settings.fonts);
@@ -144364,11 +144396,11 @@ class ClientRichEdit {
144364
144396
  return this.barHolder.ribbon;
144365
144397
  }
144366
144398
  getLinkType(hyperlinkInfo) {
144367
- if (hyperlinkInfo.anchor)
144368
- return DocumentLinkType.Bookmark;
144369
- if (hyperlinkInfo.uri && hyperlinkInfo.uri.substr(0, 7) === "mailto:")
144399
+ if (hyperlinkInfo.isMail())
144370
144400
  return DocumentLinkType.EmailAddress;
144371
- return DocumentLinkType.Hyperlink;
144401
+ if (hyperlinkInfo.isUri())
144402
+ return DocumentLinkType.Hyperlink;
144403
+ return DocumentLinkType.Bookmark;
144372
144404
  }
144373
144405
  setFullScreenMode() {
144374
144406
  this.fullScreenHelper.prepareFullScreenMode();