diff --git a/source/Ox.UI/js/Core/Clipboard.js b/source/Ox.UI/js/Core/Clipboard.js index 3d9afbcf..918e5d1c 100644 --- a/source/Ox.UI/js/Core/Clipboard.js +++ b/source/Ox.UI/js/Core/Clipboard.js @@ -21,14 +21,14 @@ Ox.Clipboard = (function() { Ox.print(JSON.stringify(clipboard)); }, add: function(items, type) { - if (type != clipboard.type) { - Ox.Clipboard.clear(); + items = Ox.makeArray(items); + if (items.length) { + if (type != clipboard.type) { + Ox.Clipboard.clear(); + } + clipboard = {items: clipboard.items.concat(items), type: type}; + $element && $element.triggerEvent('add', clipboard); } - clipboard = { - items: clipboard.items.concat(Ox.makeArray(items)), - type: type - }; - $element && $element.triggerEvent('add', clipboard); return clipboard.items.length; }, bindEvent: function() { @@ -43,8 +43,11 @@ Ox.Clipboard = (function() { return clipboard.items.length; }, copy: function(items, type) { - clipboard = {items: Ox.makeArray(items), type: type}; - $element && $element.triggerEvent('copy', clipboard); + items = Ox.makeArray(items); + if (items.length) { + clipboard = {items: items, type: type}; + $element && $element.triggerEvent('copy', clipboard); + } return clipboard.items.length; }, items: function(type) {