Implement preview for markdown and plain text thread
This commit is contained in:
parent
ce7ea8c755
commit
3c5f86c3de
@ -61,6 +61,7 @@ tests locally:
|
||||
|
||||
## TODOs
|
||||
|
||||
- Non-markdown posts will need to handle whitespace/newlines with CSS stuff
|
||||
- Do I need `SUM` for `by_id()`?
|
||||
|
||||
## AGPL-3.0+ANTIFA compliance
|
||||
|
@ -36,8 +36,6 @@ sub create($self) {
|
||||
|
||||
$self->session(author => $thread_author);
|
||||
|
||||
print $self->dumper($v);
|
||||
|
||||
unless ($preview) {
|
||||
my $new_thread_id = $self->thread->create(
|
||||
$thread_author,
|
||||
@ -51,7 +49,7 @@ sub create($self) {
|
||||
);
|
||||
}
|
||||
|
||||
$draft = $thread_body;
|
||||
$draft = {body => $thread_body, markdown => $markdown};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,13 @@
|
||||
% end
|
||||
<h2 class="page-title"><%= title %></h2>
|
||||
<form method="post" class="form-body">
|
||||
<% if ($draft) { =%>
|
||||
<% if (keys %{$draft}) { =%>
|
||||
<div class="form-preview">
|
||||
<%== markdown $draft =%>
|
||||
<% if ($draft->{'markdown'}) { =%>
|
||||
<%== markdown $draft->{'body'} =%>
|
||||
<% } else { =%>
|
||||
<%= $draft->{'body'} =%>
|
||||
<% } =%>
|
||||
</div>
|
||||
<% } =%>
|
||||
<div class="form-field">
|
||||
|
Loading…
x
Reference in New Issue
Block a user