How to config and use ckFinder 3 with ASP.NET Core 6?

739 Views Asked by At

How to config and use ckFinder in ckeditor5 and connect to ASP.NET Core 6 (.NET Core - not .NET Standard).

1

There are 1 best solutions below

0
On

Here is my test result.

enter image description here

My Test Code

1. Method in HomeController

public IActionResult _75584461()
{
    return View();
}

2. .cshtml

@using System.Net;
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
    ViewData["Title"] = "ckfinder Page";
}
<script src="https://cdn.ckeditor.com/ckeditor5/29.2.0/classic/ckeditor.js"></script>
<script src="https://ckeditor.com/apps/ckfinder/3.5.1/ckfinder.js"></script>

<div id="editor">
    <p>Here goes the initial content of the editor.</p>
</div>


@section Scripts {
    @{

        await Html.RenderPartialAsync("_ValidationScriptsPartial");
        <script>
            ClassicEditor
                .create(document.querySelector('#editor'), {
                    ckfinder: {
                        uploadUrl: '/ckfinder/core/connector/aspx?command=QuickUpload&type=Files&responseType=json'
                    },
                    toolbar: ['ckfinder', 'imageUpload', '|', 'heading', '|', 'bold', 'italic', '|', 'undo', 'redo']
                })
                .then(editor => {
                    console.log('Editor was initialized', editor);
                })
                .catch(error => {
                    console.error(error.stack);
                });
        </script>

    }
    }