Mercurial Hosting > freedit
diff src/new_thread.html.luan @ 46:289718f121e4
use bbcode editor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 14 Nov 2022 18:43:38 -0700 |
parents | 0c1b820fff34 |
children | 78b2d6995244 |
line wrap: on
line diff
--- a/src/new_thread.html.luan Sun Nov 13 22:07:18 2022 -0700 +++ b/src/new_thread.html.luan Mon Nov 14 18:43:38 2022 -0700 @@ -17,7 +17,7 @@ if user==nil then return end if Http.request.method == "POST" then local subject = Http.request.parameters.subject or error() - local content = Http.request.parameters.content or error() + local content = Http.request.parameters.bbcode or error() local post = Post.new_thread(user,subject,content) Http.response.send_redirect("/thread.html?root="..post.id) return @@ -30,18 +30,9 @@ <% head() %> <title><%=forum_title%>: new thread</title> <style> - textarea { - width: 100%; - } + @import "/bbcode/bbcode.css"; </style> - <script> - function uploaded(input,url,filename) { - let textarea = document.querySelector('textarea'); - textarea.focus(); - textarea.setRangeText(url,textarea.selectionStart,textarea.selectionEnd,'select'); - } - </script> - </head> + <script src="/bbcode/bbcode.js"></script> <body> <% header() %> <div content> @@ -51,16 +42,15 @@ <label>Subject</label> <input name=subject required> </p> - <p><textarea name=content oninput="fixTextarea(this)"></textarea></p> - <p> - <input type=file onchange="upload(this,uploaded)"> - <button type=button onclick="fileButtonClick(this)">Upload File</button> - </p> + <p editor></p> <p><input type=submit></p> </form> </div> <% footer() %> </body> + <script> + bbcodeCreate('p[editor]'); + </script> </html> <% end