Ckeditor5-react: how can i use ckeditor5 with typescript in react?

Created on 14 Nov 2018  路  9Comments  路  Source: ckeditor/ckeditor5-react

馃啎 Feature request

馃捇 Version of CKEditor

CKEditor5

docs feature devops

Most helpful comment

Hello.

declare module '@ckeditor/ckeditor5-react' {
    import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
    import Event from '@ckeditor/ckeditor5-utils/src/eventinfo'
    import { EditorConfig } from '@ckeditor/ckeditor5-core/src/editor/editorconfig'
    import * as React from 'react';
    const CKEditor: React.FunctionComponent<{
        disabled?: boolean;
        editor: typeof ClassicEditor;
        data?: string;
        id?: string;
        config?: EditorConfig;
        onReady?: (editor: ClassicEditor) => void;
        onChange?: (event: Event, editor: ClassicEditor) => void;
        onBlur?: (event: Event, editor: ClassicEditor) => void;
        onFocus?: (event: Event, editor: ClassicEditor) => void;
        onError?: (event: Event, editor: ClassicEditor) => void;
    }>
    export { CKEditor };
}

make sure install base ckeditor types.

All 9 comments

Hi, @abhig02.

What actually do you need?

Closing because of lack of activity and missing problem description.

Looking for a declaration file for the npm module '@ckeditor/ckeditor5-react'.

Hi, @intelliapps-io!

We don't provide any TS declaration files for our packages yet. Maybe it will change in the future, you can subscribe to the https://github.com/ckeditor/ckeditor5/issues/504 if you want to track this topic.

Hello.

declare module '@ckeditor/ckeditor5-react' {
    import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
    import Event from '@ckeditor/ckeditor5-utils/src/eventinfo'
    import { EditorConfig } from '@ckeditor/ckeditor5-core/src/editor/editorconfig'
    import * as React from 'react';
    const CKEditor: React.FunctionComponent<{
        disabled?: boolean;
        editor: typeof ClassicEditor;
        data?: string;
        id?: string;
        config?: EditorConfig;
        onReady?: (editor: ClassicEditor) => void;
        onChange?: (event: Event, editor: ClassicEditor) => void;
        onBlur?: (event: Event, editor: ClassicEditor) => void;
        onFocus?: (event: Event, editor: ClassicEditor) => void;
        onError?: (event: Event, editor: ClassicEditor) => void;
    }>
    export { CKEditor };
}

make sure install base ckeditor types.

Hello @ma2ciek! I am looking for the types too and in my case for the balloon editor. This is blocking our further development with CKEditor. I see that this issue was recently reopened and triaged. When can we expect the types to be released?

@arasrezaei Do you know if @ckeditor/ckeditor5-react supports ref?

@arasrezaei Do you know if @ckeditor/ckeditor5-react supports ref?

Was this page helpful?
0 / 5 - 0 ratings