diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index ddafafc4..f1074444 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -7698,54 +7698,27 @@ requires .empty() .addClass('OxEdit'); - new Ox.Element() - .append($input = new Ox.Input({ - height: height, - style: 'square', - type: 'textarea', - value: item.value, - width: width + 6 - }) - .bind({ - mousedown: function(e) { - // keep mousedown from reaching list - e.stopPropagation(); - } - }) - ) - .append(new Ox.Element() - .append( - new Ox.Button({type: 'text', title: 'Cancel'}) - .css('width', '42%') - .bindEvent({ - 'click': cancel - }) - ) - .append( - new Ox.Button({type: 'text', title: 'Save'}) - .css('width', '42%') - .bindEvent({ - 'click': submit - }) - ).css({ - 'margin-top': height-8, - 'height': '16px', - 'text-align': 'right', - }) - ) - .appendTo($item.$element); - //gain focus async, otherwise enter gets - //passed on to input and removes all data + $input = new Ox.ItemInput({ + type: 'textarea', + value: item.value, + height: height, + width: width + }).bindEvent({ + cancel: cancel, + save: submit + }).appendTo($item.$element); + /* setTimeout(function() { $input.gainFocus(); $input.focus(); }); + */ function cancel() { $item.options('data', item); //fixme: trigger event to reset i/o points } - function submit() { - item.value = $input.value(); + function submit(event, data) { + item.value = data.value; //$input.loseFocus().remove(); // fixme: leaky, inputs remain in focus stack $item.options('data', item); @@ -7883,6 +7856,59 @@ requires }; + Ox.ItemInput = function(options, self) { + + var self = self || {}, + that = new Ox.Element({}, self) + .defaults({ + type: 'textarea', + value: '', + height: 300, + width: 100 + }) + .options(options || {}), + $input; + + that.append($input = new Ox.Input({ + height: self.options.height, + style: 'square', + type: self.options.type, + value: self.options.value, + width: self.options.width + 6 + }) + .bind({ + mousedown: function(e) { + // keep mousedown from reaching list + e.stopPropagation(); + } + })) + .append(new Ox.Element() + .append(new Ox.Button({type: 'text', title: 'Cancel'}) + .css('width', '42%') + .bindEvent({ + 'click': function() { + that.triggerEvent('cancel'); + } + })) + .append(new Ox.Button({type: 'text', title: 'Save'}) + .css('width', '42%') + .bindEvent({ + 'click': function() { + that.triggerEvent('save', { + value: $input.value() + }); + } + })) + .css({ + 'margin-top': self.options.height-8, + 'height': '16px', + 'text-align': 'right', + }) + ); + Ox.print($input); + return that; + } + Ox.ListItem = function(options, self) { var self = self || {}, @@ -10840,7 +10866,8 @@ requires var item = Ox.getObjectById(self.options.items, data.ids[0]); that.triggerEvent('select', { 'in': item.in, - 'out': item.out + 'out': item.out, + 'layer': self.options.id }); } function updateAnnotation(event, data) {