For Bug 43992, Bug 57181, Bug 44992

This commit is contained in:
Julia Radzhabova 2022-06-16 20:50:54 +03:00
parent 2db9b044c5
commit 34b3a968d3
6 changed files with 23 additions and 22 deletions

View file

@ -802,13 +802,13 @@ define([
},
onHyperlinkClick: function(url) {
var me = this;
if (url) {
if (me.api.asc_getUrlType(url)>0)
var type = this.api.asc_getUrlType(url);
if (type===AscCommon.c_oAscUrlType.Http || type===AscCommon.c_oAscUrlType.Email)
window.open(url);
else
Common.UI.warning({
msg: me.documentHolder.txtWarnUrl,
msg: this.documentHolder.txtWarnUrl,
buttons: ['yes', 'no'],
primary: 'yes',
callback: function(btn) {

View file

@ -98,6 +98,7 @@ define([
this.options.tpl = _.template(this.template)(this.options);
this.api = this.options.api;
this._originalProps = null;
this.urlType = AscCommon.c_oAscUrlType.Invalid;
Common.UI.Window.prototype.initialize.call(this, this.options);
},
@ -135,9 +136,8 @@ define([
var trimmed = $.trim(value);
if (trimmed.length>2083) return me.txtSizeLimit;
var urltype = me.api.asc_getUrlType(trimmed);
me.isEmail = (urltype==2);
return (urltype>0) ? true : me.txtNotUrl;
me.urlType = me.api.asc_getUrlType(trimmed);
return (me.urlType!==AscCommon.c_oAscUrlType.Invalid) ? true : me.txtNotUrl;
}
});
me.inputUrl._input.on('input', function (e) {
@ -377,8 +377,8 @@ define([
if (type==c_oHyperlinkType.WebLink) {//WebLink
var url = $.trim(me.inputUrl.getValue());
if (! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) )
url = ( (me.isEmail) ? 'mailto:' : 'http://' ) + url;
if (me.urlType!==AscCommon.c_oAscUrlType.Unsafe && ! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) )
url = ( (me.urlType==AscCommon.c_oAscUrlType.Email) ? 'mailto:' : 'http://' ) + url;
url = url.replace(new RegExp("%20",'g')," ");
props.put_Value(url);

View file

@ -759,13 +759,13 @@ define([
},
onHyperlinkClick: function(url) {
var me = this;
if (url) {
if (me.api.asc_getUrlType(url)>0)
var type = this.api.asc_getUrlType(url);
if (type===AscCommon.c_oAscUrlType.Http || type===AscCommon.c_oAscUrlType.Email)
window.open(url);
else
Common.UI.warning({
msg: me.documentHolder.txtWarnUrl,
msg: this.documentHolder.txtWarnUrl,
buttons: ['yes', 'no'],
primary: 'yes',
callback: function(btn) {

View file

@ -100,6 +100,7 @@ define([
this.options.tpl = _.template(this.template)(this.options);
this.slides = this.options.slides;
this.api = this.options.api;
this.urlType = AscCommon.c_oAscUrlType.Invalid;
Common.UI.Window.prototype.initialize.call(this, this.options);
},
@ -137,9 +138,8 @@ define([
var trimmed = $.trim(value);
if (trimmed.length>2083) return me.txtSizeLimit;
var urltype = me.api.asc_getUrlType(trimmed);
me.isEmail = (urltype==2);
return (urltype>0) ? true : me.txtNotUrl;
me.urlType = me.api.asc_getUrlType(trimmed);
return (me.urlType!==AscCommon.c_oAscUrlType.Invalid) ? true : me.txtNotUrl;
}
});
me.inputUrl._input.on('input', function (e) {
@ -236,8 +236,8 @@ define([
def_display = tip;
} else {
var url = $.trim(me.inputUrl.getValue());
if (! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) )
url = ( (me.isEmail) ? 'mailto:' : 'http://' ) + url;
if (me.urlType!==AscCommon.c_oAscUrlType.Unsafe && ! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) )
url = ( (me.urlType==AscCommon.c_oAscUrlType.Email) ? 'mailto:' : 'http://' ) + url;
url = url.replace(new RegExp("%20",'g')," ");
props.put_Value( url );
props.put_ToolTip(me.inputTip.getValue());

View file

@ -1662,7 +1662,8 @@ define([
});
return;
}
if (this.api.asc_getUrlType(url)>0)
var type = this.api.asc_getUrlType(url);
if (type===AscCommon.c_oAscUrlType.Http || type===AscCommon.c_oAscUrlType.Email)
window.open(url, '_blank');
else
Common.UI.warning({

View file

@ -107,6 +107,7 @@ define([
this.api = this.options.api;
this.appOptions = options.appOptions;
this.dataRangeValid = '';
this.urlType = AscCommon.c_oAscUrlType.Invalid;
Common.UI.Window.prototype.initialize.call(this, this.options);
},
@ -144,9 +145,8 @@ define([
var trimmed = $.trim(value);
if (me.api.asc_getFullHyperlinkLength(trimmed)>2083) return me.txtSizeLimit;
var urltype = me.api.asc_getUrlType(trimmed);
me.isEmail = (urltype==2);
return (urltype>0) ? true : me.txtNotUrl;
me.urlType = me.api.asc_getUrlType(trimmed);
return (me.urlType!==AscCommon.c_oAscUrlType.Invalid) ? true : me.txtNotUrl;
}
});
me.inputUrl._input.on('input', function (e) {
@ -326,8 +326,8 @@ define([
}
} else {
var url = this.inputUrl.getValue().replace(/^\s+|\s+$/g,'');
if (! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) )
url = ( (this.isEmail) ? 'mailto:' : 'http://' ) + url;
if (me.urlType!==AscCommon.c_oAscUrlType.Unsafe && ! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) )
url = ( (me.urlType==AscCommon.c_oAscUrlType.Email) ? 'mailto:' : 'http://' ) + url;
url = url.replace(new RegExp("%20",'g')," ");
props.asc_setHyperlinkUrl(url);
def_display = url;