mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 11:22:41 +01:00
sendkeys: Undo formatting and unnecessary changes
This partially reverts the following commits: *04e9fc3a2f
*3d8452b143
*07182bb716
*68ed9b219f
This commit is contained in:
parent
75591c9946
commit
7147195ac6
1 changed files with 306 additions and 307 deletions
|
@ -24,7 +24,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
(function($){
|
(function(){
|
||||||
|
|
||||||
bililiteRange = function(el, debug){
|
bililiteRange = function(el, debug){
|
||||||
var ret;
|
var ret;
|
||||||
|
@ -146,7 +146,7 @@ IERange.prototype._nativeSelection = function (){
|
||||||
// returns [start, end] for the selection constrained to be in element
|
// returns [start, end] for the selection constrained to be in element
|
||||||
var rng = this._nativeRange(); // range of the element to constrain to
|
var rng = this._nativeRange(); // range of the element to constrain to
|
||||||
var len = this.length();
|
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();
|
var sel = this._doc.selection.createRange();
|
||||||
try{
|
try{
|
||||||
return [
|
return [
|
||||||
|
@ -346,7 +346,7 @@ NothingRange.prototype._nativeEOL = function(){
|
||||||
this.text('\n');
|
this.text('\n');
|
||||||
};
|
};
|
||||||
|
|
||||||
})(jQuery);
|
})();
|
||||||
|
|
||||||
// insert characters in a textarea or text input field
|
// insert characters in a textarea or text input field
|
||||||
// special characters are enclosed in {}; use {{} for the { character itself
|
// special characters are enclosed in {}; use {{} for the { character itself
|
||||||
|
@ -391,7 +391,7 @@ $.fn.sendkeys = function (x, opts){
|
||||||
}).bind('keyup.sendkeys', function(evt){
|
}).bind('keyup.sendkeys', function(evt){
|
||||||
// restore the selection if we got here with a tab (a click should select what was clicked on)
|
// restore the selection if we got here with a tab (a click should select what was clicked on)
|
||||||
if (evt.which == 9){
|
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();
|
$.data(this, 'sendkeys.selection').select();
|
||||||
}else{
|
}else{
|
||||||
$.data(this, 'sendkeys.selection').bounds('selection');
|
$.data(this, 'sendkeys.selection').bounds('selection');
|
||||||
|
@ -426,8 +426,7 @@ $.fn.sendkeys.defaults = {
|
||||||
'{enter}': function (rng){
|
'{enter}': function (rng){
|
||||||
rng.insertEOL();
|
rng.insertEOL();
|
||||||
rng.select();
|
rng.select();
|
||||||
$(rng._el).trigger(
|
$(rng._el).trigger({type: 'keypress', keyCode: 13, which: 13, charCode: 13, code: 'Enter', key: 'Enter'});
|
||||||
{type: 'keypress', keyCode: 13, which: 13, charCode: 13, code: 'Enter', key: 'Enter'});
|
|
||||||
},
|
},
|
||||||
'{backspace}': function (rng){
|
'{backspace}': function (rng){
|
||||||
var b = rng.bounds();
|
var b = rng.bounds();
|
||||||
|
|
Loading…
Reference in a new issue