Release 0.14.0

Hi all. ProseMirror 0.14.0 has just appeared on NPM and github. The main work for this release was on node views, but it also contains a number of bugfixes and small improvements.

The short story on the node view work is that they allow the editor to produce cleaner HTML (no more pm- attributes and wrapping spans), to update the DOM more efficiently, and provide a hook for user code to more closely control the shape and behavior of a given node’s DOM representation. For the long story, see the docs.

Release notes

prosemirror-model 0.14.0 (2016-11-28)

New features

Parse rules now support skip (skip outer element, parse content) and getContent (compute content using custom code) properties.

The DOMSerializer class now exports a static renderSpec method that can help render DOM spec arrays.

prosemirror-state 0.14.0 (2016-11-28)

New features

Selection actions now have a time field and an (optional) origin field.

prosemirror-view 0.14.0 (2016-11-28)

Breaking changes

Wrapping decorations are now created using the nodeName property. The wrapper property is no longer supported.

The onUnmountDOM prop is no longer supported (use a node view with a destroy method instead).

The domSerializer prop is no longer supported. Use node views to configure editor-specific node representations.

New features

Widget decorations can now be given a key property to prevent unneccesary redraws.

The EditorView class now has a destroy method for cleaning up.

The handleClickOn prop and friends now receive a direct boolean argument that indicates whether the node was clicked directly.

Widget decorations now support a stopEvent option that can be used to control which DOM events that pass through them should be ignored by the editor view.

You can now specify custom node views for an editor view, which give you control over the way node of a given type are represented in the DOM.


This looks great now, for embedding react components! X-mas came a few weeks earlier this year!

1 Like

Here’s a demo using a nodeview to turn code blocks into CodeMirror editors.

What an awesome update! Thanks for providing the CodeMirror example. I really like your implementation as it looks like it should work seamlessly in a collaborative context. Thanks for taking that into account! And I also like how clean the now generated DOM is :slight_smile: Keep up the great work!

Hey, sorry for not having been more invovled lately. I will be back.

Just quickly: this look cool. But quickly testing, if I put the caret at the start of the paragraph that follows the codemirror instance, and hit backspace, the contents from that paragraph seem to move from prosemirror into codemirror. Feature or bug?

That’s the standard behavior of the command run for backspace, which doesn’t know or care how that code block is rendered. I think it’s reasonable (but at the moment, pressing backspace/delete at the start/end of the code block will do nothing, since I didn’t implement any special behavior in the CodeMIrror keymap).

Ok, got it. Yeah, as long as the data models take care of it all, it seems fine.