1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Better textarea sizing

This commit is contained in:
Zack Scholl 2016-02-08 08:42:19 -05:00
parent 21c840857a
commit 8d8472029d
2 changed files with 5 additions and 2 deletions

View File

@ -29,10 +29,13 @@ func editNote(c *gin.Context) {
if locked { if locked {
c.Redirect(302, "/"+title+"/view") c.Redirect(302, "/"+title+"/view")
} else { } else {
currentText := getCurrentText(title)
numRows := len(strings.Split(currentText, "\n")) + 10
c.HTML(http.StatusOK, "index.tmpl", gin.H{ c.HTML(http.StatusOK, "index.tmpl", gin.H{
"Title": title, "Title": title,
"ExternalIP": RuntimeArgs.ExternalIP, "ExternalIP": RuntimeArgs.ExternalIP,
"CurrentText": getCurrentText(title), "CurrentText": currentText,
"NumRows": numRows,
}) })
} }
} }

View File

@ -73,7 +73,7 @@
<form action='#' id="emit" method="post" name="emit"> <form action='#' id="emit" method="post" name="emit">
<div> <div>
<textarea autofocus rows=500 class='auto_submit_item' id="emit_data" name="emit_data" placeholder="Start typing, it will save automatically. <textarea autofocus rows={{ .NumRows }} class='auto_submit_item' id="emit_data" name="emit_data" placeholder="Start typing, it will save automatically.
Go to cowyo.com/{{ .Title }} to reload this page. Go to cowyo.com/{{ .Title }} to reload this page.
Do not post anything private. Do not post anything private.
Anyone with the URL can access this note.">{{ .CurrentText }}</textarea> Anyone with the URL can access this note.">{{ .CurrentText }}</textarea>