mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
新增面板新增markdown导出
This commit is contained in:
@@ -4,11 +4,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\tools\PostBlock;
|
||||
use app\model\Category;
|
||||
use app\model\Post as ModelPost;
|
||||
use app\model\PostCategory;
|
||||
use app\model\PostTag;
|
||||
use app\model\Tag;
|
||||
use League\HTMLToMarkdown\HtmlConverter;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Route;
|
||||
use think\facade\View;
|
||||
@@ -29,7 +31,7 @@ class Post extends Common
|
||||
->where('type', $this->request->param('type', 1))
|
||||
->order('id desc')
|
||||
->paginate([
|
||||
'query' =>$this->request->get()
|
||||
'query' => $this->request->get()
|
||||
]);
|
||||
|
||||
View::assign('list', $list);
|
||||
@@ -91,6 +93,17 @@ class Post extends Common
|
||||
return $this->success('添加成功', url('index', ['type' => $this->request->param('type')]));
|
||||
}
|
||||
|
||||
public function convertHtml2Markdown()
|
||||
{
|
||||
$content = $this->request->post('content');
|
||||
|
||||
$converter = new HtmlConverter();
|
||||
|
||||
$markdown = $converter->convert($content);
|
||||
|
||||
return json_message(['markdown' => $markdown]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示指定的资源
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user