Ox.Clipboard: enforce uniqueness of items on add

This commit is contained in:
rlx 2013-08-02 19:13:36 +00:00
parent e6541b2b32
commit e3abfd2702

View file

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