最近,我将 TinyMCE 集成到了Laravel应用程序中,并安装了 Laravel文件管理器,以便从公用文件夹访问文件。当我单击TinyMCE上的图像图标时,模态很好。但是,在单击调用Laravel File Manager的文件浏览器图标时,出现404错误页面-“ 抱歉,找不到您要查找的页面”。
下面是create.blade.php中的tinyMCE代码
<textarea name="body" id="postbody" spellcheck="false" rows="20" required>{!! old('body') !!}</textarea>
<button type="submit" id="publish" class="mt-10 genric-btn primary x-large w3-right" style="font-size:18px; float:right; margin-left:auto !important"> <i class="fas fa-send"> </i>
Publish
</button>
@push('scripts')
<script>
var editor_config = {
path_absolute: "{{ URL('/') }}/",
selector: "textarea#postbody",
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor colorpicker textpattern"
],
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media",
relative_urls: false,
file_browser_callback : function(field_name, url, type, win) {
var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight;
var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name;
if (type == 'image') {
cmsURL = cmsURL + "&type=Images";
} else {
cmsURL = cmsURL + "&type=Files";
}
tinyMCE.activeEditor.windowManager.open({
file : cmsURL,
title : 'FileManager',
width : x * 0.8,
height : y * 0.8,
resizable : "yes",
close_previous : "no"
});
}
};
tinymce.init(editor_config);
</script>
@endpush
当然在我的post.blade.php中,我在底部有此内容:
@stacks('scripts')
这里Laravel File Manager 404 error提出了类似的问题,但该解决方案在我的情况下不起作用。
请提供任何帮助。谢谢大家