Merge pull request #2650 from ether/iframe-issues

Iframe issues
This commit is contained in:
John McLear 2015-05-06 00:58:38 +01:00
commit a1893ec629
3 changed files with 13 additions and 13 deletions

View File

@ -3640,6 +3640,7 @@ function Ace2Inner(){
}else{ }else{
var lineHeight = myselection.focusNode.offsetHeight; // line height of blank lines var lineHeight = myselection.focusNode.offsetHeight; // line height of blank lines
} }
var heightOfChatIcon = parent.parent.$('#chaticon').height(); // height of the chat icon button var heightOfChatIcon = parent.parent.$('#chaticon').height(); // height of the chat icon button
lineHeight = (lineHeight *2) + heightOfChatIcon; lineHeight = (lineHeight *2) + heightOfChatIcon;
var viewport = getViewPortTopBottom(); var viewport = getViewPortTopBottom();
@ -3704,11 +3705,11 @@ function Ace2Inner(){
firstEditbarElement.focus(); firstEditbarElement.focus();
evt.preventDefault(); evt.preventDefault();
} }
if ((!specialHandled) && altKey && keyCode == 67){ if ((!specialHandled) && altKey && keyCode == 67 && type === "keydown"){
// Alt c focuses on the Chat window // Alt c focuses on the Chat window
$(this).blur(); $(this).blur();
parent.parent.chat.show(); parent.parent.chat.show();
parent.parent.chat.focus(); parent.parent.$("#chatinput").focus();
evt.preventDefault(); evt.preventDefault();
} }
if ((!specialHandled) && evt.ctrlKey && shiftKey && keyCode == 50 && type === "keydown"){ if ((!specialHandled) && evt.ctrlKey && shiftKey && keyCode == 50 && type === "keydown"){

View File

@ -39,8 +39,6 @@ var chat = (function()
}, },
focus: function () focus: function ()
{ {
// I'm not sure why we need a setTimeout here but without it we don't get focus...
// Animation maybe?
setTimeout(function(){ setTimeout(function(){
$("#chatinput").focus(); $("#chatinput").focus();
},100); },100);
@ -214,23 +212,24 @@ var chat = (function()
init: function(pad) init: function(pad)
{ {
this._pad = pad; this._pad = pad;
$("#chatinput").keyup(function(evt) $("#chatinput").on("keydown", function(evt){
{
// If the event is Alt C or Escape & we're already in the chat menu // If the event is Alt C or Escape & we're already in the chat menu
// Send the users focus back to the pad // Send the users focus back to the pad
if((evt.altKey == true && evt.which === 67) || evt.which === 27){ if((evt.altKey == true && evt.which === 67) || evt.which === 27){
// If we're in chat already.. // If we're in chat already..
$(':focus').blur(); // required to do not try to remove! $(':focus').blur(); // required to do not try to remove!
padeditor.ace.focus(); // Sends focus back to pad padeditor.ace.focus(); // Sends focus back to pad
evt.preventDefault();
return false;
} }
}); });
$('body:not(#chatinput)').on("keydown", function(evt){ $('body:not(#chatinput)').on("keypress", function(evt){
if (evt.altKey && evt.which == 67){ if (evt.altKey && evt.which == 67){
// Alt c focuses on the Chat window // Alt c focuses on the Chat window
$(this).blur(); $(this).blur();
parent.parent.chat.show(); chat.show();
parent.parent.chat.focus(); $("#chatinput").focus();
evt.preventDefault(); evt.preventDefault();
} }
}); });

View File

@ -279,7 +279,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
if (newRev != (oldRev + 1)) if (newRev != (oldRev + 1))
{ {
parent.parent.console.warn("bad message revision on NEW_CHANGES: " + newRev + " not " + (oldRev + 1)); window.console.warn("bad message revision on NEW_CHANGES: " + newRev + " not " + (oldRev + 1));
// setChannelState("DISCONNECTED", "badmessage_newchanges"); // setChannelState("DISCONNECTED", "badmessage_newchanges");
return; return;
} }
@ -289,7 +289,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
if (newRev != (rev + 1)) if (newRev != (rev + 1))
{ {
parent.parent.console.warn("bad message revision on NEW_CHANGES: " + newRev + " not " + (rev + 1)); window.console.warn("bad message revision on NEW_CHANGES: " + newRev + " not " + (rev + 1));
// setChannelState("DISCONNECTED", "badmessage_newchanges"); // setChannelState("DISCONNECTED", "badmessage_newchanges");
return; return;
} }
@ -303,7 +303,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
{ {
if (newRev != (msgQueue[msgQueue.length - 1].newRev + 1)) if (newRev != (msgQueue[msgQueue.length - 1].newRev + 1))
{ {
parent.parent.console.warn("bad message revision on ACCEPT_COMMIT: " + newRev + " not " + (msgQueue[msgQueue.length - 1][0] + 1)); window.console.warn("bad message revision on ACCEPT_COMMIT: " + newRev + " not " + (msgQueue[msgQueue.length - 1][0] + 1));
// setChannelState("DISCONNECTED", "badmessage_acceptcommit"); // setChannelState("DISCONNECTED", "badmessage_acceptcommit");
return; return;
} }
@ -313,7 +313,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
if (newRev != (rev + 1)) if (newRev != (rev + 1))
{ {
parent.parent.console.warn("bad message revision on ACCEPT_COMMIT: " + newRev + " not " + (rev + 1)); window.console.warn("bad message revision on ACCEPT_COMMIT: " + newRev + " not " + (rev + 1));
// setChannelState("DISCONNECTED", "badmessage_acceptcommit"); // setChannelState("DISCONNECTED", "badmessage_acceptcommit");
return; return;
} }