Closed mehmetron closed 4 years ago
This is probably better asked on Stack Overflow rather than raised as an issue on the project, but yes, probably.
Each editor is its own React component and you have multiple instances of CodeMirror itself.
I ask because in the Codemirror docs you can create multiple editor instances
Each editor is associated with an instance of CodeMirror.Doc, its document. A document represents the editor content, plus a selection, an undo history, and a mode. A document can only be associated with a single editor at a time. You can create new documents by calling the CodeMirror.Doc(text: string, mode: Object, firstLineNumber: ?number, lineSeparator: ?string) constructor. The last three arguments are optional and can be used to set a mode for the document, make it start at a line number other than 0, and set a specific line separator respectively.
And I was wondering if react-codemirror2 supports this functionality
Yes, it does. You can see it working here. https://codesandbox.io/s/intelligent-star-i7r73?file=/src/App.js
I'm trying to implement a sort of file system where there are multiple editors with separate content that the user can switch through.
Can I implement something like this using react-codemirror2?