Ox.Clipboard: allow for copying/adding a single item (not wrapped in array)

This commit is contained in:
rlx 2013-08-02 15:03:20 +00:00
parent 1fc0a0191b
commit 8273b8654a

View file

@ -24,7 +24,10 @@ Ox.Clipboard = (function() {
if (type != clipboard.type) {
Ox.Clipboard.clear();
}
clipboard = {items: clipboard.items.concat(items), type: type};
clipboard = {
items: clipboard.items.concat(Ox.makeArray(items)),
type: type
};
$element && $element.triggerEvent('add', clipboard);
return clipboard.items.length;
},
@ -40,7 +43,7 @@ Ox.Clipboard = (function() {
return clipboard.items.length;
},
copy: function(items, type) {
clipboard = {items: items, type: type};
clipboard = {items: Ox.makeArray(items), type: type};
$element && $element.triggerEvent('copy', clipboard);
return clipboard.items.length;
},