Created
November 30, 2011 14:06
-
-
Save garryyao/1409175 to your computer and use it in GitHub Desktop.
Workaround for FF bug on selection lost when hiding the editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The below code is for FF only. | |
var editor = CKEDITOR.appendTo( 'editor1' ); | |
setTimeout( function() | |
{ | |
var focused = editor.focusManager.hasFocus; | |
if ( focused ) | |
{ | |
var sel = editor.getSelection(); | |
sel.lock(); | |
} | |
document.getElementById( 'editor1' ).style.display = 'none'; | |
setTimeout( function() | |
{ | |
document.getElementById( 'editor1' ).style.display = 'block'; | |
if ( focused ) | |
{ | |
editor.focusGrabber.focus(); | |
setTimeout( function() { editor.getSelection().unlock( true ); } ); | |
} | |
}, 1000 ); | |
}, 5000 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment