feat(admin): 新增 markdown 编辑器支持,integrate EasyMDE markdown editor for admin interface

Introduce the EasyMDE markdown editor into the admin interface, providing enhanced
markdown editing capabilities. This integration caters to users preferring a dedicated
markdown editor with additional features and a streamlined user experience.
This commit is contained in:
wolfcode
2024-09-02 16:09:36 +08:00
parent 857533704e
commit ea733d0acb
6 changed files with 8641 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ return [
'ueditor' => '百度编辑器(不建议使用)',
'ckeditor' => 'CK编辑器',
'wangEditor' => 'wangEditor(推荐使用)',
'EasyMDE' => 'EasyMDE(markdown)',
],
];

View File

@@ -10,6 +10,13 @@
<script src="/static/plugs/wangEditor/dist/index.js?v={$version}"></script>
{/case}
{case EasyMDE}
<link rel="stylesheet" href="/static/plugs/easymde/easymde.min.css?v={$version}">
<script src="/static/plugs/easymde/easymde.min.js?v={$version}"></script>
{/case}
{default /}
<script src="/static/plugs/ueditor/ueditor.config.js?v={$version}" charset="utf-8"></script>

View File

@@ -112,6 +112,7 @@ if (!function_exists('auth')) {
return match ($editor_type) {
'ckeditor' => "<textarea name='{$name}' rows='20' class='layui-textarea editor' placeholder='{$placeholder}'>{$detail}</textarea>",
'ueditor' => "<script type='text/plain' id='{$name}' name='{$name}' class='editor' data-content='{$detail}'></script>",
'EasyMDE' => "<textarea id='{$name}' class='editor' name='{$name}'>{$detail}</textarea>",
default => "<div class='wangEditor_div'><textarea name='{$name}' rows='20' class='layui-textarea editor layui-hide'>{$detail}</textarea><div id='editor_toolbar_{$name}'></div><div id='editor_{$name}' style='height: 300px'></div></div>",
};
}

View File

@@ -1363,6 +1363,10 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
layer.msg(e.message)
}
break;
case 'EasyMDE':
var name = $(this).attr("name");
dataField[name] = (window["easyMDE" + i]).value()
break;
default:
var name = $(this).attr("id");
dataField[name] = UE.getEditor(name).getContent();
@@ -1567,6 +1571,13 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
config: {}
})
break;
case 'EasyMDE':
const easyMDEName = "easyMDE" + i
window[easyMDEName] = new EasyMDE({
element: document.getElementById($(this).attr("name")),
initialValue: $(this).text(),
});
break;
default:
let name = $(this).attr("name");
let content = $(this).data('content')

File diff suppressed because one or more lines are too long

8614
public/static/plugs/easymde/easymde.min.js vendored Normal file

File diff suppressed because one or more lines are too long