Fix #4230: Inconsistency between DText preview and DText renders of inline DText.

This commit is contained in:
evazion
2019-12-28 13:26:33 -06:00
parent bb4be383b9
commit 27c797f5c6
4 changed files with 15 additions and 18 deletions

View File

@@ -1,5 +1,8 @@
class DtextPreviewsController < ApplicationController
def create
render :inline => "<%= format_text(params[:body]) %>"
@inline = params[:inline].to_s.truthy?
@disable_mentions = params[:disable_mentions].to_s.truthy?
render inline: "<%= format_text(params[:body], inline: @inline, disable_mentions: @disable_mentions) %>"
end
end

View File

@@ -21,20 +21,14 @@ Dtext.initialize_expandables = function() {
});
}
Dtext.call_preview = function(e, $button, $input, $preview) {
Dtext.call_preview = async function(e, $button, $input, $preview) {
$button.val("Edit");
$input.hide();
$preview.text("Loading...").fadeIn("fast");
$.ajax({
type: "post",
url: "/dtext_preview",
data: {
body: $input.val()
},
success: function(data) {
$preview.html(data).fadeIn("fast");
}
});
let inline = $input.is("input");
let html = await $.post("/dtext_preview", { body: $input.val(), inline: inline });
$preview.html(html).fadeIn("fast");
}
Dtext.call_edit = function(e, $button, $input, $preview) {

View File

@@ -20,9 +20,9 @@
<tr>
<td><%= PostPresenter.preview(post_appeal.post, :tags => "status:any") %></td>
<td>
<div class="prose">
<%= format_text post_appeal.reason %>
</div>
<span class="prose">
<%= format_text post_appeal.reason, inline: true %>
</span>
</td>
<td>
<%= link_to post_appeal.post.appeals.size, post_appeals_path(search: { post_id: post_appeal.post_id }) %>

View File

@@ -21,9 +21,9 @@
<tr class="resolved-<%= post_flag.is_resolved? %>">
<td><%= PostPresenter.preview(post_flag.post, :tags => "status:any") %></td>
<td>
<div class="prose">
<%= format_text post_flag.reason %>
</div>
<span class="prose">
<%= format_text post_flag.reason, inline: true %>
</span>
</td>
<td>
<%= link_to post_flag.post.flags.size, post_flags_path(search: { post_id: post_flag.post_id }) %>