devexpress-richedit 24.1.6-build-24246-0102 → 24.1.6

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.
@@ -10241,8 +10241,10 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
10241
10241
 
10242
10242
  "use strict";
10243
10243
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10244
+ /* harmony export */ EW: function() { return /* binding */ createUrlValidationOptions; },
10244
10245
  /* harmony export */ Ev: function() { return /* binding */ splitByLines; },
10245
10246
  /* harmony export */ Fw: function() { return /* binding */ searchTreeItem; },
10247
+ /* harmony export */ pM: function() { return /* binding */ isUrlValid; },
10246
10248
  /* harmony export */ tm: function() { return /* binding */ convertToFunction; },
10247
10249
  /* harmony export */ xj: function() { return /* binding */ rotatePoint; }
10248
10250
  /* harmony export */ });
@@ -10307,6 +10309,32 @@ function convertToFunction(func) {
10307
10309
  function splitByLines(text) {
10308
10310
  return text ? text.split(/\r\n|\r|\n/) : [''];
10309
10311
  }
10312
+ function createUrlValidationOptions(control) {
10313
+ const fieldSettings = control.modelManager.richOptions.fields;
10314
+ return {
10315
+ allowRelativeUrl: !fieldSettings.disableRelativeHyperlinkUri,
10316
+ allowedProtocols: fieldSettings.allowedHyperlinkUriProtocols
10317
+ };
10318
+ }
10319
+ const disallowedProtocols = [
10320
+ 'data',
10321
+ 'javascript'
10322
+ ];
10323
+ function isUrlValid(url, options) {
10324
+ let currentLocation;
10325
+ if (options === null || options === void 0 ? void 0 : options.allowRelativeUrl)
10326
+ currentLocation = window.location.href;
10327
+ try {
10328
+ const resultUrl = new URL(url, currentLocation);
10329
+ const protocol = resultUrl.protocol.slice(0, -1);
10330
+ const allowedProtocols = options === null || options === void 0 ? void 0 : options.allowedProtocols;
10331
+ if (allowedProtocols)
10332
+ return allowedProtocols.includes(protocol);
10333
+ return !disallowedProtocols.includes(protocol);
10334
+ }
10335
+ catch (_a) { }
10336
+ return false;
10337
+ }
10310
10338
 
10311
10339
 
10312
10340
  /***/ })
