4in1_ws_web/classes/handler/admin/MarkdownPreviewHandler.php
2023-12-30 23:29:31 +00:00

22 lines
535 B
PHP

<?php
namespace handler\admin;
use Response;
class MarkdownPreviewHandler extends AdminRequestHandler {
public function post(): Response {
list($md, $title, $use_image_previews) = $this->input('md, title, b:use_image_previews');
$html = \markup::markdownToHtml($md, $use_image_previews);
$ctx = new \SkinContext('\\skin\\admin');
$html = $ctx->markdownPreview(
unsafe_html: $html,
title: $title
);
return new \AjaxOkResponse(['html' => $html]);
}
}