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();
}