video editor update

This commit is contained in:
rlx 2012-01-10 20:19:28 +05:30
commit 88f31a5ae3
10 changed files with 245 additions and 65 deletions

View file

@ -21,7 +21,7 @@ Ox.ArrayEditable = function(options, self) {
width: 256
})
.options(options || {})
.addClass('OxArrayEditable')
.addClass('OxArrayEditable OxArrayEditable' + Ox.toTitleCase(self.options.type))
.css({width: self.options.width - 8 + 'px'}) // 2 x 4 px padding
.bindEvent({
anyclick: anyclick,
@ -29,10 +29,10 @@ Ox.ArrayEditable = function(options, self) {
key_delete: deleteItem,
key_enter: editItem,
key_escape: selectNone,
key_down: selectLast,
key_left: selectPrevious,
key_right: selectNext,
key_up: selectFirst
key_down: self.options.type == 'input' ? selectLast : selectNext,
key_left: self.options.type == 'input' ? selectPrevious : selectFirst,
key_right: self.options.type == 'input' ? selectNext : selectLast,
key_up: self.options.type == 'input' ? selectFirst : selectPrevious
});
self.$items = [];
@ -122,7 +122,7 @@ Ox.ArrayEditable = function(options, self) {
),
type: self.options.type,
value: item.value,
width: self.options.type == 'input' ? 0 : self.options.width
width: self.options.type == 'input' ? 0 : self.options.width - 8
})
.addClass(item.id == self.options.selected ? 'OxSelected' : '')
.data({position: i})
@ -160,7 +160,7 @@ Ox.ArrayEditable = function(options, self) {
}
that.find('.OxSelected').removeClass('OxSelected');
self.selected > -1 && self.$items[self.selected].addClass('OxSelected');
that.triggerEvent('select', {id: self.options.selected});
triggerSelectEvent();
}
function selectLast() {
@ -197,6 +197,16 @@ Ox.ArrayEditable = function(options, self) {
}
}
function triggerSelectEvent() {
if (!self.triggered) {
that.triggerEvent('select', {id: self.options.selected});
self.triggered = true;
setTimeout(function() {
self.triggered = false;
}, 250);
}
};
self.setOption = function(key, value) {
if (key == 'items') {
renderItems();

View file

@ -87,7 +87,7 @@ Ox.Editable = function(options, self) {
//height = self.options.height || Ox.limit(self.$test.height() + 2, self.minHeight, self.maxHeight);
height = self.options.height || Math.max(self.$test.height() + 2, self.minHeight);
width = self.options.width || Ox.limit(self.$test.width() + 2, self.minWidth, self.maxWidth);
Ox.Log('Form', self.options.width, self.$test.width(), 'wxh', width, height)
Ox.Log('Form', self.options.width, self.$test.html(), self.$test.width(), self.$test.height(), 'wxh', width, height)
if (self.options.type == 'input') {
self.$input.options({
width: width
@ -184,8 +184,14 @@ Ox.Editable = function(options, self) {
function formatTestValue() {
return self.options.type == 'input'
? self.options.value.replace(/ /g, ' ')
: Ox.encodeHTML(self.options.value || ' ')
//.replace(/ /g, ' ')
.replace(/\n$/, '\n ')
.replace(/\n/g, '<br/>')
/*
: Ox.parseHTML(self.options.value || '&nbsp;')
.replace(/<br\/?>$/, '<br/>&nbsp;');
.replace(/(\n|<br\/?>)$/, '<br/>&nbsp;');
*/
}
function formatValue() {