sendkeys: Undo formatting and unnecessary changes

This partially reverts the following commits:
  * 04e9fc3a2f
  * 3d8452b143
  * 07182bb716
  * 68ed9b219f
rhansen-sendkeys
Richard Hansen 2021-08-20 19:33:56 -04:00 committed by SamTV12345
parent 75591c9946
commit 7147195ac6
1 changed files with 306 additions and 307 deletions

View File

@ -24,7 +24,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
(function($){
(function(){
bililiteRange = function(el, debug){
var ret;
@ -146,7 +146,7 @@ IERange.prototype._nativeSelection = function (){
// returns [start, end] for the selection constrained to be in element
var rng = this._nativeRange(); // range of the element to constrain to
var len = this.length();
if (this._doc.selection.type != 'Text') return [0,0]; // append to the end
if (this._doc.selection.type != 'Text') return [len, len]; // append to the end
var sel = this._doc.selection.createRange();
try{
return [
@ -346,7 +346,7 @@ NothingRange.prototype._nativeEOL = function(){
this.text('\n');
};
})(jQuery);
})();
// insert characters in a textarea or text input field
// special characters are enclosed in {}; use {{} for the { character itself
@ -391,7 +391,7 @@ $.fn.sendkeys = function (x, opts){
}).bind('keyup.sendkeys', function(evt){
// restore the selection if we got here with a tab (a click should select what was clicked on)
if (evt.which == 9){
// there's a flash of selection when we restore the focus, but I don't know how to avoid that
// there's a flash of selection when we restore the focus, but I don't know how to avoid that.
$.data(this, 'sendkeys.selection').select();
}else{
$.data(this, 'sendkeys.selection').bounds('selection');
@ -426,8 +426,7 @@ $.fn.sendkeys.defaults = {
'{enter}': function (rng){
rng.insertEOL();
rng.select();
$(rng._el).trigger(
{type: 'keypress', keyCode: 13, which: 13, charCode: 13, code: 'Enter', key: 'Enter'});
$(rng._el).trigger({type: 'keypress', keyCode: 13, which: 13, charCode: 13, code: 'Enter', key: 'Enter'});
},
'{backspace}': function (rng){
var b = rng.bounds();