Menu: when clicking on file item, but next to the file input, don't trigger a click event

This commit is contained in:
rolux 2012-06-27 11:49:13 +02:00
parent b1019a7c5d
commit f70946ff62

View file

@ -169,10 +169,14 @@ Ox.Menu = function(options, self) {
}); });
} }
} else { } else {
menu.triggerEvent('click', Ox.extend({ // if item.options.files && !files, the click happened outside
id: item.options('id'), // the title - as a workaround, we don't trigger a click event.
title: Ox.stripTags(item.options('title')[0]) if (!item.options('file') || files) {
}, files ? {files: files} : {})); 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) { if (item.options('title').length == 2) {
item.toggleTitle(); item.toggleTitle();
@ -242,7 +246,10 @@ Ox.Menu = function(options, self) {
} }
function mouseleave() { function mouseleave() {
if (self.options.selected > -1 && !that.items[self.options.selected].options('items').length) { if (
self.options.selected > -1
&& !that.items[self.options.selected].options('items').length
) {
selectItem(-1); selectItem(-1);
} }
} }
@ -638,7 +645,7 @@ Ox.Menu = function(options, self) {
/*@ /*@
clickItem <f> clickItem clickItem <f> clickItem
(position, files) -> <o> click item at position (position, files) -> <o> click item at position
@*/ @*/
that.clickItem = function(position, files) { that.clickItem = function(position, files) {
clickItem(position, files); clickItem(position, files);