Release 0.11.1

Phew. I just uploaded versions of the new, modular ProseMirror system. The core now consist of four NPM packages (model, view, state, transform), with an additonal 8 extra packages (keymap, inputrules, history, collab, commands, schema-basic, schema-list, schema-table) being fully supported by me. You’ll probably need at least some of those to set up your editor.

The other main change in this release is a move towards a ‘linear data flow’, or ‘reactive’, or whatever you want to call it, architecture. See this thread for more background. This means that you’ll have to set up your editor a little differently, and if you’re not already using that style it might look somewhat weird, but it should be just as powerful as what we used to have, and a lot cleaner.

Some functionality (keymaps, undo history) was moved out of the core into plugins.

Moving to this release might not be immediately viable for you, as it drops a few features:

  • markRange is temporarily gone. A revised version of this is going to be part of the next release, but I decided not to hold up this release any longer. This is my next focus—I have the new system largely designed already, and it’s going to be a lot better than markRange.

  • The tooltip module is gone. If someone feels like maintaining a tooltip, I recommend forking the old code an putting it somewhere. I’ve realized this kind of UI stuff is too far out of my area of interest to continue maintaining it.

  • The menu functionality, example setup, and Markdown support are still distributed by me, as I need them for my demos, but are no longer fully supported, since they aren’t the main focus of the library (which is big enough already).

Setting this all up was quite a project, and it’s not unlikely that I screwed something up. But now that the mechanisms are in place, subsequent releases should be smaller and faster again.

Here are the release notes:

prosemirror-model 0.11.0 (2016-09-21)

Breaking changes

Moved into a separate module.

The JSON representation of marks has changed from {"_": "type", "attr1": "value"} to {"type": "type", "attrs": {"attr1": "value"}}, where attrs may be omitted when the mark has no attributes.

Mark-related JSON methods now live on the Mark class.

The way node and mark types in a schema are defined was changed from defining subclasses to passing plain objects (NodeSpec and MarkSpec).

DOM serialization and parsing logic is now done through dedicated objects (DOMSerializer and DOMParser), rather than through the schema. It is now possible to define alternative parsing and serializing strategies without touching the schema.

New features

The Slice class now has an eq method.

The Node.marksAt method got a second parameter to indicate you’re interested in the marks after the position.

prosemirror-transform 0.11.0 (2016-09-21)

Breaking changes

Moved into a separate module.

The Remapping class was renamed to Mapping and works differently (simpler, grows in only one direction, and has provision for mapping through only a part of it).

Transform objects now build up a Mapping instead of an array of maps.

PosMap was renamed to StepMap to make it clearer that this applies only to a single step (as opposed to Mapping.

The arguments to canSplit and split were changed to make it possible to specify multiple split-off node types for splits with a depth greater than 1.

Rename joinable to canJoin.

New features

Steps can now be merged in some circumstances, which can be useful when storing a lot of them.

prosemirror-state 0.11.0 (2016-09-21)

Breaking changes

New module inheriting the Selection and EditorTransform abstraction, along with the persistent state value that is now separate from the display logic, and the plugin system.

Selection.findAtStart/End was renamed to Selection.atStart/End, and Selection.findNear to Selection.near.

prosemirror-view 0.11.0 (2016-09-21)

Breaking changes

Moved into a separate module from the old edit submodule. Completely new approach to managing the editor’s DOM representation and input.

Event handlers and options are now replaced by props. The view’s state is now ‘shallow’, represented entirely by a set of props, one of which holds an editor state value from the state module.

When the user interacts with the editor, it will pass an action to its onAction prop, which is responsible for triggering an view update.

The markRange system was dropped, to be replaced in the next release by a ‘decoration’ system.

There is no keymap support in the view module anymore. Use a keymap plugin for that.

The undo history is now a separate plugin.

CSS needed by the editor is no longer injected implicitly into the page. Instead, you should arrange for the style/prosemirror.css file to be loaded into your page.

New features

The DOM parser and serializer used to interact with the visible DOM and the clipboard can now be customized through props.

You can now provide a catch-all DOM event handler to get a first chance at handling DOM events.

The onUnmountDOM can be used to be notified when a piece of the document DOM is thrown away (in case cleanup is needed).

prosemirror-keymap 0.11.0 (2016-09-21)

Breaking changes

New module, takes the same role as the old built-in keymap support in the ProseMirror class.

prosemirror-inputrules 0.11.0 (2016-09-21)

Breaking changes

Moved into a separate module.

You can now add this plugin multiple times to add different sets of rules to an editor (if you want). It is not possible to change the set of rules of an existing plugin instance.

Rules no longer take a filter argument.

The signature of the handler callback for a rule changed.

prosemirror-history 0.11.0 (2016-09-21)

Breaking changes

Moved into a separate module. Now acts as a plugin that can be omitted or replaced by a different implementation if desired.

Merging subsequent changes into a single undo ‘event’ is now done by proximity in the document (the changes must touch) rather than in time. This will probably have to be further refined.

prosemirror-collab 0.11.0 (2016-09-21)

Breaking changes

Moved into a separate module.

Interface adjusted to work with the new plugin system.

New features

When receiving changes, the module now generates a regular transform action instead of hard-setting the editor’s document. This solves problematic corner cases for code keeping track of the document by listening to transform actions.

prosemirror-commands 0.11.0 (2016-09-21)

Breaking changes

Moved into a separate module.

The interface for command functions was changed to work with the new state/action abstractions.

prosemirror-schema-basic 0.11.0 (2016-09-21)

Breaking changes

Moved into a separate module.

No longer exports the specs for the nodes and marks separately, since they are now plain objects, not subclasses. They are still exported through nodes and marks objects.

The list-related nodes were moved to the schema-list module.

prosemirror-schema-list 0.11.0 (2016-09-21)

Breaking changes

New module combining the node specs from schema-basic, and the list-related commands from the commands module.

prosemirror-schema-table 0.11.0 (2016-09-21)

Breaking changes

Moved into a separate module.

Node types adjusted to the new node spec interface.

Commands adjusted to the new [command] (http://prosemirror.net/version/2016.09.21.html#commands) interface.

3 Likes

Congrats on the release! The break down of different modules looks reasonable and should help simplify contributions as it makes it much easier to reason about individual aspects. I’m a bit biased, but I’m happy to hear some of the UI (menu/tooltips) will be taking more of a backseat.

I excitedly await the markRange replacement which I currently use for spell correction markup. Once that’s in I’ll be able to upgrade and tackle the integration of this new setup.

Amazing !!!

(the website demos are currently not working )

Some of the dependencies weren’t properly compiled down to ES5, so if your browser isn’t supporting ES6 yet that might have been the problem. I’ve fixed that now. If there’s still a problem, could you tell me which browser and what you see in the console?

(Or you might have seen this issue.)

Yes, but by now it seems to be fixed already !

I was looking forward to this release! Thanks for putting in all the effort to make ProseMirror better witch each release :slight_smile: I’ll upgrade as soon as the markRange functionality is back in place as I currently depend on it.

Great work indeed. Really excited to think all we can build on top of that. And same here, we rely heavily on markRange and wait for its come back before upgrading