forked from 0x2620/oxjs
Ox.Clipboard: add events; Ox.Request: cleanup; Ox.MainMenu: use OxHighlight class; Themes: add bar highlight color and gradient
This commit is contained in:
parent
b1b2785a15
commit
27bbbdbd83
8 changed files with 35 additions and 8 deletions
|
|
@ -14,7 +14,8 @@ Ox.Clipboard <o> Basic clipboard handler
|
|||
() -> <s|undefined> Item type
|
||||
@*/
|
||||
Ox.Clipboard = (function() {
|
||||
var clipboard = {items: [], type: void 0};
|
||||
var clipboard = {items: [], type: void 0},
|
||||
$element;
|
||||
return {
|
||||
_print: function() {
|
||||
Ox.print(JSON.stringify(clipboard));
|
||||
|
|
@ -24,21 +25,34 @@ Ox.Clipboard = (function() {
|
|||
Ox.Clipboard.clear();
|
||||
}
|
||||
clipboard = {items: clipboard.items.concat(items), type: type};
|
||||
$element && $element.triggerEvent('add', clipboard);
|
||||
return clipboard.items.length;
|
||||
},
|
||||
bindEvent: function() {
|
||||
if (!$element) {
|
||||
$element = Ox.Element();
|
||||
}
|
||||
$element.bindEvent.apply(this, arguments);
|
||||
},
|
||||
clear: function() {
|
||||
clipboard = {items: [], type: void 0};
|
||||
$element && $element.triggerEvent('clear', clipboard);
|
||||
return clipboard.items.length;
|
||||
},
|
||||
copy: function(items, type) {
|
||||
clipboard = {items: items, type: type};
|
||||
$element && $element.triggerEvent('copy', clipboard);
|
||||
return clipboard.items.length;
|
||||
},
|
||||
paste: function(type) {
|
||||
return !type || type == clipboard.type ? clipboard.items : [];
|
||||
$element && $element.triggerEvent('paste', clipboard);
|
||||
},
|
||||
type: function() {
|
||||
return clipboard.type;
|
||||
},
|
||||
unbindEvent: function() {
|
||||
$element && $element.bindEvent.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue