forked from 0x2620/oxjs
allow menu item to trigger native file dialog (see demo, fixes #691)
This commit is contained in:
parent
1c3e257bc8
commit
df03bf1841
6 changed files with 246 additions and 97 deletions
|
|
@ -28,7 +28,6 @@ Ox.MenuItem = function(options, self) {
|
|||
bind: [], // fixme: what's this?
|
||||
checked: null,
|
||||
disabled: false,
|
||||
file: false,
|
||||
group: '',
|
||||
icon: '',
|
||||
id: '',
|
||||
|
|
@ -38,6 +37,7 @@ Ox.MenuItem = function(options, self) {
|
|||
menu: null, // fixme: is passing the menu to 100s of menu items really memory-neutral?
|
||||
position: 0,
|
||||
title: [],
|
||||
type: ''
|
||||
})
|
||||
.options(Ox.extend(Ox.clone(options), {
|
||||
keyboard: parseKeyboard(options.keyboard || self.defaults.keyboard),
|
||||
|
|
@ -55,7 +55,6 @@ Ox.MenuItem = function(options, self) {
|
|||
self.options.checked = false;
|
||||
}
|
||||
|
||||
// construct
|
||||
that.append(
|
||||
that.$status = $('<td>')
|
||||
.addClass('OxCell OxStatus')
|
||||
|
|
@ -79,13 +78,25 @@ Ox.MenuItem = function(options, self) {
|
|||
: {}
|
||||
)
|
||||
.html(
|
||||
Ox.isString(self.options.title[0])
|
||||
? self.options.title[0]
|
||||
: $('<div>').html(self.options.title[0]).html()
|
||||
self.options.file
|
||||
?
|
||||
Ox.FileButton(Ox.extend(Ox.clone(self.options.file), {
|
||||
title: self.options.title[0],
|
||||
width: self.options.file.width
|
||||
})).bindEvent({
|
||||
click: function(data) {
|
||||
self.options.menu.clickItem(self.options.position, data.files);
|
||||
}
|
||||
})
|
||||
: (
|
||||
Ox.isString(self.options.title[0])
|
||||
? self.options.title[0]
|
||||
: $('<div>').html(self.options.title[0]).html()
|
||||
)
|
||||
)
|
||||
)
|
||||
.append(
|
||||
$('<td>')
|
||||
that.$modifiers = $('<td>')
|
||||
.addClass('OxCell OxModifiers')
|
||||
.html(
|
||||
self.options.keyboard.modifiers.map(function(modifier) {
|
||||
|
|
@ -94,7 +105,7 @@ Ox.MenuItem = function(options, self) {
|
|||
)
|
||||
)
|
||||
.append(
|
||||
$('<td>')
|
||||
that.$key = $('<td>')
|
||||
.addClass(
|
||||
'OxCell Ox' + (self.options.items.length ? 'Submenu' : 'Key')
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue