Fix cke editor focus detection

This commit is contained in:
RainLoop Team 2014-05-16 12:09:28 +04:00
parent 9b59ad32dc
commit 07b0f20305
7 changed files with 192 additions and 174 deletions

View file

@ -389,11 +389,17 @@ Utils.initOnStartOrLangChange = function (fCallback, oScope, fLangCallback)
*/
Utils.inFocus = function ()
{
var oActiveObj = document.activeElement;
return (oActiveObj && ('INPUT' === oActiveObj.tagName ||
'TEXTAREA' === oActiveObj.tagName ||
'IFRAME' === oActiveObj.tagName ||
('DIV' === oActiveObj.tagName && 'editorHtmlArea' === oActiveObj.className && oActiveObj.contentEditable)));
if (document.activeElement)
{
if (Utils.isUnd(document.activeElement.__inFocusCache))
{
document.activeElement.__inFocusCache = $(document.activeElement).is('input,textarea,iframe,.cke_editable');
}
return !!document.activeElement.__inFocusCache;
}
return false;
};
Utils.removeInFocus = function ()
@ -401,7 +407,7 @@ Utils.removeInFocus = function ()
if (document && document.activeElement && document.activeElement.blur)
{
var oA = $(document.activeElement);
if (oA.is('input') || oA.is('textarea'))
if (oA.is('input,textarea'))
{
document.activeElement.blur();
}

View file

@ -2,7 +2,7 @@
"name": "RainLoop",
"title": "RainLoop Webmail",
"version": "1.6.6",
"release": "924",
"release": "928",
"description": "Simple, modern & fast web-based email client",
"homepage": "http://rainloop.net",
"main": "Gruntfile.js",

View file

@ -1123,11 +1123,17 @@ Utils.initOnStartOrLangChange = function (fCallback, oScope, fLangCallback)
*/
Utils.inFocus = function ()
{
var oActiveObj = document.activeElement;
return (oActiveObj && ('INPUT' === oActiveObj.tagName ||
'TEXTAREA' === oActiveObj.tagName ||
'IFRAME' === oActiveObj.tagName ||
('DIV' === oActiveObj.tagName && 'editorHtmlArea' === oActiveObj.className && oActiveObj.contentEditable)));
if (document.activeElement)
{
if (Utils.isUnd(document.activeElement.__inFocusCache))
{
document.activeElement.__inFocusCache = $(document.activeElement).is('input,textarea,iframe,.cke_editable');
}
return !!document.activeElement.__inFocusCache;
}
return false;
};
Utils.removeInFocus = function ()
@ -1135,7 +1141,7 @@ Utils.removeInFocus = function ()
if (document && document.activeElement && document.activeElement.blur)
{
var oA = $(document.activeElement);
if (oA.is('input') || oA.is('textarea'))
if (oA.is('input,textarea'))
{
document.activeElement.blur();
}

File diff suppressed because one or more lines are too long

View file

@ -1127,11 +1127,17 @@ Utils.initOnStartOrLangChange = function (fCallback, oScope, fLangCallback)
*/
Utils.inFocus = function ()
{
var oActiveObj = document.activeElement;
return (oActiveObj && ('INPUT' === oActiveObj.tagName ||
'TEXTAREA' === oActiveObj.tagName ||
'IFRAME' === oActiveObj.tagName ||
('DIV' === oActiveObj.tagName && 'editorHtmlArea' === oActiveObj.className && oActiveObj.contentEditable)));
if (document.activeElement)
{
if (Utils.isUnd(document.activeElement.__inFocusCache))
{
document.activeElement.__inFocusCache = $(document.activeElement).is('input,textarea,iframe,.cke_editable');
}
return !!document.activeElement.__inFocusCache;
}
return false;
};
Utils.removeInFocus = function ()
@ -1139,7 +1145,7 @@ Utils.removeInFocus = function ()
if (document && document.activeElement && document.activeElement.blur)
{
var oA = $(document.activeElement);
if (oA.is('input') || oA.is('textarea'))
if (oA.is('input,textarea'))
{
document.activeElement.blur();
}

File diff suppressed because one or more lines are too long