Draft-js-plugins: [Mention Plugin] Uncaught TypeError in readonly mode with empty mention and mentionDecorator

Created on 18 Feb 2021  路  3Comments  路  Source: draft-js-plugins/draft-js-plugins

Environment

Description

Bug:
Trigger mention popup.
Either leave it empty or type a non-existing username. (eg. "some text @ more text" or "some text @randomname1234")
Safe text
Render text with readonly=true and mentionDecorator with mention styles

<Editor
                onChange={onChange}
                editorState={editorState}
                readOnly={true}
                decorators={mentionDecorator}
            />

Got Uncaught TypeError: props.store.getEditorState is not a function
image

Expected behavior:
Mentions that can't be rendered display as plain text
Mentions that can be rendered display with styles from mentionDecorator

Reproducible Demo

bug

All 3 comments

Can you provide a full reproducible demo as the code from the storybook works for me? What kind of mentionDecorator are you using?

@fxOne thanks for a quick response.
after trying to reproduce it, I found out that if I add _plugins={[mentionPlugin]}_
making it:
<Editor onChange={handleTextChange} editorState={editorState} readOnly={true} plugins={[mentionPlugin]} decorators={mentionDecorator} />
instead of:
<Editor onChange={onChange} editorState={editorState} readOnly={true} decorators={mentionDecorator} />
it fixes my issue

@oleksandraab I guess we can close this issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kaustubh-karkare picture kaustubh-karkare  路  3Comments

paglias picture paglias  路  4Comments

berdof picture berdof  路  5Comments

Hongbo-Miao picture Hongbo-Miao  路  3Comments

gnestor picture gnestor  路  3Comments