Redo focus function

main2
Bob Mottram 2019-09-22 12:12:10 +01:00
parent 6a4cf4c3b7
commit 854354acd8
1 changed files with 12 additions and 5 deletions

View File

@ -1381,13 +1381,20 @@ def cursorToEndOfMessageScript() -> str:
This avoids the cursor being in the wrong position when replying
"""
script = \
'function focusOnMessage() {\n' \
" var replyTextArea = document.getElementById('message');\n" \
' val = textarea.val();\n' \
' if (val.charAt(val.length-1) != " ") {\n' \
' val += " ";\n' \
' }\n' \
' replyTextArea\n' \
' .focus()\n' \
' .val("")\n' \
' .val(val);\n' \
'}\n' \
"var replyTextArea = document.getElementById('message')\n" \
'replyTextArea.onFocus = function() {\n' \
' var theVal = replyTextArea.value;\n' \
' replyTextArea.value = theVal;\n' \
'}\n' \
'function focusOnMessage() {\n' \
" document.getElementById('message').focus()\n" \
' focusOnMessage();' \
'}\n'
return script