由海誉_荷兰豆于2019-12-21 11:54回答
问题解决,顺带解决官方外置上传图片插件:
/admin/template/product.html,表单
<dl>
<dt valign="top">{$lang.article_content}</dt>
<dd>
<!-- TinyMCE -->
<script type="text/javascript">init_editer('secontent', '{$cur}', '{$article.id}')</script>
<textarea id="secontent" name="secontent" rows="20">{$article.secontent}</textarea>
<!-- /TinyMCE -->
</dd>
</dl>
/admin/include/tinymce/init.js,添加函数:
function init_editer(selecter = 'content', module, item_id = ''){
console.log(item_id);
tinymce.init({
selector:'textarea#' + selecter,
language:'zh_CN',
width:'800px',
height:'360px',
menubar:false,
skin:'simple',
theme:'simple',
convert_urls :false,
automatic_uploads: false,
images_upload_url: 'file.php?rec=mce&module=' + module + '&item_id=' + item_id + '&type=' + selecter,
plugins: [
'autolink lists link charmap textcolor',
'code hr pagebreak map textpattern image imagetools',
'media table help wordcount fullscreen image'
],
toolbar: 'fontsizeselect bold italic strikethrough forecolor backcolor alignleft aligncenter alignright alignjustify outdent indent numlist bullist code | link unlink image media map charmap table hr removeformat undo redo help fullscreen'
});
}
/admin/file.php,添加文件上传的代码就可以了
elseif ($rec == 'mce') {
// hidden code , need contact qq:67052796
echo json_encode($html);
}
有用(0) 没用(0)