Bug 44386: external link is equal to display field
This commit is contained in:
parent
395edff003
commit
5b30dad42b
apps
documenteditor/main/app/view
presentationeditor/main/app/view
spreadsheeteditor/main/app/view
|
@ -141,7 +141,10 @@ define([
|
||||||
me.isInputFirstChange && me.inputUrl.showError();
|
me.isInputFirstChange && me.inputUrl.showError();
|
||||||
me.isInputFirstChange = false;
|
me.isInputFirstChange = false;
|
||||||
var val = $(e.target).val();
|
var val = $(e.target).val();
|
||||||
me.isAutoUpdate && me.inputDisplay.setValue(val);
|
if (me.isAutoUpdate) {
|
||||||
|
me.inputDisplay.setValue(val);
|
||||||
|
me.isTextChanged = true;
|
||||||
|
}
|
||||||
me.btnOk.setDisabled($.trim(val)=='');
|
me.btnOk.setDisabled($.trim(val)=='');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -279,12 +282,16 @@ define([
|
||||||
} else {
|
} else {
|
||||||
this.inputDisplay.setValue(this.inputUrl.getValue());
|
this.inputDisplay.setValue(this.inputUrl.getValue());
|
||||||
}
|
}
|
||||||
|
this.isTextChanged = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelectItem: function(picker, item, record, e){
|
onSelectItem: function(picker, item, record, e){
|
||||||
this.btnOk.setDisabled(record.get('level')==0 && record.get('index')>0);
|
this.btnOk.setDisabled(record.get('level')==0 && record.get('index')>0);
|
||||||
this.isAutoUpdate && this.inputDisplay.setValue((record.get('level') || record.get('index')==0) ? record.get('name') : '');
|
if (this.isAutoUpdate) {
|
||||||
|
this.inputDisplay.setValue((record.get('level') || record.get('index')==0) ? record.get('name') : '');
|
||||||
|
this.isTextChanged = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function() {
|
show: function() {
|
||||||
|
@ -336,7 +343,7 @@ define([
|
||||||
if (props.get_Text() !== null) {
|
if (props.get_Text() !== null) {
|
||||||
me.inputDisplay.setValue(props.get_Text());
|
me.inputDisplay.setValue(props.get_Text());
|
||||||
me.inputDisplay.setDisabled(false);
|
me.inputDisplay.setDisabled(false);
|
||||||
me.isAutoUpdate = (me.inputDisplay.getValue()=='');
|
me.isAutoUpdate = (me.inputDisplay.getValue()=='' || type == c_oHyperlinkType.WebLink && me.inputUrl.getValue()==me.inputDisplay.getValue());
|
||||||
} else {
|
} else {
|
||||||
me.inputDisplay.setValue(this.textDefault);
|
me.inputDisplay.setValue(this.textDefault);
|
||||||
me.inputDisplay.setDisabled(true);
|
me.inputDisplay.setDisabled(true);
|
||||||
|
@ -352,9 +359,10 @@ define([
|
||||||
getSettings: function () {
|
getSettings: function () {
|
||||||
var me = this,
|
var me = this,
|
||||||
props = new Asc.CHyperlinkProperty(),
|
props = new Asc.CHyperlinkProperty(),
|
||||||
display = '';
|
display = '',
|
||||||
|
type = this.btnExternal.isActive() ? c_oHyperlinkType.WebLink : c_oHyperlinkType.InternalLink;
|
||||||
|
|
||||||
if (this.btnExternal.isActive()) {//WebLink
|
if (type==c_oHyperlinkType.WebLink) {//WebLink
|
||||||
var url = $.trim(me.inputUrl.getValue());
|
var url = $.trim(me.inputUrl.getValue());
|
||||||
|
|
||||||
if (! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) )
|
if (! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) )
|
||||||
|
@ -377,8 +385,8 @@ define([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!me.inputDisplay.isDisabled() && ( this.isTextChanged || _.isEmpty(me.inputDisplay.getValue()))) {
|
if (!me.inputDisplay.isDisabled() && ( me.isTextChanged || _.isEmpty(me.inputDisplay.getValue()))) {
|
||||||
if (_.isEmpty(me.inputDisplay.getValue()))
|
if (_.isEmpty(me.inputDisplay.getValue()) || type==c_oHyperlinkType.WebLink && me.isAutoUpdate)
|
||||||
me.inputDisplay.setValue(display);
|
me.inputDisplay.setValue(display);
|
||||||
props.put_Text(me.inputDisplay.getValue());
|
props.put_Text(me.inputDisplay.getValue());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -143,7 +143,10 @@ define([
|
||||||
me.isInputFirstChange && me.inputUrl.showError();
|
me.isInputFirstChange && me.inputUrl.showError();
|
||||||
me.isInputFirstChange = false;
|
me.isInputFirstChange = false;
|
||||||
var val = $(e.target).val();
|
var val = $(e.target).val();
|
||||||
me.isAutoUpdate && me.inputDisplay.setValue(val);
|
if (me.isAutoUpdate) {
|
||||||
|
me.inputDisplay.setValue(val);
|
||||||
|
me.isTextChanged = true;
|
||||||
|
}
|
||||||
me.btnOk.setDisabled($.trim(val)=='');
|
me.btnOk.setDisabled($.trim(val)=='');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -194,7 +197,7 @@ define([
|
||||||
if (props.get_Text()!==null) {
|
if (props.get_Text()!==null) {
|
||||||
me.inputDisplay.setValue(props.get_Text());
|
me.inputDisplay.setValue(props.get_Text());
|
||||||
me.inputDisplay.setDisabled(false);
|
me.inputDisplay.setDisabled(false);
|
||||||
me.isAutoUpdate = (me.inputDisplay.getValue()=='');
|
me.isAutoUpdate = (me.inputDisplay.getValue()=='' || type == c_oHyperlinkType.WebLink && me.inputUrl.getValue()==me.inputDisplay.getValue());
|
||||||
} else {
|
} else {
|
||||||
this.inputDisplay.setValue(this.textDefault);
|
this.inputDisplay.setValue(this.textDefault);
|
||||||
this.inputDisplay.setDisabled(true);
|
this.inputDisplay.setDisabled(true);
|
||||||
|
@ -213,8 +216,9 @@ define([
|
||||||
getSettings: function () {
|
getSettings: function () {
|
||||||
var me = this,
|
var me = this,
|
||||||
props = new Asc.CHyperlinkProperty();
|
props = new Asc.CHyperlinkProperty();
|
||||||
var def_display = '';
|
var def_display = '',
|
||||||
if (this.btnInternal.isActive()) {//InternalLink
|
type = this.btnExternal.isActive() ? c_oHyperlinkType.WebLink : c_oHyperlinkType.InternalLink;
|
||||||
|
if (type==c_oHyperlinkType.InternalLink) {//InternalLink
|
||||||
var url = "ppaction://hlink";
|
var url = "ppaction://hlink";
|
||||||
var tip = '';
|
var tip = '';
|
||||||
var txttip = me.inputTip.getValue();
|
var txttip = me.inputTip.getValue();
|
||||||
|
@ -237,7 +241,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!me.inputDisplay.isDisabled() && (me.isTextChanged || _.isEmpty(me.inputDisplay.getValue()))) {
|
if (!me.inputDisplay.isDisabled() && (me.isTextChanged || _.isEmpty(me.inputDisplay.getValue()))) {
|
||||||
if (_.isEmpty(me.inputDisplay.getValue()))
|
if (_.isEmpty(me.inputDisplay.getValue()) || type==c_oHyperlinkType.WebLink && me.isAutoUpdate)
|
||||||
me.inputDisplay.setValue(def_display);
|
me.inputDisplay.setValue(def_display);
|
||||||
props.put_Text(me.inputDisplay.getValue());
|
props.put_Text(me.inputDisplay.getValue());
|
||||||
}
|
}
|
||||||
|
@ -380,6 +384,7 @@ define([
|
||||||
} else {
|
} else {
|
||||||
this.inputDisplay.setValue(this.inputUrl.getValue());
|
this.inputDisplay.setValue(this.inputUrl.getValue());
|
||||||
}
|
}
|
||||||
|
this.isTextChanged = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -399,7 +404,10 @@ define([
|
||||||
|
|
||||||
onSelectItem: function(picker, item, record, e){
|
onSelectItem: function(picker, item, record, e){
|
||||||
this.btnOk.setDisabled(record.get('index')==4);
|
this.btnOk.setDisabled(record.get('index')==4);
|
||||||
this.isAutoUpdate && this.inputDisplay.setValue((record.get('level') || record.get('index')<4) ? record.get('name') : '');
|
if (this.isAutoUpdate) {
|
||||||
|
this.inputDisplay.setValue((record.get('level') || record.get('index')<4) ? record.get('name') : '');
|
||||||
|
this.isTextChanged = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
textTitle: 'Hyperlink Settings',
|
textTitle: 'Hyperlink Settings',
|
||||||
|
|
|
@ -243,16 +243,17 @@ define([
|
||||||
this.inputTip.setValue(settings.props.asc_getTooltip());
|
this.inputTip.setValue(settings.props.asc_getTooltip());
|
||||||
}
|
}
|
||||||
this.inputDisplay.setDisabled(settings.isLock);
|
this.inputDisplay.setDisabled(settings.isLock);
|
||||||
!settings.isLock && (this.isAutoUpdate = (this.inputDisplay.getValue()==''));
|
!settings.isLock && (this.isAutoUpdate = (this.inputDisplay.getValue()=='' || type == Asc.c_oAscHyperlinkType.WebLink && me.inputUrl.getValue()==me.inputDisplay.getValue()));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getSettings: function() {
|
getSettings: function() {
|
||||||
var props = new Asc.asc_CHyperlink(),
|
var props = new Asc.asc_CHyperlink(),
|
||||||
def_display = "";
|
def_display = "",
|
||||||
props.asc_setType(this.btnInternal.isActive() ? Asc.c_oAscHyperlinkType.RangeLink : Asc.c_oAscHyperlinkType.WebLink);
|
type = this.btnInternal.isActive() ? Asc.c_oAscHyperlinkType.RangeLink : Asc.c_oAscHyperlinkType.WebLink;
|
||||||
|
props.asc_setType(type);
|
||||||
|
|
||||||
if (this.btnInternal.isActive()) {
|
if (type==Asc.c_oAscHyperlinkType.RangeLink) {
|
||||||
var rec = this.internalList.getSelectedRec();
|
var rec = this.internalList.getSelectedRec();
|
||||||
if (rec && rec.get('level')>0) {
|
if (rec && rec.get('level')>0) {
|
||||||
if (rec.get('type')) {// named range
|
if (rec.get('type')) {// named range
|
||||||
|
@ -277,7 +278,7 @@ define([
|
||||||
if (this.inputDisplay.isDisabled())
|
if (this.inputDisplay.isDisabled())
|
||||||
props.asc_setText(null);
|
props.asc_setText(null);
|
||||||
else {
|
else {
|
||||||
if (_.isEmpty(this.inputDisplay.getValue()))
|
if (_.isEmpty(this.inputDisplay.getValue()) || type==Asc.c_oAscHyperlinkType.WebLink && this.isAutoUpdate)
|
||||||
this.inputDisplay.setValue(def_display);
|
this.inputDisplay.setValue(def_display);
|
||||||
props.asc_setText(this.inputDisplay.getValue());
|
props.asc_setText(this.inputDisplay.getValue());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue