wp/wp-admin/js/edit-comments.js
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
  1017 
  1017 
  1018 			$('#replyrow').fadeIn(300, function(){ $(this).show(); });
  1018 			$('#replyrow').fadeIn(300, function(){ $(this).show(); });
  1019 		}
  1019 		}
  1020 
  1020 
  1021 		setTimeout(function() {
  1021 		setTimeout(function() {
  1022 			var rtop, rbottom, scrollTop, vp, scrollBottom;
  1022 			var rtop, rbottom, scrollTop, vp, scrollBottom,
       
  1023 				isComposing = false;
  1023 
  1024 
  1024 			rtop = $('#replyrow').offset().top;
  1025 			rtop = $('#replyrow').offset().top;
  1025 			rbottom = rtop + $('#replyrow').height();
  1026 			rbottom = rtop + $('#replyrow').height();
  1026 			scrollTop = window.pageYOffset || document.documentElement.scrollTop;
  1027 			scrollTop = window.pageYOffset || document.documentElement.scrollTop;
  1027 			vp = document.documentElement.clientHeight || window.innerHeight || 0;
  1028 			vp = document.documentElement.clientHeight || window.innerHeight || 0;
  1030 			if ( scrollBottom - 20 < rbottom )
  1031 			if ( scrollBottom - 20 < rbottom )
  1031 				window.scroll(0, rbottom - vp + 35);
  1032 				window.scroll(0, rbottom - vp + 35);
  1032 			else if ( rtop - 20 < scrollTop )
  1033 			else if ( rtop - 20 < scrollTop )
  1033 				window.scroll(0, rtop - 35);
  1034 				window.scroll(0, rtop - 35);
  1034 
  1035 
  1035 			$('#replycontent').trigger( 'focus' ).on( 'keyup', function(e){
  1036 			$( '#replycontent' )
  1036 				if ( e.which == 27 )
  1037 				.trigger( 'focus' )
  1037 					commentReply.revert(); // Close on Escape.
  1038 				.on( 'keyup', function( e ) {
  1038 			});
  1039 					// Close on Escape except when Input Method Editors (IMEs) are in use.
       
  1040 					if ( e.which === 27 && ! isComposing ) {
       
  1041 						commentReply.revert();
       
  1042 					}
       
  1043 				} )
       
  1044 				.on( 'compositionstart', function() {
       
  1045 					isComposing = true;
       
  1046 				} );
  1039 		}, 600);
  1047 		}, 600);
  1040 
  1048 
  1041 		return false;
  1049 		return false;
  1042 	},
  1050 	},
  1043 
  1051