# How to add "Paste-Behaviors" like in Word

**URL:** <https://discuss.prosemirror.net/t/how-to-add-paste-behaviors-like-in-word/8505>\
**Category:** Uncategorized\
**Created:** [July 25, 2025, 1:17pm UTC](https://discuss.prosemirror.net/t/how-to-add-paste-behaviors-like-in-word/8505 "2025-07-25T13:17:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spaceemotion](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/spaceemotion/32/4178_2.png) [@spaceemotion](https://discuss.prosemirror.net/u/spaceemotion)\
**Post date:** [July 25, 2025, 1:17pm UTC](https://discuss.prosemirror.net/t/how-to-add-paste-behaviors-like-in-word/8505/1 "2025-07-25T13:17:53Z")

</div>

This came up with many customer requests, and as everyone wants different things, pasting becomes a bit of a “how do we do things” question.

In Word, Microsoft solves the issue of “when pasting, do we match formatting, do we keep the text, etc..” by having a little dropdown menu pop up where the user can select how their text should be interpreted.

For us, the following behaviors need to be available:

1. Certain Nodes should be kept (e.g. we have “sections” that can be labeled). By default, only when they are set to `defining` they are kept during paste, but some people would like to have `defining=false` nodes also be kept when pasting
2. Match formatting and paste
3. Paste as raw text (strip formatting)
4. Interpret text as Markdown and paste
5. Finally, the current default behavior (`defined=false` nodes are lost, etc..)

How would one go about adding this to ProseMirror? Many thanks in advance!

---

<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 25, 2025, 2:33pm UTC](https://discuss.prosemirror.net/t/how-to-add-paste-behaviors-like-in-word/8505/2 "2025-07-25T14:33:53Z")

</div>

The library already supports shift-paste for plain text. You could define other modifier combinations and use `handlePaste` to run your own logic when they are held. Or do this through custom menu items, which I think should also be possible on modern browsers, which will let you read the clipboard, to some extent, with `Clipboard.read`.

---

<div class="post-metadata">

**Author:** ![spaceemotion](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/spaceemotion/32/4178_2.png) [@spaceemotion](https://discuss.prosemirror.net/u/spaceemotion)\
**Post date:** [July 25, 2025, 3:08pm UTC](https://discuss.prosemirror.net/t/how-to-add-paste-behaviors-like-in-word/8505/3 "2025-07-25T15:08:52Z")

</div>

Would I do this via just `handlePaste`, or a custom command handler that first opens up a menu, and then eventually send the “handle paste” command to ProseMirror?

---

<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 25, 2025, 3:21pm UTC](https://discuss.prosemirror.net/t/how-to-add-paste-behaviors-like-in-word/8505/4 "2025-07-25T15:21:45Z")

</div>

`handlePaste` handles native paste events, not something that users would pick from a menu.
