fix clipboard unbind; add history events
This commit is contained in:
parent
da7b637948
commit
bcb7e3f720
2 changed files with 16 additions and 2 deletions
|
@ -64,7 +64,7 @@ Ox.Clipboard = function() {
|
||||||
return clipboard.type;
|
return clipboard.type;
|
||||||
},
|
},
|
||||||
unbindEvent: function() {
|
unbindEvent: function() {
|
||||||
$element && $element.bindEvent.apply(this, arguments);
|
$element && $element.unbindEvent.apply(this, arguments);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,8 @@ Ox.History = function(options) {
|
||||||
}, options || {});
|
}, options || {});
|
||||||
|
|
||||||
var history = [],
|
var history = [],
|
||||||
position = 0;
|
position = 0,
|
||||||
|
$element;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_print: function() {
|
_print: function() {
|
||||||
|
@ -19,11 +20,19 @@ Ox.History = function(options) {
|
||||||
items = Ox.makeArray(items);
|
items = Ox.makeArray(items);
|
||||||
history = history.slice(0, position).concat(items);
|
history = history.slice(0, position).concat(items);
|
||||||
position += items.length;
|
position += items.length;
|
||||||
|
$element && $element.triggerEvent('add');
|
||||||
return history.length;
|
return history.length;
|
||||||
},
|
},
|
||||||
|
bindEvent: function() {
|
||||||
|
if (!$element) {
|
||||||
|
$element = Ox.Element();
|
||||||
|
}
|
||||||
|
$element.bindEvent.apply(this, arguments);
|
||||||
|
},
|
||||||
clear: function() {
|
clear: function() {
|
||||||
history = [];
|
history = [];
|
||||||
position = 0;
|
position = 0;
|
||||||
|
$element && $element.triggerEvent('clear');
|
||||||
return history.length;
|
return history.length;
|
||||||
},
|
},
|
||||||
items: function() {
|
items: function() {
|
||||||
|
@ -31,6 +40,7 @@ Ox.History = function(options) {
|
||||||
},
|
},
|
||||||
redo: function() {
|
redo: function() {
|
||||||
if (position < history.length) {
|
if (position < history.length) {
|
||||||
|
$element && $element.triggerEvent('redo');
|
||||||
return history[position++];
|
return history[position++];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -41,9 +51,13 @@ Ox.History = function(options) {
|
||||||
},
|
},
|
||||||
remove: function(test) {
|
remove: function(test) {
|
||||||
|
|
||||||
|
},
|
||||||
|
unbindEvent: function() {
|
||||||
|
$element && $element.unbindEvent.apply(this, arguments);
|
||||||
},
|
},
|
||||||
undo: function() {
|
undo: function() {
|
||||||
if (position > 0) {
|
if (position > 0) {
|
||||||
|
$element && $element.triggerEvent('undo');
|
||||||
return history[--position];
|
return history[--position];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue