lundi 26 juillet 2021

how to setup ckfinder to display image folder after installing in laravel?

I have downloaded and installed the CKfinder 3.5.1.2 laravel package. I have also created a custom build for my CKeditor. So far so good.

Here is my test page.

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<title>CKEditor 5 ClassicEditor build + CKfinder</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
@include('ckfinder::setup')
<div>
<textarea class="textarea " id="editor">
<h2>Hello</h2>
</textarea>
</div>
<script src="/public/ckeditor/ckeditor.js"></script>
<script src="/public/ckeditor/ckfinder.js"></script>
<script>CKFinder.config( { connectorPath: '/public/ckfinder/connector' } );</script>
<script type="text/javascript">
ClassicEditor
    .create( document.querySelector( '#editor' ), {     
        ckfinder: {
            uploadUrl: '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json'
        },
        toolbar: {
            items: [
                'sourceEditing','heading','bold','italic','subscript','superscript','specialCharacters','|',
                'fontFamily','fontSize','fontColor','fontBackgroundColor','|',
                'alignment','indent','outdent','numberedList','bulletedList','|',
                'link','insertTable','|',
                'imageUpload','imageInsert','CKFinder','mediaEmbed','|',
                'findAndReplace','highlight','removeFormat','undo','redo'
            ]
        },
        language: 'en-gb',
        image: {
            toolbar: [
                'imageTextAlternative','imageStyle:inline','imageStyle:block','imageStyle:side'
            ]
        },
        table: {
            contentToolbar: [
                'tableColumn','tableRow','mergeTableCells','tableCellProperties','tableProperties'
            ]
        },
        licenseKey: '',     
    } )
    .then( editor => {
        window.editor = editor;
    } )
    .catch( error => {
        console.error( error );
    } )
    ;
</script>
</body>
</html>

The problem is that when I click on the CKfinder icon, the popup window displays my home page without any css.

1/ I have not found a clear explanation on how to setup the uploadUrl for CKfinder so I left it as provided in the sample. I guess that this url should point to the location of the connector.php file? Where should the file be placed?

2/ In the vendor/ckfinder-laravel-package, the routes.php contains the following routes:

Route::any('/ckfinder/connector', '\CKSource\CKFinderBridge\Controller\CKFinderController@requestAction')
    ->name('ckfinder_connector');

Route::any('/ckfinder/browser', '\CKSource\CKFinderBridge\Controller\CKFinderController@browserAction')
    ->name('ckfinder_browser');

Route::any('/ckfinder/examples/{example?}', '\CKSource\CKFinderBridge\Controller\CKFinderController@examplesAction')
    ->name('ckfinder_examples');

Should I copy these routes in my own file and change the "\CKFinderBridge\Controller..." to the correct path?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire