ckeditor / ckeditor5-react

Official CKEditor 5 React component.
https://ckeditor.com/ckeditor-5
Other
425 stars 99 forks source link

Custom Installation setup via Online builder integrations with next-js does not work types in relation to 'create' property missing in '{ Editor: typeof Editor; EditorWatchdog: typeof EditorWatchdog; }', assistance needed! #433

Closed jasmeet2021 closed 11 months ago

jasmeet2021 commented 12 months ago

Errors:

editor={Editor}

Property 'create' is missing in type '{ Editor: typeof Editor; EditorWatchdog: typeof EditorWatchdog; }' but required in type '{ create(...args: any): Promise; }'

const data = editor.getData();

Property 'getData' does not exist on type 'Editor'.

Code:

'use client';

import React from 'react';
import { CKEditor } from "@ckeditor/ckeditor5-react";
import Editor from "ckeditor5-custom-build";

const editorConfiguration = {
    toolbar: [
        'heading',
        '|',
        'bold',
        'italic',
        'link',
        'bulletedList',
        'numberedList',
        '|',
        'outdent',
        'indent',
        '|',
        'imageUpload',
        'blockQuote',
        'insertTable',
        'mediaEmbed',
        'undo',
        'redo'
    ]
};

function CustomEditor( props: any ) {
        return (
            <CKEditor
                editor={ Editor }
                config={ editorConfiguration }
                data={ props.initialData }
                onChange={ (event, editor ) => {
                    const data = editor.getData();
                    console.log( { event, editor, data } );
                } }
            />
        )
}

export default CustomEditor;

dependencies:

"@ckeditor/ckeditor5-react": "^6.2.0", "ckeditor5-custom-build": "file:ckeditor5-40.1.0-6j2qd56wfdru",

jasmeet2021 commented 11 months ago

Shifted to https://github.com/ckeditor/ckeditor5/issues/15437

jasmeet2021 commented 11 months ago

https://github.com/ckeditor/ckeditor5-react/issues/433#issuecomment-1835536737

andrewlewinphsa commented 9 months ago

I just came across this issue, the custom plugin's ckeditor.d.ts still needs the base class to be in the node modules. For example @ckeditor/ckeditor5-editor-decoupled or @ckeditor/ckeditor5-editor-classic. Depending on your setup. Without the base class installed, the create method will not be evaluated.