From fb6a19a0716b24c75c5b6ab820f26a5e9edfa9b0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 22 Sep 2019 10:14:39 +0100 Subject: [PATCH] Move cursor to end of textarea when replying --- webinterface.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/webinterface.py b/webinterface.py index 1248a434..938485a8 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1004,7 +1004,7 @@ def htmlNewPost(translate: {},baseDir: str, \ '' if not reportUrl: - newPostForm+='' + newPostForm+='' newPostForm+=htmlFooter() return newPostForm @@ -1375,6 +1375,19 @@ def clickToDropDownScript() -> str: #'}' return script +def cursorToEndOfTextScript() -> str: + """Moves the cursor to the end of the text in a textarea + This avoids the cursor being in the wrong position when replying + """ + script = \ + "var replyTextArea = document.getElementByName('message');" \ + '' \ + 'replyTextArea.onFocus = function() {' \ + ' var theVal = replyTextArea.value;' \ + ' replyTextArea.value = theVal;' \ + '}' + return script + def contentWarningScript() -> str: """Returns a script used for content warnings """ @@ -2083,7 +2096,7 @@ def htmlTimeline(translate: {},pageNumber: int, \ '' # add the javascript for content warnings - tlStr+='' + tlStr+='' # page up arrow if pageNumber>1: