CodeMirror 6
codemirror.net
codemirror.net
VS Code's editor is actually available as a separate NPM package as Monaco[0], which is great because it means that you can trivially get LSP support. For example:
^ Sorbet (Ruby type checker) implements the LSP protocol and can be compiled to WASM. So by using Monaco in the browser, we get a playground that supports all the same features as you'd get in VS Code.
It's the same for the TypeScript Playground[1].
There's a lot of great work in this release of CodeMirror. I'm especially excited to see mobile support as a headline feature, because that's completely lacking in Monaco. Maybe LSP support can be a future improvement.
For it to be an IDE it would need to support developing Website end to end across all layers.
By the way I use present tense, as Dreamweaver is still around, https://www.adobe.com/products/dreamweaver.html
I was just joking about the debate, which is running since Macromedia’s times.
Running graphical tools as external processes in their own windows misses the I in IDE.
"Please note that this repository contains no source code for the code editor, it only contains the scripts to package everything together and ship the monaco-editor npm module."
It's not just Monaco... pretty much all the available text editor components (beyond a plain raw textarea) suck bigly on mobile.
Editing structured text on a phone is always going to suck to some degree, so it's always nice to see anything that promises to make it suck less.
Would love to read more about the details. What makes a code editor accessible and conversely what makes it not accessible?
Example from: https://codemirror.net/6/examples/tab/
> By default, CodeMirror does not handle the Tab key. This isn't an oversight—it is an intentional decision to make the default configuration pass the "no keyboard trap" criterion of the W3C Web Content Accessibility Guidelines. Some users browse the web without access to a pointing device, and it is really unfriendly towards such users to have focusable inputs that they cannot escape from.
I / my company (Grove Collaborative) got in touch with Marijn (the developer of CM) in 2018, asking if we could fund the project specifically to support accessibility. He very kindly shared that the next version (which appears to have been 6) was not yet under development and there was no way to put those dollars to work on that theme at that time -- but please check back in six months because he is thinking about it.
The integrity here is pretty amazing; he actually turned down the funding because the dollars couldn't, at that time, be allocated to accessibility in good faith even though he was actually preparing to do the work.
It's so SO cool to see that he was taking it seriously, and that the work got done, and I can finally update the open source project.
And, yes - accessibility should be a focus at the beginning...but if the best time to do it was years ago, the next best time is now.
> CodeMirror is open source (MIT or GPL3). It is being developed on GitHub. Contributions are welcome.
> If you are using CodeMirror commercially, there is a social expectation that you help fund its maintenance
> If you are using ProseMirror to make profit, there is a social expectation that you help fund its maintenance.
But I don't see anything similar on the CodeMirror homepage.
> CodeMirror is open source (MIT or GPL3). It is being developed on GitHub. Contributions are welcome.
> If you are using CodeMirror commercially, there is a social expectation that you help fund its maintenance. Start here.
Indeed, so let's assume because CodeMirror doesn't have a license like that, the authors don't "want their cake and eat it too", as the license is simply open source. Don't know where you get the whole "guilt tripping" stuff from, having a message that says "if you enjoy this, please donate" is guilt tripping...
> If you are using CodeMirror commercially, there is a social expectation that you help fund its maintenance.
Marijn has given CodeMirror to the world for free, and it is in my opinion a very valuable contribution indeed. Comments like yours reflect an entitled view of what proper behavior is for an open source developer.
Obviously anyone who wants to use CodeMirror commercially but doesn't feel Marijn is due any compensation for his work is free to act on that belief. I fail to see how that's "shitty."
The founder and main developer has shared some of his thoughts in this matter here: https://marijnhaverbeke.nl/blog/sustainable-maintenance.html
He has put thousands of hours into these projects, and are giving them away for free – that is, if you can stomach the slight hint that if you're making money on it, then maybe contribute a tiny bit.
He hasn't blogged about burnout yet, like many other open source maintainers do. A recurring theme is about toxic community members. I hope he scrolls past your comment.
I'm all for donating to Open Source projects and supporting maintainers, but if you expect to profit from corporations exploiting your software, maybe don't license it as OSS?
If I use Open Sorce software and make money, but don't donate, is that socially unacceptable? Is that evil? Greedy?
What about literally every company that uses Open Source software? Are they evil too?
The spirit of Open Source software is that it comes with no or few strings attached. The idea that there is a social expectation to pay goes against that spirit, even if would be nice in theory.
You're free to pretend there's a constrained license, and pay the project for their work. Are you saying you'd rather be forced to do so by a license? That makes no sense -- you can do it without being forced, if you want to.
I mean, I like copyleft licensing. But it's perfectly reasonable (albeit possibly naïve) to request commercial donations on a non-copyleft project.
If I use the software and make money, but don't donate, should I fear being socially reprimanded? What's the line there?
Piracy is one thing, but this borders on extortion and frankly would make me uncomfortable using this software.
It's a request, not a demand. And this project's maintainer is being more upfront than other projects.
The developer states the following:
> If you are using CodeMirror commercially, there is a social expectation that you help fund its maintenance.
Calling it a "social expectation" is frankly a pretty big turn off for me.
I don't mind the question but I do mind the implied shame it brings if the reply is "no". Which would be a perfectly fine reply. No one owes CodeMirror anything.
Nice! I liked this!
This clarification, maybe with a board of supporters for those who wish to be visible seems like a much better approach than all kinds of not-osi-open-source.
(Disclaimer: I do use CodeMirror in a personal project of mine but haven't tried 6 because I'm not great at Javascript and there are not many examples of how to use it, although there are tons for 5.)
It seems like devs generally consider productivity as keyboard > mouse, and I'd assume that mouse > touchscreen, but I've never tried it.
HyperMD[0] is probably the craziest (in a good way) thing I've seen done with CodeMirror.
[0] https://laobubu.net/HyperMD/#./docs/zh-CN/README.md and https://github.com/laobubu/HyperMD
They already had nodes for images and embeds [1, 2] which made development easy (I would recommend checking out the source code; its about a hundred lines of code for each, and simple). But as I made more custom nodes, I learned pretty well the internals of tiptap and how it used ProseMirror. And over time, I've come to appreciate knowing its api.
So if there's any advice for people trying to get started with ProseMirror, I would say to look at libraries which built upon it as example code such as tiptap or the outline rich-markdown-editor [3].
[1] https://github.com/ueberdosis/tiptap/blob/main/packages/tipt...
[2] https://github.com/ueberdosis/tiptap/blob/main/examples/Comp...
Like turning special elements in a text input like [code] into a blue css box with [x] button. With copy/paste support in the original [code] format. That sort of thing.
It was great to work with in my own project but I saw 6 was close to coming out but did the 5 implementation anyway. Sad to see it come out so soon. Maybe I'll upgrade it some day.
I'm guessing the integration will be basically a wrapper component with a ref of a DOM node where CodeMirror will do its thing.
Pretty much. This is how my React ProseMirror integration works: https://github.com/dminkovsky/use-prosemirror/blob/main/src/.... Though there are some complexities. I believe CodeMirror would be the same.
https://github.com/codemirror/codemirror.next/commit/8a8dc87...
The tooling support that TS enables would be a huge thing for (the users of) a project like this.
they fund public-interest open source projects, several per funding round.
[0] https://prototypefund.de/en/project/codemirror/
import {EditorState, basicSetup}
...does this mean you need webpack or browserify or something in order to use CM6?There is a dedicated page under examples, if you're interested: https://codemirror.net/6/examples/bundle/.