Auto-focus the post text box on new post

This commit is contained in:
Leon Mika 2026-02-24 22:26:25 +11:00
parent 44d35c6ccb
commit c943864edc
2 changed files with 3 additions and 2 deletions

View file

@ -2,12 +2,13 @@ import { Controller } from "@hotwired/stimulus"
import { showToast } from "../services/toast";
export default class PosteditController extends Controller {
static targets = ['bodyTextEdit'];
static values = {
saveAction: String,
};
connect() {
console.log("connected");
this.bodyTextEditTarget.focus();
}
async save(ev) {

View file

@ -9,7 +9,7 @@
<input type="text" name="title" class="form-control" placeholder="Title" value="{{ .post.Title }}">
</div>
<div>
<textarea name="body" class="form-control" rows="3">{{.post.Body}}</textarea>
<textarea data-postedit-target="bodyTextEdit" name="body" class="form-control" rows="3">{{.post.Body}}</textarea>
</div>
<div>
{{ if $isPublished }}