# Prosemirror Composer (WIP)

**URL:** https://discuss.prosemirror.net/t/prosemirror-composer-wip/3887
**Category:** Show
**Created:** [July 7, 2021, 8:46am UTC](https://discuss.prosemirror.net/t/prosemirror-composer-wip/3887 "2021-07-07T08:46:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jstleger0](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/jstleger0/32/528_2.png) [@jstleger0](https://discuss.prosemirror.net/u/jstleger0)
#### Post date: [July 7, 2021, 8:46am UTC](https://discuss.prosemirror.net/t/prosemirror-composer-wip/3887/1 "2021-07-07T08:46:07Z")

</div>

Hello all.

Over the last few years, we have been working on a relatively complex Prosemirror project. As this project developed we ended up thinking about how we structured our code. For the most part our document handlers.

I am sure others are doing similar things. Just wanted to share our approach so far.

**Terms**

We decided to use the terms **Modifier** and **Handler**

- **Modifier** - A modifier function takes a `transaction` and returns a `transaction`.
- **Handler** - A handler function takes the `editorView` and composes the modifier functions and dispatches them.

**The NPM Library (WIP)**

Link - [prosemirror-composer - npm](https://www.npmjs.com/package/prosemirror-composer)

We have created a typed npm module that exports some wrapped functions to get you started. I am still working on the README.md.

**Why**

This approach comes into its own once you start writing your own modifiers as you can write tests for those independently. Ill write some examples sometime soon.

Either way - just wanted to start some communication around the package on npm if people saw it… Keen to hear if people think this is worthwhile once the README is fleshed out a bit more.

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)
#### Post date: [July 7, 2021, 9:42pm UTC](https://discuss.prosemirror.net/t/prosemirror-composer-wip/3887/2 "2021-07-07T21:42:15Z")

</div>

Interesting. How are you handling positions from multiple changes? Should positions for subsequent changes refer to the document created by the changes before them (in the argument list to `composeModifiers`), or can they all refer to the initial document?

---

<div class="post-metadata">

### Author: ![ccorcos](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/ccorcos/32/1786_2.png) [@ccorcos](https://discuss.prosemirror.net/u/ccorcos)
#### Post date: [July 20, 2021, 8:31am UTC](https://discuss.prosemirror.net/t/prosemirror-composer-wip/3887/3 "2021-07-20T08:31:20Z")

</div>

> [@marijn](#):
>
> can they all refer to the initial document?

It looks like the code does not handle mapping positions from the initial document, but that was what I was hoping for!
