clipboard: fix paste event; dont pass data with events

This commit is contained in:
rlx 2013-08-06 19:55:15 +00:00
parent 99672fc039
commit 8202aaa6e1

View file

@ -30,7 +30,7 @@ Ox.Clipboard = function() {
items: Ox.unique(clipboard.items.concat(items)), items: Ox.unique(clipboard.items.concat(items)),
type: type type: type
}; };
$element && $element.triggerEvent('add', clipboard); $element && $element.triggerEvent('add');
} }
return clipboard.items.length; return clipboard.items.length;
}, },
@ -42,14 +42,14 @@ Ox.Clipboard = function() {
}, },
clear: function() { clear: function() {
clipboard = {items: [], type: void 0}; clipboard = {items: [], type: void 0};
$element && $element.triggerEvent('clear', clipboard); $element && $element.triggerEvent('clear');
return clipboard.items.length; return clipboard.items.length;
}, },
copy: function(items, type) { copy: function(items, type) {
items = Ox.makeArray(items); items = Ox.makeArray(items);
if (items.length) { if (items.length) {
clipboard = {items: items, type: type}; clipboard = {items: items, type: type};
$element && $element.triggerEvent('copy', clipboard); $element && $element.triggerEvent('copy');
} }
return clipboard.items.length; return clipboard.items.length;
}, },
@ -57,8 +57,8 @@ Ox.Clipboard = function() {
return !type || type == clipboard.type ? clipboard.items.length : 0; return !type || type == clipboard.type ? clipboard.items.length : 0;
}, },
paste: function(type) { paste: function(type) {
$element && $element.triggerEvent('paste');
return !type || type == clipboard.type ? clipboard.items : []; return !type || type == clipboard.type ? clipboard.items : [];
$element && $element.triggerEvent('paste', clipboard);
}, },
type: function() { type: function() {
return clipboard.type; return clipboard.type;