Amit Pandey
Amit Pandey

Reputation: 79

Integrate CkEditor 5 for Asp.net project

I want to integrate CKEditor 5 (Latest version) for Asp.net (C# & ASPX) Project. But NuGet package manager and other forums including Stackoverflow leads me to use CKEditor version 3.6.4. How can I user the latest version in Asp.net (C# & ASPX) Project?

Where can I get anything relevant on this?

-Thanks

Upvotes: 1

Views: 7569

Answers (2)

Damon Abdiel
Damon Abdiel

Reputation: 3453

Following the example of @Gagan Deep you can copy the content there every time CKEditor5 changes.

See this example:

ClassicEditor
        .create(document.querySelector('#txtarea'), {
        })
        .then(editor => {                
            editor.model.document.on('change', () => {
                console.log('The Document has changed!');
                $("#txtarea").html(editor.getData());
            });
        })
        .catch(error => {
            console.error(error);
        });

this code make the magic

.then(editor => {                
            editor.model.document.on('change', () => {
                console.log('The Document has changed!');
                $("#txtarea").html(editor.getData());
            });
        })

Upvotes: 0

Gagan Deep
Gagan Deep

Reputation: 1509

Example given on their website

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>CKEditor 5 – Classic editor</title>
    <script src="https://cdn.ckeditor.com/ckeditor5/12.0.0/classic/ckeditor.js"></script>
</head>
<body>
    <h1>Classic editor</h1>
    <asp:TextBox ID="txtarea" runat="server" ClientIDMode="Static"></asp:TextBox>
    <script>
        ClassicEditor
            .create( document.querySelector( '#txtarea' ) )
            .catch( error => {
                console.error( error );
            } );
    </script>
</body>
</html>

Upvotes: 6

Related Questions