diff --git a/api/js/etemplate/et2_widget_timestamper.js b/api/js/etemplate/et2_widget_timestamper.js index fd192404d3..0c3d3a3f56 100644 --- a/api/js/etemplate/et2_widget_timestamper.js +++ b/api/js/etemplate/et2_widget_timestamper.js @@ -80,7 +80,13 @@ var et2_timestamper = (function(){ "use strict"; return et2_button.extend([], } text += ': '; - var input = this._get_input(this.target); + var widget = this._get_input(this.target); + var input = widget.input ? widget.input : widget.getDOMNode(); + if(input.context) + { + input = input.get(0); + } + var scrollPos = input.scrollTop; var browser = ((input.selectionStart || input.selectionStart == "0") ? "standards" : (document.selection ? "ie" : false ) ); @@ -132,29 +138,37 @@ var et2_timestamper = (function(){ "use strict"; return et2_button.extend([], input.focus(); } input.scrollTop = scrollPos; - input.focus(); + input.focus(); } + // If on a tab, switch to that tab so user can see it + var tab = widget; + while(tab._parent && tab._type != 'tabbox') + { + tab = tab._parent; + } + if (tab._type == 'tabbox') tab.activateTab(widget); }, _get_input: function _get_input(target) { var input = null; var widget = null; - if(jQuery('#'+this.target).is('input')) + + if (typeof target == 'string') { - input = this.target; - } - else if (typeof target == 'string') - { - var widget = this.getRoot().getWidgetById(target); + widget = this.getRoot().getWidgetById(target); } else if (target.instanceOf && target.instanceOf(et2_IInput)) { widget = target; } + else if(typeof target == 'string' && target.indexOf('#') < 0 && jQuery('#'+this.target).is('input')) + { + input = this.target; + } if(widget) { - input = widget.input ? widget.input : widget.getDOMNode(); + return widget; } if(input.context) {