Limit url size to 2084 characters

This commit is contained in:
Julia Radzhabova 2021-03-26 23:54:37 +03:00
parent 0b3d221b5b
commit 42633b97d5
6 changed files with 21 additions and 6 deletions

View file

@ -132,7 +132,10 @@ define([
style : 'width: 100%;',
validateOnBlur: false,
validation : function(value) {
var urltype = me.api.asc_getUrlType($.trim(value));
var trimmed = $.trim(value);
if (trimmed.length>2084) return me.txtSizeLimit;
var urltype = me.api.asc_getUrlType(trimmed);
me.isEmail = (urltype==2);
return (urltype>0) ? true : me.txtNotUrl;
}
@ -455,6 +458,7 @@ define([
textInternal: 'Place in Document',
txtBeginning: 'Beginning of document',
txtHeadings: 'Headings',
txtBookmarks: 'Bookmarks'
txtBookmarks: 'Bookmarks',
txtSizeLimit: 'This field is limited to 2084 characters'
}, DE.Views.HyperlinkSettingsDialog || {}))
});

View file

@ -1806,6 +1806,7 @@
"DE.Views.HyperlinkSettingsDialog.txtEmpty": "This field is required",
"DE.Views.HyperlinkSettingsDialog.txtHeadings": "Headings",
"DE.Views.HyperlinkSettingsDialog.txtNotUrl": "This field should be a URL in the \"http://www.example.com\" format",
"DE.Views.HyperlinkSettingsDialog.txtSizeLimit": "This field is limited to 2084 characters",
"DE.Views.ImageSettings.textAdvanced": "Show advanced settings",
"DE.Views.ImageSettings.textCrop": "Crop",
"DE.Views.ImageSettings.textCropFill": "Fill",

View file

@ -134,7 +134,10 @@ define([
validateOnBlur: false,
style : 'width: 100%;',
validation : function(value) {
var urltype = me.api.asc_getUrlType($.trim(value));
var trimmed = $.trim(value);
if (trimmed.length>2084) return me.txtSizeLimit;
var urltype = me.api.asc_getUrlType(trimmed);
me.isEmail = (urltype==2);
return (urltype>0) ? true : me.txtNotUrl;
}
@ -437,6 +440,7 @@ define([
txtFirst: 'First Slide',
txtLast: 'Last Slide',
textDefault: 'Selected text',
textSlides: 'Slides'
textSlides: 'Slides',
txtSizeLimit: 'This field is limited to 2084 characters'
}, PE.Views.HyperlinkSettingsDialog || {}))
});

View file

@ -1387,6 +1387,7 @@
"PE.Views.HyperlinkSettingsDialog.txtLast": "Last Slide",
"PE.Views.HyperlinkSettingsDialog.txtNext": "Next Slide",
"PE.Views.HyperlinkSettingsDialog.txtNotUrl": "This field should be a URL in the \"http://www.example.com\" format",
"PE.Views.HyperlinkSettingsDialog.txtSizeLimit": "This field is limited to 2084 characters",
"PE.Views.HyperlinkSettingsDialog.txtPrev": "Previous Slide",
"PE.Views.HyperlinkSettingsDialog.txtSlide": "Slide",
"PE.Views.ImageSettings.textAdvanced": "Show advanced settings",

View file

@ -141,7 +141,10 @@ define([
validateOnBlur: false,
style : 'width: 100%;',
validation : function(value) {
var urltype = me.api.asc_getUrlType($.trim(value));
var trimmed = $.trim(value);
if (trimmed.length>2084) return me.txtSizeLimit;
var urltype = me.api.asc_getUrlType(trimmed);
me.isEmail = (urltype==2);
return (urltype>0) ? true : me.txtNotUrl;
}
@ -561,6 +564,7 @@ define([
textNames: 'Defined names',
textGetLink: 'Get Link',
textCopy: 'Copy',
textSelectData: 'Select data'
textSelectData: 'Select data',
txtSizeLimit: 'This field is limited to 2084 characters'
}, SSE.Views.HyperlinkSettingsDialog || {}))
});

View file

@ -2076,6 +2076,7 @@
"SSE.Views.HyperlinkSettingsDialog.textTitle": "Hyperlink Settings",
"SSE.Views.HyperlinkSettingsDialog.txtEmpty": "This field is required",
"SSE.Views.HyperlinkSettingsDialog.txtNotUrl": "This field should be a URL in the \"http://www.example.com\" format",
"SSE.Views.HyperlinkSettingsDialog.txtSizeLimit": "This field is limited to 2084 characters",
"SSE.Views.ImageSettings.textAdvanced": "Show advanced settings",
"SSE.Views.ImageSettings.textCrop": "Crop",
"SSE.Views.ImageSettings.textCropFill": "Fill",