Add auto-filled value for reply textarea

This commit is contained in:
Christian Bundy 2019-08-14 12:59:08 -07:00
parent d8001e6d76
commit f5962ad117
No known key found for this signature in database
GPG Key ID: EB541AAEF4366237
3 changed files with 15 additions and 5 deletions

View File

@ -229,7 +229,9 @@ progress {
textarea {
display: block;
width: 100%;
height: 8rem;
height: 16rem;
font-size: 1rem;
padding: 0.5rem;
}
/* content warning! */

View File

@ -13,7 +13,7 @@ const {
const template = require('./components/template')
module.exports = ({ avatarUrl, name, description, messages, feedId }) => {
const markdownMention = highlightJs.highlight('markdown', `[${name}](${feedId})`).value
const markdownMention = highlightJs.highlight('markdown', `[@${name}](${feedId})`).value
const prefix = section({ class: 'message' },
header({ class: 'profile' },

View File

@ -3,23 +3,31 @@
const {
button,
form,
p,
textarea
} = require('hyperaxe')
const template = require('./components/template')
const post = require('./components/post')
const apology = `sorry this sucks right now, it's just plaintext and won't even
create a mention to the person you're talking to -- soon it will be better!
const apology = `Hi! The reply is a work-in-progress and sort of sucks right now.
It should auto-generate a Markdown mention for the person you're replying to
and JSON mentions for anything you reference, but these messages are <strong>
public</strong>. Please do not share private information in this reply box.
`
module.exports = ({ message }) => {
const likeForm = `/reply/${encodeURIComponent(message.key)}`
const authorName = message.value.meta.author.name
const authorFeedId = message.value.author
const markdownMention = `[@${authorName}](${authorFeedId})\n\n`
return template(
post({ msg: message }),
form({ action: likeForm, method: 'post' },
textarea({ name: 'text', placeholder: apology }),
p({ innerHTML: apology }),
textarea({ autofocus: true, required: true, name: 'text' }, markdownMention),
button({
type: 'submit'
}, 'reply (public!!!)')