[SSE] Add focus manager for hyperlink settings
This commit is contained in:
parent
147509b246
commit
edbf198ed8
|
@ -55,7 +55,8 @@ define([
|
||||||
width : 350,
|
width : 350,
|
||||||
style : 'min-width: 230px;',
|
style : 'min-width: 230px;',
|
||||||
cls : 'modal-dlg',
|
cls : 'modal-dlg',
|
||||||
buttons: ['ok', 'cancel']
|
buttons: ['ok', 'cancel'],
|
||||||
|
focusManager: true
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize : function(options) {
|
initialize : function(options) {
|
||||||
|
@ -202,6 +203,7 @@ define([
|
||||||
me.internalList = new Common.UI.TreeView({
|
me.internalList = new Common.UI.TreeView({
|
||||||
el: $('#id-dlg-hyperlink-list'),
|
el: $('#id-dlg-hyperlink-list'),
|
||||||
store: new Common.UI.TreeViewStore(),
|
store: new Common.UI.TreeViewStore(),
|
||||||
|
tabindex: 1,
|
||||||
enableKeyEvents: true
|
enableKeyEvents: true
|
||||||
});
|
});
|
||||||
me.internalList.on('item:select', _.bind(this.onSelectItem, this));
|
me.internalList.on('item:select', _.bind(this.onSelectItem, this));
|
||||||
|
@ -248,15 +250,14 @@ define([
|
||||||
|
|
||||||
me.externalPanel = $window.find('#id-external-link');
|
me.externalPanel = $window.find('#id-external-link');
|
||||||
me.internalPanel = $window.find('#id-internal-link');
|
me.internalPanel = $window.find('#id-internal-link');
|
||||||
|
|
||||||
|
this.focusManager.add(this.inputUrl, '.form-control');
|
||||||
|
this.focusManager.add(this.internalList, '.treeview');
|
||||||
|
this.focusManager.add([this.inputRange, this.inputDisplay, this.inputTip], '.form-control');
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function() {
|
show: function() {
|
||||||
Common.UI.Window.prototype.show.apply(this, arguments);
|
Common.UI.Window.prototype.show.apply(this, arguments);
|
||||||
|
|
||||||
var me = this;
|
|
||||||
_.delay(function(){
|
|
||||||
if (me.focusedInput) me.focusedInput.focus();
|
|
||||||
},50);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setSettings: function(settings) {
|
setSettings: function(settings) {
|
||||||
|
@ -273,13 +274,11 @@ define([
|
||||||
var defrange = '';
|
var defrange = '';
|
||||||
if (!settings.props) { // add link
|
if (!settings.props) { // add link
|
||||||
this.inputDisplay.setValue(settings.isLock ? this.textDefault : settings.text);
|
this.inputDisplay.setValue(settings.isLock ? this.textDefault : settings.text);
|
||||||
this.focusedInput = (type == Asc.c_oAscHyperlinkType.WebLink) ? this.inputUrl.cmpEl.find('input') : this.inputRange.cmpEl.find('input');
|
|
||||||
} else {
|
} else {
|
||||||
if (type == Asc.c_oAscHyperlinkType.RangeLink) {
|
if (type == Asc.c_oAscHyperlinkType.RangeLink) {
|
||||||
if (settings.props.asc_getSheet()) {
|
if (settings.props.asc_getSheet()) {
|
||||||
this.inputRange.setValue(settings.props.asc_getRange());
|
this.inputRange.setValue(settings.props.asc_getRange());
|
||||||
this.dataRangeValid = this.inputRange.getValue();
|
this.dataRangeValid = this.inputRange.getValue();
|
||||||
this.focusedInput = this.inputRange.cmpEl.find('input');
|
|
||||||
defrange = settings.props.asc_getSheet() + '!' + settings.props.asc_getRange();
|
defrange = settings.props.asc_getSheet() + '!' + settings.props.asc_getRange();
|
||||||
} else {// named range
|
} else {// named range
|
||||||
this.inputRange.setDisabled(true);
|
this.inputRange.setDisabled(true);
|
||||||
|
@ -287,7 +286,6 @@ define([
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.inputUrl.setValue(settings.props.asc_getHyperlinkUrl().replace(new RegExp(" ",'g'), "%20"));
|
this.inputUrl.setValue(settings.props.asc_getHyperlinkUrl().replace(new RegExp(" ",'g'), "%20"));
|
||||||
this.focusedInput = this.inputUrl.cmpEl.find('input');
|
|
||||||
this.btnOk.setDisabled($.trim(this.inputUrl.getValue())=='');
|
this.btnOk.setDisabled($.trim(this.inputUrl.getValue())=='');
|
||||||
}
|
}
|
||||||
this.inputDisplay.setValue(settings.isLock ? this.textDefault : settings.props.asc_getText());
|
this.inputDisplay.setValue(settings.isLock ? this.textDefault : settings.props.asc_getText());
|
||||||
|
@ -356,17 +354,17 @@ define([
|
||||||
checkrange = (this.btnInternal.isActive()) ? this.inputRange.checkValidate() : true,
|
checkrange = (this.btnInternal.isActive()) ? this.inputRange.checkValidate() : true,
|
||||||
checkdisp = this.inputDisplay.checkValidate();
|
checkdisp = this.inputDisplay.checkValidate();
|
||||||
if (checkurl !== true) {
|
if (checkurl !== true) {
|
||||||
this.inputUrl.cmpEl.find('input').focus();
|
this.inputUrl.focus();
|
||||||
this.isInputFirstChange_url = true;
|
this.isInputFirstChange_url = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (checkrange !== true) {
|
if (checkrange !== true) {
|
||||||
this.inputRange.cmpEl.find('input').focus();
|
this.inputRange.focus();
|
||||||
this.isInputFirstChange_range = true;
|
this.isInputFirstChange_range = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (checkdisp !== true) {
|
if (checkdisp !== true) {
|
||||||
this.inputDisplay.cmpEl.find('input').focus();
|
this.inputDisplay.focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
!this.settings.props && Common.Utils.InternalSettings.set("sse-settings-link-type", this.btnInternal.isActive()); // save last added hyperlink
|
!this.settings.props && Common.Utils.InternalSettings.set("sse-settings-link-type", this.btnInternal.isActive()); // save last added hyperlink
|
||||||
|
@ -448,8 +446,20 @@ define([
|
||||||
}
|
}
|
||||||
var rec = this.internalList.getSelectedRec();
|
var rec = this.internalList.getSelectedRec();
|
||||||
this.btnOk.setDisabled(!rec || rec.get('level')==0 || rec.get('type')==0 && $.trim(this.inputRange.getValue())=='');
|
this.btnOk.setDisabled(!rec || rec.get('level')==0 || rec.get('type')==0 && $.trim(this.inputRange.getValue())=='');
|
||||||
} else
|
var me = this;
|
||||||
|
_.delay(function(){
|
||||||
|
if (me.inputRange.isDisabled())
|
||||||
|
me.internalList.focus();
|
||||||
|
else
|
||||||
|
me.inputRange.focus();
|
||||||
|
},50);
|
||||||
|
} else {
|
||||||
this.btnOk.setDisabled($.trim(this.inputUrl.getValue())=='');
|
this.btnOk.setDisabled($.trim(this.inputUrl.getValue())=='');
|
||||||
|
var me = this;
|
||||||
|
_.delay(function(){
|
||||||
|
me.inputUrl.focus();
|
||||||
|
},50);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onLinkTypeClick: function(type, btn, event) {
|
onLinkTypeClick: function(type, btn, event) {
|
||||||
|
@ -521,6 +531,9 @@ define([
|
||||||
handler: handlerDlg
|
handler: handlerDlg
|
||||||
}).on('close', function() {
|
}).on('close', function() {
|
||||||
me.show();
|
me.show();
|
||||||
|
_.delay(function(){
|
||||||
|
me.inputRange.focus();
|
||||||
|
},1);
|
||||||
});
|
});
|
||||||
|
|
||||||
var xy = me.$window.offset();
|
var xy = me.$window.offset();
|
||||||
|
|
Loading…
Reference in a new issue