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
|
|
@ -116,7 +116,7 @@ Ox.Menu = function(options, self) {
|
|||
}
|
||||
}
|
||||
|
||||
function clickItem(position) {
|
||||
function clickItem(position, files) {
|
||||
var item = that.items[position],
|
||||
group = item.options('group'),
|
||||
menu = self.options.mainmenu || self.options.parent || that,
|
||||
|
|
@ -156,10 +156,10 @@ Ox.Menu = function(options, self) {
|
|||
});
|
||||
}
|
||||
} else {
|
||||
menu.triggerEvent('click', {
|
||||
menu.triggerEvent('click', Ox.extend({
|
||||
id: item.options('id'),
|
||||
title: Ox.stripTags(item.options('title')[0])
|
||||
});
|
||||
}, files ? {files: files} : {}));
|
||||
}
|
||||
if (item.options('title').length == 2) {
|
||||
item.toggleTitle();
|
||||
|
|
@ -236,10 +236,14 @@ Ox.Menu = function(options, self) {
|
|||
var item,
|
||||
position,
|
||||
$target = $(event.target),
|
||||
$parent = $target.parent();
|
||||
$parent = $target.parent(),
|
||||
$grandparent = $parent.parent();
|
||||
if ($parent.is('.OxCell')) {
|
||||
$target = $parent;
|
||||
$parent = $target.parent();
|
||||
} else if ($grandparent.is('.OxCell')) {
|
||||
$target = $grandparent;
|
||||
$parent = $target.parent();
|
||||
}
|
||||
if ($target.is('.OxCell')) {
|
||||
position = $parent.data('position');
|
||||
|
|
@ -617,6 +621,10 @@ Ox.Menu = function(options, self) {
|
|||
}
|
||||
};
|
||||
|
||||
that.clickItem = function(position, files) {
|
||||
clickItem(position, files);
|
||||
};
|
||||
|
||||
/*@
|
||||
getItem <f>
|
||||
@*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue