Move initial cursor place to the end for @mention reply (#375)

This commit is contained in:
TAKAHASHI Shuuji 2023-01-09 04:22:45 +09:00 committed by GitHub
parent c5c0e2bfe5
commit b5b4a8ac5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -60,6 +60,11 @@ class Compose(FormView):
self.fields["text"].widget.attrs[
"_"
] = f"""
init
-- Move cursor to the end of existing text
set my.selectionStart to my.value.length
end
on load or input
-- Unicode-aware counting to match Python
set characters to Array.from(my.value.trim()).length