margox / braft-editor

美观易用的React富文本编辑器,基于draft-js开发
MIT License
4.61k stars 593 forks source link

@types are not updated #219

Closed nikola1970 closed 5 years ago

nikola1970 commented 6 years ago

Your example says:

import BraftEditor, { EditorState } from 'braft-editor';

but TypeScript is complaining:

has no exported member 'EditorState'.`

And there is no updated types for new version 2.0.5

petitspois commented 6 years ago

typescript : import * as BraftEditor from 'braft-editor'

nikola1970 commented 6 years ago

It does not help because:

TS2339: Property 'EditorState' does not exist on type 'typeof BraftEditor'

so because of that, this is not working:

BraftEditor.EditorState.createFrom(htmlContent)

margox commented 6 years ago

I don't know much about TypeSrcipt, I haven't used it basically, the old version of @types/braft-editor file is done by one of my friends(@petitspois ), the new version of Braft Editor is not compatible with it, so if you use the new version, please do not install @types/braft-editor. I will also get to know TypeScript as soon as possible and provide a usable @types/braft-editor as fast as I can.