Mercurial Hosting > freedit
view src/edit.js.luan @ 56:7ce54f6d93f2
add change name
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 28 Nov 2022 22:00:43 -0700 |
parents | 289718f121e4 |
children | 8b5b1bce7d6b |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local Html = require "luan:Html.luan" local html_encode = Html.encode or error() local Parsers = require "luan:Parsers.luan" local json_string = Parsers.json_string or error() local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Post = require "site:/lib/Post.luan" return function() local post = Http.request.parameters.post or error() post = Post.get_by_id(post) or error() Io.stdout = Http.response.text_writer() %> let postDiv = document.querySelector('[post="<%=post.id%>"]'); postDiv.querySelector('[output]').style.display = 'none'; bbcodeCreate( postDiv.querySelector('[edit]'), { content: <%= json_string(html_encode(post.content)) %>, save: saveEdit, cancel: cancelEdit, } ); let textarea = postDiv.querySelector('textarea'); textarea.focus(); <% end