Uncaught TypeError with React component when deleting text

I just started using the React component version that I installed via npm. When I mark a block and delete it, I get Uncaught TypeError: text.trim is not a function from_text.js:16 Am I missing something obvious?

That rather sounds like a bug in the React component. I can’t reproduce it with just ProseMirror.

OK. I will try to debug it when I get a chance. Cheers…

It’s hard to be sure without seeing the code and/or more stack trace, but it sounds like there may be a mismatch between your docFormat and the value you’re feeding into the component. Please feel free to post more details (ideally a jsfiddle) over at https://github.com/tgecho/react-prosemirror/issues if you can’t figure it out. If nothing else there might be room for better error messaging either in the component (which is unofficial) or ProseMirror itself.

I finally got around to it. It fails when there you delete all the text. The code fails in format/from_text.js. The code is expecting a string, but when all the text is deleted it receives a false for text parameter. Either the caller of this routine needs to check for it and not send a false or fromText needs to check for type to make sure it is a string. For now I patched my version to avoid the problem - hopefully someone more familiar with the code can fix it,

Sidebar: Is there an option to turn on line numbers? Cheers…

If you want line numbers you may be looking for a text editor – http://codemirror.net

I’m pretty sure that ProseMirror will never have line numbers.

It sounds like you were stumbling across this issue: https://github.com/tgecho/react-prosemirror/issues/8, which has since been fixed. Please note that “react-prosemirror” is not an official part of ProseMirror, and marijn isn’t responsible for its temporary sketchiness. :slight_smile: