后台文章编辑器HTML标签默认转义问题处理,新增表格无法保存文章问题

This commit is contained in:
hdm 2022-03-01 17:16:33 +08:00
parent bcc124fcc5
commit 3f8e6a5fb1
7 changed files with 24 additions and 6 deletions

View File

@ -148,6 +148,9 @@ class Article extends BaseController
{ {
$param = get_params(); $param = get_params();
if (request()->isAjax()) { if (request()->isAjax()) {
if (isset($param['table-align'])) {
unset($param['table-align']);
}
if (isset($param['docContent-html-code'])) { if (isset($param['docContent-html-code'])) {
$param['content'] = $param['docContent-html-code']; $param['content'] = $param['docContent-html-code'];
$param['md_content'] = $param['docContent-markdown-doc']; $param['md_content'] = $param['docContent-markdown-doc'];

View File

@ -148,6 +148,9 @@ class Goods extends BaseController
{ {
$param = get_params(); $param = get_params();
if (request()->isAjax()) { if (request()->isAjax()) {
if (isset($param['table-align'])) {
unset($param['table-align']);
}
if (isset($param['docContent-html-code'])) { if (isset($param['docContent-html-code'])) {
$param['content'] = $param['docContent-html-code']; $param['content'] = $param['docContent-html-code'];
$param['md_content'] = $param['docContent-markdown-doc']; $param['md_content'] = $param['docContent-markdown-doc'];

View File

@ -1,6 +1,10 @@
{extend name="common/base"/} {extend name="common/base"/}
<!-- 主体 --> <!-- 主体 -->
{block name="body"} {block name="body"}
<style type="text/css">
.editormd-code-toolbar select{display:inline-block}
.editormd li{list-style: inherit;}
</style>
<form class="layui-form body-table"> <form class="layui-form body-table">
<div class="layui-form-bar" style="padding-bottom:0"> <div class="layui-form-bar" style="padding-bottom:0">
<h3 class="h3-title">创建文章</h3> <h3 class="h3-title">创建文章</h3>
@ -101,7 +105,7 @@
<tr> <tr>
<td colspan="6"> <td colspan="6">
<div> <div>
<div id="mdContent" style="display:none;"></div> <textarea id="mdContent" style="display:none;"></textarea>
<div id="docContent"></div> <div id="docContent"></div>
</div> </div>
{include file="common/mdeditor" id="docContent" markdown="mdContent" sub="100" toolbar="[]" /} {include file="common/mdeditor" id="docContent" markdown="mdContent" sub="100" toolbar="[]" /}

View File

@ -1,6 +1,10 @@
{extend name="common/base"/} {extend name="common/base"/}
<!-- 主体 --> <!-- 主体 -->
{block name="body"} {block name="body"}
<style type="text/css">
.editormd-code-toolbar select{display:inline-block}
.editormd li{list-style: inherit;}
</style>
<form class="layui-form body-table"> <form class="layui-form body-table">
<div class="layui-form-bar" style="padding-bottom:0"> <div class="layui-form-bar" style="padding-bottom:0">
<h3 class="h3-title">编辑文章</h3> <h3 class="h3-title">编辑文章</h3>
@ -117,7 +121,7 @@
<tr> <tr>
<td colspan="6"> <td colspan="6">
<div style="margin-top:-2px; margin-right:2px"> <div style="margin-top:-2px; margin-right:2px">
<div id="mdContent" style="display:none;">{$article.md_content}</div> <textarea id="mdContent" style="display:none;">{$article.md_content|raw}</textarea>
<div id="docContent"></div> <div id="docContent"></div>
</div> </div>
{include file="common/mdeditor" id="docContent" markdown="mdContent" sub="100" toolbar="[]" /} {include file="common/mdeditor" id="docContent" markdown="mdContent" sub="100" toolbar="[]" /}

View File

@ -22,7 +22,7 @@
placeholder : "此处开始编写您要发布的内容...",//这里不设置则为默认的 placeholder : "此处开始编写您要发布的内容...",//这里不设置则为默认的
path : '/static/mdeditor/lib/', path : '/static/mdeditor/lib/',
height : window.innerHeight-editormdSub, height : window.innerHeight-editormdSub,
markdown : document.getElementById(editormdMarkdown).innerHTML, markdown : document.getElementById(editormdMarkdown).value,
htmlDecode : "style,script,iframe", htmlDecode : "style,script,iframe",
imageUpload: true, imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"], imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"],

View File

@ -17,6 +17,8 @@
top:1px; top:1px;
right:1px; right:1px;
} }
.editormd-code-toolbar select{display:inline-block}
.editormd li{list-style: inherit;}
</style> </style>
<form class="layui-form body-table"> <form class="layui-form body-table">
<div class="layui-form-bar" style="padding-bottom:0"> <div class="layui-form-bar" style="padding-bottom:0">
@ -145,7 +147,7 @@
<tr> <tr>
<td colspan="6"> <td colspan="6">
<div> <div>
<div id="mdContent" style="display:none;"></div> <textarea id="mdContent" style="display:none;"></textarea>
<div id="docContent"></div> <div id="docContent"></div>
</div> </div>
{include file="common/mdeditor" id="docContent" markdown="mdContent" sub="100" toolbar="[]" /} {include file="common/mdeditor" id="docContent" markdown="mdContent" sub="100" toolbar="[]" /}

View File

@ -17,6 +17,8 @@
top:1px; top:1px;
right:1px; right:1px;
} }
.editormd-code-toolbar select{display:inline-block}
.editormd li{list-style: inherit;}
</style> </style>
<form class="layui-form body-table"> <form class="layui-form body-table">
<div class="layui-form-bar" style="padding-bottom:0"> <div class="layui-form-bar" style="padding-bottom:0">
@ -161,8 +163,8 @@
</tr> </tr>
<tr> <tr>
<td colspan="6"> <td colspan="6">
<div> <div>
<div id="mdContent" style="display:none;">{$goods.md_content}</div> <textarea id="mdContent" style="display:none;">{$goods.md_content|raw}</textarea>
<div id="docContent"></div> <div id="docContent"></div>
</div> </div>
{include file="common/mdeditor" id="docContent" markdown="mdContent" sub="100" toolbar="[]" /} {include file="common/mdeditor" id="docContent" markdown="mdContent" sub="100" toolbar="[]" /}