putting tab handling back in KeyDown(). Else editor never gets tabs.

This commit is contained in:
jfrancis%netscape.com 1999-09-19 10:30:30 +00:00
parent 703289e64a
commit cae1f90939
2 changed files with 44 additions and 0 deletions

View File

@ -124,6 +124,28 @@ nsTextEditorKeyListener::HandleEvent(nsIDOMEvent* aEvent)
nsresult
nsTextEditorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent)
{
PRUint32 keyCode;
nsCOMPtr<nsIDOMUIEvent>uiEvent;
uiEvent = do_QueryInterface(aKeyEvent);
if (uiEvent)
{
if (NS_SUCCEEDED(uiEvent->GetKeyCode(&keyCode)))
{
if (nsIDOMUIEvent::VK_TAB==keyCode)
{
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
PRUint32 flags=0;
mEditor->GetFlags(&flags);
if ((flags & nsIHTMLEditor::eEditorSingleLineMask))
return NS_OK; // let it be used for focus switching
// else we insert the tab straight through
htmlEditor->EditorKeyPress(uiEvent);
ScrollSelectionIntoView();
return NS_ERROR_BASE; // "I handled the event, don't do default processing"
}
}
}
return NS_OK;
}

View File

@ -124,6 +124,28 @@ nsTextEditorKeyListener::HandleEvent(nsIDOMEvent* aEvent)
nsresult
nsTextEditorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent)
{
PRUint32 keyCode;
nsCOMPtr<nsIDOMUIEvent>uiEvent;
uiEvent = do_QueryInterface(aKeyEvent);
if (uiEvent)
{
if (NS_SUCCEEDED(uiEvent->GetKeyCode(&keyCode)))
{
if (nsIDOMUIEvent::VK_TAB==keyCode)
{
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
PRUint32 flags=0;
mEditor->GetFlags(&flags);
if ((flags & nsIHTMLEditor::eEditorSingleLineMask))
return NS_OK; // let it be used for focus switching
// else we insert the tab straight through
htmlEditor->EditorKeyPress(uiEvent);
ScrollSelectionIntoView();
return NS_ERROR_BASE; // "I handled the event, don't do default processing"
}
}
}
return NS_OK;
}