[DE] Hyperlink refactoring
This commit is contained in:
parent
29212eadfe
commit
c23422465e
|
@ -157,7 +157,12 @@ define([
|
|||
me.internalList = new Common.UI.TreeView({
|
||||
el: $('#id-dlg-hyperlink-list'),
|
||||
store: new Common.UI.TreeViewStore(),
|
||||
enableKeyEvents: false
|
||||
enableKeyEvents: true
|
||||
});
|
||||
me.internalList.on('item:select', _.bind(this.onSelectItem, this));
|
||||
|
||||
me.btnOk = new Common.UI.Button({
|
||||
el: $window.find('.primary')
|
||||
});
|
||||
|
||||
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
||||
|
@ -170,7 +175,8 @@ define([
|
|||
this.externalPanel.toggleClass('hidden', value !== c_oHyperlinkType.WebLink);
|
||||
this.internalPanel.toggleClass('hidden', value !== c_oHyperlinkType.InternalLink);
|
||||
var store = this.internalList.store;
|
||||
if (value==c_oHyperlinkType.InternalLink && store.length<1) {
|
||||
if (value==c_oHyperlinkType.InternalLink) {
|
||||
if (store.length<1) {
|
||||
var anchors = this.api.asc_GetHyperlinkAnchors(),
|
||||
count = anchors.length,
|
||||
prev_level = 0,
|
||||
|
@ -243,6 +249,12 @@ define([
|
|||
}
|
||||
store.reset(arr);
|
||||
}
|
||||
var rec = this.internalList.getSelectedRec();
|
||||
this.btnOk.setDisabled(rec.length<1 || rec[0].get('level')==0 && rec[0].get('index')>0);
|
||||
|
||||
} else
|
||||
this.btnOk.setDisabled(false);
|
||||
|
||||
this.linkType = value;
|
||||
},
|
||||
|
||||
|
@ -250,6 +262,10 @@ define([
|
|||
this.ShowHideElem(type);
|
||||
},
|
||||
|
||||
onSelectItem: function(picker, item, record, e){
|
||||
this.btnOk.setDisabled(record.get('level')==0 && record.get('index')>0);
|
||||
},
|
||||
|
||||
show: function() {
|
||||
Common.UI.Window.prototype.show.apply(this, arguments);
|
||||
|
||||
|
|
Loading…
Reference in a new issue