Hyperlink: autofill for display field
This commit is contained in:
parent
ff8ce10fcd
commit
395edff003
|
@ -140,7 +140,9 @@ define([
|
|||
me.inputUrl._input.on('input', function (e) {
|
||||
me.isInputFirstChange && me.inputUrl.showError();
|
||||
me.isInputFirstChange = false;
|
||||
me.btnOk.setDisabled($.trim($(e.target).val())=='');
|
||||
var val = $(e.target).val();
|
||||
me.isAutoUpdate && me.inputDisplay.setValue(val);
|
||||
me.btnOk.setDisabled($.trim(val)=='');
|
||||
});
|
||||
|
||||
me.inputDisplay = new Common.UI.InputField({
|
||||
|
@ -151,6 +153,9 @@ define([
|
|||
}).on('changed:after', function() {
|
||||
me.isTextChanged = true;
|
||||
});
|
||||
me.inputDisplay._input.on('input', function (e) {
|
||||
me.isAutoUpdate = ($(e.target).val()=='');
|
||||
});
|
||||
|
||||
me.inputTip = new Common.UI.InputField({
|
||||
el : $('#id-dlg-hyperlink-tip'),
|
||||
|
@ -267,10 +272,19 @@ define([
|
|||
|
||||
onLinkTypeClick: function(type, btn, event) {
|
||||
this.ShowHideElem(type);
|
||||
if (this.isAutoUpdate) {
|
||||
if (type==c_oHyperlinkType.InternalLink) {
|
||||
var rec = this.internalList.getSelectedRec();
|
||||
this.inputDisplay.setValue(rec && (rec.get('level') || rec.get('index')==0)? rec.get('name') : '');
|
||||
} else {
|
||||
this.inputDisplay.setValue(this.inputUrl.getValue());
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onSelectItem: function(picker, item, record, e){
|
||||
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') : '');
|
||||
},
|
||||
|
||||
show: function() {
|
||||
|
@ -322,6 +336,7 @@ define([
|
|||
if (props.get_Text() !== null) {
|
||||
me.inputDisplay.setValue(props.get_Text());
|
||||
me.inputDisplay.setDisabled(false);
|
||||
me.isAutoUpdate = (me.inputDisplay.getValue()=='');
|
||||
} else {
|
||||
me.inputDisplay.setValue(this.textDefault);
|
||||
me.inputDisplay.setDisabled(true);
|
||||
|
|
|
@ -142,7 +142,9 @@ define([
|
|||
me.inputUrl._input.on('input', function (e) {
|
||||
me.isInputFirstChange && me.inputUrl.showError();
|
||||
me.isInputFirstChange = false;
|
||||
me.btnOk.setDisabled($.trim($(e.target).val())=='');
|
||||
var val = $(e.target).val();
|
||||
me.isAutoUpdate && me.inputDisplay.setValue(val);
|
||||
me.btnOk.setDisabled($.trim(val)=='');
|
||||
});
|
||||
|
||||
me.inputDisplay = new Common.UI.InputField({
|
||||
|
@ -153,6 +155,9 @@ define([
|
|||
}).on('changed:after', function() {
|
||||
me.isTextChanged = true;
|
||||
});
|
||||
me.inputDisplay._input.on('input', function (e) {
|
||||
me.isAutoUpdate = ($(e.target).val()=='');
|
||||
});
|
||||
|
||||
me.inputTip = new Common.UI.InputField({
|
||||
el : $('#id-dlg-hyperlink-tip'),
|
||||
|
@ -189,6 +194,7 @@ define([
|
|||
if (props.get_Text()!==null) {
|
||||
me.inputDisplay.setValue(props.get_Text());
|
||||
me.inputDisplay.setDisabled(false);
|
||||
me.isAutoUpdate = (me.inputDisplay.getValue()=='');
|
||||
} else {
|
||||
this.inputDisplay.setValue(this.textDefault);
|
||||
this.inputDisplay.setDisabled(true);
|
||||
|
@ -367,6 +373,14 @@ define([
|
|||
|
||||
onLinkTypeClick: function(type, btn, event) {
|
||||
this.ShowHideElem(type);
|
||||
if (this.isAutoUpdate) {
|
||||
if (type==c_oHyperlinkType.InternalLink) {
|
||||
var rec = this.internalList.getSelectedRec();
|
||||
this.inputDisplay.setValue(rec && (rec.get('level') || rec.get('index')<4) ? rec.get('name') : '');
|
||||
} else {
|
||||
this.inputDisplay.setValue(this.inputUrl.getValue());
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
parseUrl: function(url) {
|
||||
|
@ -385,6 +399,7 @@ define([
|
|||
|
||||
onSelectItem: function(picker, item, record, e){
|
||||
this.btnOk.setDisabled(record.get('index')==4);
|
||||
this.isAutoUpdate && this.inputDisplay.setValue((record.get('level') || record.get('index')<4) ? record.get('name') : '');
|
||||
},
|
||||
|
||||
textTitle: 'Hyperlink Settings',
|
||||
|
|
|
@ -137,7 +137,9 @@ define([
|
|||
me.inputUrl._input.on('input', function (e) {
|
||||
me.isInputFirstChange_url && me.inputUrl.showError();
|
||||
me.isInputFirstChange_url = false;
|
||||
me.btnOk.setDisabled($.trim($(e.target).val())=='');
|
||||
var val = $(e.target).val();
|
||||
me.isAutoUpdate && me.inputDisplay.setValue(val);
|
||||
me.btnOk.setDisabled($.trim(val)=='');
|
||||
});
|
||||
|
||||
me.inputRange = new Common.UI.InputField({
|
||||
|
@ -162,7 +164,9 @@ define([
|
|||
me.inputRange._input.on('input', function (e) {
|
||||
me.isInputFirstChange_range && me.inputRange.showError();
|
||||
me.isInputFirstChange_range = false;
|
||||
me.btnOk.setDisabled($.trim($(e.target).val())=='');
|
||||
var val = $(e.target).val();
|
||||
me.isAutoUpdate && me.inputDisplay.setValue(me.internalList.getSelectedRec().get('name') + (val!=='' ? '!' + val : ''));
|
||||
me.btnOk.setDisabled($.trim(val)=='');
|
||||
});
|
||||
|
||||
me.inputDisplay = new Common.UI.InputField({
|
||||
|
@ -171,6 +175,9 @@ define([
|
|||
validateOnBlur: false,
|
||||
style : 'width: 100%;'
|
||||
});
|
||||
me.inputDisplay._input.on('input', function (e) {
|
||||
me.isAutoUpdate = ($(e.target).val()=='');
|
||||
});
|
||||
|
||||
me.inputTip = new Common.UI.InputField({
|
||||
el : $('#id-dlg-hyperlink-tip'),
|
||||
|
@ -236,6 +243,7 @@ define([
|
|||
this.inputTip.setValue(settings.props.asc_getTooltip());
|
||||
}
|
||||
this.inputDisplay.setDisabled(settings.isLock);
|
||||
!settings.isLock && (this.isAutoUpdate = (this.inputDisplay.getValue()==''));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -389,11 +397,35 @@ define([
|
|||
|
||||
onLinkTypeClick: function(type, btn, event) {
|
||||
this.ShowHideElem(type);
|
||||
if (this.isAutoUpdate) {
|
||||
if (type==Asc.c_oAscHyperlinkType.RangeLink) {
|
||||
var rec = this.internalList.getSelectedRec(),
|
||||
list = rec && rec.get('level') ? rec.get('name') : '';
|
||||
if (rec && rec.get('type')==1) {
|
||||
this.inputDisplay.setValue(list);
|
||||
} else {
|
||||
var val = this.inputRange.getValue();
|
||||
this.inputDisplay.setValue(list + (list!=='' || val!=='' ? '!' : '') + val);
|
||||
}
|
||||
|
||||
} else {
|
||||
this.inputDisplay.setValue(this.inputUrl.getValue());
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onSelectItem: function(picker, item, record, e){
|
||||
this.btnOk.setDisabled(record.get('level')==0 || record.get('type')==0 && $.trim(this.inputRange.getValue())=='');
|
||||
this.inputRange.setDisabled(record.get('type')==1 || record.get('level')==0);
|
||||
if (this.isAutoUpdate) {
|
||||
var list = record.get('level') ? record.get('name') : '';
|
||||
if (record.get('type')==1) {
|
||||
this.inputDisplay.setValue(list);
|
||||
} else {
|
||||
var val = this.inputRange.getValue();
|
||||
this.inputDisplay.setValue(list + ((list!=='' && val!=='') ? '!' : '') + val);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
textTitle: 'Hyperlink Settings',
|
||||
|
|
Loading…
Reference in a new issue