Files
simple-aircraft-manager-rails/app/javascript/controllers/insert_text_controller.js
T
rickyandClaude Opus 5.5 76643de2e7 Procedures: suggested text from the installation's settings; blanks block adoption
- Insert suggested text for Hosting and network (HTTPS, sign-in mode,
  password/lockout rules, Docker) and Additional procedures (common
  Part 91 procedures; electronic-records date filled in), with
  [bracketed] blanks for what only the owner knows
- A revision can't be adopted while a [blank] is left (Markdown links ok)
- Generated sections state HTTPS and the sign-in mode from the config

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 15:35:41 -05:00

18 lines
530 B
JavaScript

import { Controller } from "@hotwired/stimulus"
// Fills a textarea with suggested text (asks before replacing what's there).
export default class extends Controller {
static targets = ["field"]
static values = { text: String }
insert(event) {
event.preventDefault()
const field = this.fieldTarget
if (field.value.trim() && !confirm("Replace what's in the box with the suggested text?")) return
field.value = this.textValue
field.focus()
field.setSelectionRange(0, 0)
field.scrollTop = 0
}
}