"Translated" ProseMirror 1.0 Released

✍🏼 Written on Nov 12, 2021   
❗️ Note: it has been days since this article was written, please be aware of its timeliness
🖥  Note:The original author wrote this on October 13, 2017, reflecting on the journey since developing ProseMirror 1.0. This article leans toward liberal translation.

All https://prosemirror.xheldon.com links in the text can be replaced with https://prosemirror.net links to view the original references in the source.

Two years ago, I launched the ProseMirror project because I wanted to explore [a better](/tech/ProseMirror.html) approach to WYSIWYG editing. Today, I’ve released version 1.0 of the library. The project’s architecture and its internal implementation have undergone significant changes over its lifecycle, but I believe the original goal has been achieved.

ProseMirror is a web UI library, though some of the challenges it addresses are tailored to the strengths and (especially) weaknesses of the web platform. Don’t think of it as just another TinyMCE alternative. Instead, it’s a more general-purpose approach to rich-text editing that happens to be implemented in JavaScript for the browser (meaning you could translate its logic into other language versions of rich-text editors, like an OC version, etc.—translator’s note).

Editing Based on Schema Constraints

The most important aspect of ProseMirror is its independence from actual document content, which makes it possible to build applications on top of this library that previously required a fully custom editor implementation.

By “independence from document content,” I’m referring to ProseMirror’s schema constraints feature. The core editor imposes no requirements on the specific content of a document. Instead, it relies on a configurable data structure (schema) to determine what content is allowed and how it should be structured. ProseMirror will precisely work with your custom semantic document format while still providing the WYSIWYG editing experience users expect.

For example, a scientific writing application could use a schema that includes sections, footnotes, and citations—two such applications, SciFlow and Fidus Writer, are already built on ProseMirror. Or a news organization could define a schema reflecting its content model, giving journalists an editor tailored to their writing needs. For instance, The New York Times is using ProseMirror in its CMS. Alternatively, if your company has editors for several different content models, using ProseMirror with distinct schemas can make your editor code easier to unify. Atlassian is rolling out ProseMirror across its products, from wikis to bug trackers to source hosting.

Collaboration

Support for [collaborative editing](/tech/Collaborative-Editing-in-ProseMirror.html) has been a focus of ProseMirror from the start. Several aspects of the system, such as how document updates are represented or how the undo history module works, have been heavily influenced by the needs of collaborative editing. I’m convinced this isn’t a feature you can bolt onto an existing editor.

Fortunately, these constraints didn’t force the design into an awkward corner but instead helped steer it toward a universally beneficial direction. Other tricky features, like change tracking and the ability to roll back past edits, became possible due to design decisions driven by collaborative editing.

Transactional State Updates

Attempting to reconcile the demands of collaborative editing with a functional unidirectional data flow architecture led to our design, where the editor, rather than unilaterally updating its state, emits transactions. A transaction can be used to compute a new state and update the editor with it.

This makes it possible to seamlessly integrate the editor into your application’s data flow loop if you choose. Moreover, treating updates as first-class values makes it easier to keep external state in sync with the editor, enabling new and powerful types of extensions.

Conclusion

After years of wild experimentation and evolution, starting with version 1.0, our goal is stability. The core modules will remain on 1.x for as long as possible, meaning new releases won’t require you to change your code. There’s an RFC process where we’ll gather community feedback on new features.

If you’re looking for a simple plug-and-play rich-text editor component, ProseMirror might not be what you need. (We do hope such components can be built using ProseMirror.) This library is optimized for demanding, highly integrated use cases at the cost of simplicity. But if your application is pushing the limits of WYSIWYG editors, consider giving it a try.

- EOF -
Originally published at: "Translated" ProseMirror 1.0 Released - Xheldon Blog