Kindling / react-tinymce-mention

@Mentions functionality for TinyMCE, built with React and Redux
MIT License
20 stars 15 forks source link

Using Mention Causes TinyMCE to not fire Change events #12

Open homerlex opened 7 years ago

homerlex commented 7 years ago

If I have "mention" in the list of plugins (as shown in the code below) I stop getting onChange and onKeyUp events from TinyMCE.

Using cdn.tinymce.com/4/tinymce.min.js

Any idea why this would be? Are there any full working code examples somewhere using this plugin?

             <Mention
                    dataSource={[
                        'hello',
                        'helloooo',
                        'hello0',
                        'howdy']}
                    delimiter={'@'}
                />

                <TinyMCE
                    content={this.props.document.editorState}
                    config={{
                        plugins: 'autolink link image lists print preview mention',
                        toolbar: 'undo redo | bold italic | alignleft aligncenter alignright'
                    }}
                    onChange={this.handleEditorChange}
                    onKeyup={this.handleEditorChange} // ... because onChange isn't enough :-/
                />
deltamualpha commented 7 years ago

Yes, there's examples in this repo. Pull the repo, run npm install, uncomment the relevant line for the example you wish to experiment with in src/index.js, and run npm start. I'm guessing that your problem is caused by this plugin's use of event.preventDefault(); in its listener methods, but I'm not certain.

homerlex commented 7 years ago

Thank for the pointer to the example. I added an onChange event to your Editor and confirmed the same behavior there. At least its consistent to what I'm seeing in my app :-)