@@ -117866,6 +117894,7 @@ class AutoCorrectReplaceInfo {
117866
117894
  class FieldsSettings {
117867
117895
  constructor() {
117868
117896
  this.openHyperlinkOnClick = false;
117897
+ this.disableRelativeHyperlinkUri = false;
117869
117898
  this.updateFieldsBeforePrint = true;
117870
117899
  this.updateFieldsOnPaste = true;
117871
117900
  this.defaultTimeFormat = FieldsSettings.DEFAULT_TIME_FORMAT;
@@ -117890,9 +117919,12 @@ class FieldsSettings {
117890
117919
  this.openHyperlinkOnClick = obj.openHyperlinkOnClick;
117891
117920
  if ((0,common.isDefined)(obj.keepHyperlinkResultForInvalidReference))
117892
117921
  this.keepHyperlinkResultForInvalidReference = obj.keepHyperlinkResultForInvalidReference;
117893
- if ((0,common.isDefined)(obj.createHyperlinkTooltip) && obj.createHyperlinkTooltip !== '') {
117922
+ if ((0,common.isDefined)(obj.createHyperlinkTooltip) && obj.createHyperlinkTooltip !== '')
117894
117923
  this.createHyperlinkTooltip = (0,utils/* convertToFunction */.tm)(obj.createHyperlinkTooltip);
117895
- }
117924
+ if ((0,common.isDefined)(obj.disableRelativeHyperlinkUri))
117925
+ this.disableRelativeHyperlinkUri = obj.disableRelativeHyperlinkUri;
117926
+ if ((0,common.isDefined)(obj.allowedHyperlinkUriProtocols))
117927
+ this.allowedHyperlinkUriProtocols = obj.allowedHyperlinkUriProtocols;
117896
117928
  }
117897
117929
  clone() {
117898
117930
  const result = new FieldsSettings();
@@ -130306,6 +130338,7 @@ class HyperlinkCommandBase extends CommandBase {
130306
130338
 
130307
130339
 
130308
130340
 
130341
+
130309
130342
  class OpenHyperlinkCommand extends HyperlinkCommandBase {
130310
130343
  executeCore(state, options) {
130311
130344
  let field;
@@ -130329,8 +130362,11 @@ class OpenHyperlinkCommand extends HyperlinkCommandBase {
130329
130362
  if (hyperlinkInfo.anchor)
130330
130363
  this.control.commandManager.getCommand(RichEditClientCommand.GoToBookmark)
130331
130364
  .execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, hyperlinkInfo.anchor));
130332
- else if (!(url/* Url */.R.containsClientScript(hyperlinkInfo.uri) || /^\s*data\s*\:\s*/gi.test(hyperlinkInfo.uri)))
130333
- url/* Url */.R.navigate(hyperlinkInfo.uri, "_blank");
130365
+ else {
130366
+ const options = (0,utils/* createUrlValidationOptions */.EW)(this.control);
130367
+ if ((0,utils/* isUrlValid */.pM)(hyperlinkInfo.uri, options))
130368
+ url/* Url */.R.navigate(hyperlinkInfo.uri, "_blank");
130369
+ }
130334
130370
  return true;
130335
130371
  }
130336
130372
  isEnabledInReadOnlyMode() {
@@ -143065,6 +143101,10 @@ class Settings {
143065
143101
  result.fields.createHyperlinkTooltip = this.parseEventHandler(settings.fields.createHyperlinkTooltip);
143066
143102
  if ((0,common.isDefined)(settings.fields.keepHyperlinkResultForInvalidReference))
143067
143103
  result.fields.keepHyperlinkResultForInvalidReference = settings.fields.keepHyperlinkResultForInvalidReference;
143104
+ if ((0,common.isDefined)(settings.fields.disableRelativeHyperlinkUri))
143105
+ result.fields.disableRelativeHyperlinkUri = settings.fields.disableRelativeHyperlinkUri;
143106
+ if ((0,common.isDefined)(settings.fields.allowedHyperlinkUriProtocols))
143107
+ result.fields.allowedHyperlinkUriProtocols = settings.fields.allowedHyperlinkUriProtocols;
143068
143108
  }
143069
143109
  }
143070
143110
  static parsePrintingSettings(settings, result) {
@@ -143799,7 +143839,7 @@ class ClientRichEdit {
143799
143839
  this.contextMenuSettings = settings.contextMenuSettings;
143800
143840
  this.fullScreenHelper = new FullScreenHelper(element);
143801
143841
  if (true)
143802
- external_DevExpress_config_default()(JSON.parse(atob('eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWExcHBaR1pSWjA1WGEyVkxaVmx6U2tJNFdHcFhaeUlLZlE9PS5mL01XY3Z5bDUyTFJMRWlMaEVyYnF1eW5yQ3FEQjdvZ0U1QVgxcGdpMXduSW9sT1MySFluNjBWeDBTb0VJVVpEUGhIRlBSQkdpSzg2cFA1K0xjMG56dUd6RFpEZkVUUS9CeklldjJoNTYzdWc2SzlKMCswMER0eTlvVW1GU2xvRTl6WTdQZz09In0=')));
143842
+ external_DevExpress_config_default()(JSON.parse(atob('eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWNIQktkR3hUTlRaeU1HRjZNV3R4VldwWFNuTXRaeUlLZlE9PS5GSzV0WCtSUkt0akY2Q2NwaExOa0R2V0RCTHVkb0ZrdTN3LzJEMGMxRVlWMXp4KzJEYURkYnA0MGtPbXpKTnBRMXB0TUpiT1NTUm1JVmJaSU5VejRINDE3ejZMTDF4cDRZdWpyL2hQU3RiZlNodkNJMGFmemN4TzhXL1ZaVUJUR2gyZUh6UT09In0=')));
143803
143843
  this.prepareElement(element, settings);
143804
143844
  this.initDefaultFontsAndStyles();
143805
143845
  this.initBars(settings.ribbon, settings.fonts);