我对此进行了研究,发现了很多集成 CKEditor 的方法,但我在集成 CKFinder 时遇到了问题。我的网站是由其他人创建的,但我觉得我可以自己整合它。
该网站包含文章,我有一个使用 CKEditor 的“ View ”。它工作得很好,但我无法将图像上传到服务器或浏览服务器图像以在 CKEditor 中插入照片。所以我不能在文章文本中添加照片。我希望 CKFinder 能解决这个问题。
我已经上传了 CKFinder 文件并将它们放在与 CKEditor 相同的位置。在我的 addcontent.php 中,我在 header 中声明了 CKEditor 代码。
<script src="<?php echo base_url(); ?>plugins/ckeditor/ckeditor.js"></script>
这是 ckeditor 文本区域:
<div class="form-group">
<label>Content Text</label>
<textarea class="form-control" id="description" name="text" rows="3"></textarea><div id="des_error" class="text-danger"></div>
</div>
这是 ckeditor 函数:
<script type="text/javascript">
$(function () {
// Replace the <textarea id="editor1"> with a CKEditor
// instance, using default configuration.
CKEDITOR.replace('description');
//bootstrap WYSIHTML5 - text editor
$(".textarea").wysihtml5();
如果我像这样在 header 中声明 ckfinder:
<script src="<?php echo site_url(); ?>plugins/ckfinder/ckfinder.js"></script>
如何修改代码以允许 CKFfinder 与 CKEditor 一起工作,以便我可以在文章文本中浏览和上传文件?
作为旁注,我没有看到任何 Controller 中定义的 CKEditor。
最佳答案
您可以使用 responsivefilemanager : https://www.responsivefilemanager.com/#download-section
<script>
CKEDITOR.replace('description', {
filebrowserBrowseUrl: '<?php echo base_url();?>filemanager/dialog.php?type=2&editor=ckeditor&fldr=',
filebrowserUploadUrl: '<?php echo base_url();?>filemanager/dialog.php?type=2&editor=ckeditor&fldr=',
filebrowserImageBrowseUrl: '<?php echo base_url();?>filemanager/dialog.php?type=1&editor=ckeditor&fldr='
});
</script>
你应该在 filemanager\config\config.php 更改配置文件
upload_dir' => '/uploadfilemanager/source/', //Upload folder
'thumbs_base_path' => '../thumbs/', //Thumbnail folder
'current_path' => '../source/', // The current path that you're using CKEditor
关于javascript - 如何在 CodeIgniter 中集成 CKFinder 和 CKEditor?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41051076/