taoguan / jwysiwyg

Automatically exported from code.google.com/p/jwysiwyg
0 stars 0 forks source link

Return focus to editor window after control button click #69

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Add some text to the editor
2. Select a portion of the text to format if desired (or just leave cursor
at current location)
3. Click a control (bold, underline, italics, etc.)

What is the expected output? What do you see instead?
I would expect the focus to be returned to the selected text or cursor
position after applying the control to the selection or the cursor
location.  Instead, the user must click back into the editor to begin
typing again.

This may be related to a couple of different issues (#20, #44), but seemed
a little different.

What version of the product are you using? On what operating system?
jwysiwyg v0.4 
Mac OS X 10.5.5 and MS Windows XP Pro, SP2
FF 3.04, IE7, Safari 3.2.1

Please provide any additional information below.
I added the following code to the mousedown function after the autoSave
conditional:
{{{
//send focus back to the editor after command execution
if ( $.browser.msie )
{
    var editorDoc = $(self.editor).document();
    if ( editorDoc.selection && editorDoc.selection.createRange )
    {
    var range = editorDoc.selection.createRange();
    setTimeout( function(){ range.select(); }, 0 ); 
    }
}
else setTimeout( function(){ $(self.editor).get(0).contentWindow.focus();
}, 0 );
}}}

Original issue reported on code.google.com by bryanbla...@gmail.com on 10 Dec 2008 at 8:35

GoogleCodeExporter commented 8 years ago
Shoot, sorry for the dupe.  Just saw issue #56.  I thought I had looked through 
all
the issues.  I'd delete this and add a comment to the other if I could. *sigh*

Original comment by bryanbla...@gmail.com on 10 Dec 2008 at 8:37

GoogleCodeExporter commented 8 years ago
Issue 56 has been merged into this issue.

Original comment by akzhan.a...@gmail.com on 6 May 2010 at 1:31

GoogleCodeExporter commented 8 years ago
Solution from #20 works better.

Original comment by akzhan.a...@gmail.com on 6 May 2010 at 1:37