Mercurial Hosting > freedit
comparison src/edit.js.luan @ 33:4fdc4ec0050b
upload with uploadcare
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 01 Aug 2022 22:50:16 -0600 |
parents | 66fd3784e60e |
children | 0c1b820fff34 |
comparison
equal
deleted
inserted
replaced
32:72a1b77b4548 | 33:4fdc4ec0050b |
---|---|
12 return function() | 12 return function() |
13 local post = Http.request.parameters.post or error() | 13 local post = Http.request.parameters.post or error() |
14 post = Post.get_by_id(post) or error() | 14 post = Post.get_by_id(post) or error() |
15 Io.stdout = Http.response.text_writer() | 15 Io.stdout = Http.response.text_writer() |
16 %> | 16 %> |
17 let postDiv = document.querySelector('[post="<%=post.id%>"]'); | 17 let postDiv = document.querySelector('[post="<%=post.id%>"]'); |
18 postDiv.querySelector('[output]').style.display = 'none'; | 18 postDiv.querySelector('[output]').style.display = 'none'; |
19 postDiv.querySelector('[edit]').innerHTML = document.querySelector('[hidden][edit]').innerHTML; | 19 postDiv.querySelector('[edit]').innerHTML = document.querySelector('[hidden][edit]').innerHTML; |
20 let textarea = postDiv.querySelector('textarea'); | 20 let textarea = postDiv.querySelector('textarea'); |
21 textarea.innerHTML = <%= json_string(html_encode(post.content)) %>; | 21 textarea.innerHTML = <%= json_string(html_encode(post.content)) %>; |
22 textarea.focus(); | 22 textarea.focus(); |
23 <% | 23 <% |
24 end | 24 end |