ngs / draft-js-markdown-shortcuts-plugin

A DraftJS plugin for supporting Markdown syntax shortcuts
https://ngs.github.io/draft-js-markdown-shortcuts-plugin/
MIT License
275 stars 107 forks source link

Incompatibility with create-react-app? #29

Open mtlatif opened 7 years ago

mtlatif commented 7 years ago

Hi,

I could not get the example code to run with create-react-app. I also tried a simple web pack deployment solution to no avail. I get several errors during markdown substitutions such as this one:

Uncaught TypeError: Cannot read property 'get' of undefined at getUpdatedSelectionState (http://localhost:3000/static/js/bundle.js:28787:35) at getDraftEditorSelectionWithNodes (http://localhost:3000/static/js/bundle.js:28298:23) at getDraftEditorSelection (http://localhost:3000/static/js/bundle.js:48661:10) at editOnSelect (http://localhost:3000/static/js/bundle.js:48143:27) at http://localhost:3000/static/js/bundle.js:44738:19 at Object.ReactErrorUtils.invokeGuardedCallback (http://localhost:3000/static/js/bundle.js:19854:16) at executeDispatch (http://localhost:3000/static/js/bundle.js:19361:21) at Object.executeDispatchesInOrder (http://localhost:3000/static/js/bundle.js:19384:5) at executeDispatchesAndRelease (http://localhost:3000/static/js/bundle.js:13363:22) at executeDispatchesAndReleaseTopLevel (http://localhost:3000/static/js/bundle.js:13374:10) at Array.forEach (native) at forEachAccumulated (http://localhost:3000/static/js/bundle.js:34862:9) at Object.processEventQueue (http://localhost:3000/static/js/bundle.js:13577:7) at runEventQueueInBatch (http://localhost:3000/static/js/bundle.js:68734:18) at Object.handleTopLevel [as _handleTopLevel] (http://localhost:3000/static/js/bundle.js:68745:5) at handleTopLevelImpl (http://localhost:3000/static/js/bundle.js:68832:24) at ReactDefaultBatchingStrategyTransaction.perform (http://localhost:3000/static/js/bundle.js:16234:20) at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:68575:26) at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:8655:27) at dispatchEvent (http://localhost:3000/static/js/bundle.js:68907:20) :3000/static/js/bundle.js:47692

I tested the demo code and it works perfectly fine. It's probably a silly oversight on my part but I can't figure out why the demo works but not any of my implementations.

Please look into it. Thanks

hugski commented 7 years ago

same issue with create-react-app

shot 2017-06-29 17 11 08
mxstbr commented 7 years ago

I can't confirm this, I'm running a huge create-react-app-based app and it's working perfectly!

mtlatif commented 7 years ago

I will test again and confirm. I was just watching your React Amsterdam video. You are an inspiration. Keep up the good work.

mxstbr commented 7 years ago

Thank you, I appreciate that! 😊

michaelcox commented 7 years ago

I had this issue when I was using 2.0.0-beta1 of draft-js-plugins-editor (the default at the time if you don't specify a version). I upgraded to 2.0.0-rc3 and the issue is no longer there.

lhnrd commented 7 years ago

Can confirm @michaelcox answer.