# Managing nodes with multiple views

**URL:** <https://discuss.prosemirror.net/t/managing-nodes-with-multiple-views/4559>\
**Category:** Uncategorized\
**Created:** [April 18, 2022, 10:26am UTC](https://discuss.prosemirror.net/t/managing-nodes-with-multiple-views/4559 "2022-04-18T10:26:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunar616](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/lunar616/32/2662_2.png) [@lunar616](https://discuss.prosemirror.net/u/lunar616)\
**Post date:** [April 18, 2022, 10:26am UTC](https://discuss.prosemirror.net/t/managing-nodes-with-multiple-views/4559/1 "2022-04-18T10:26:43Z")

</div>

Hi, devs!

In my project I have nodes with multiple views. For example, almost everyone has something similar, I has the image uploader and it has three views:

1. The dropzone with a placeholder text
2. The progress bar of loading
3. The result image + caption

If I understand correctly how the ProseMirror works, I must have three schema types and I must switch them between each other. Am I right? What is the best way to do it? Replace the schema type by using the current selection (like `replaceSelectionWith`)? The uploading of image is an async action, I think that at the uploading time the selection could change and then we can’t rely on the current selection

---

<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:** [April 18, 2022, 11:18am UTC](https://discuss.prosemirror.net/t/managing-nodes-with-multiple-views/4559/2 "2022-04-18T11:18:25Z")

</div>

You could also use an attribute on a single node type to distinguish between the different states.

To track uploading images and their location, you’ll want a state field, so that you can map their positions through changes.

---

<div class="post-metadata">

**Author:** ![lunar616](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/lunar616/32/2662_2.png) [@lunar616](https://discuss.prosemirror.net/u/lunar616)\
**Post date:** [April 18, 2022, 11:26am UTC](https://discuss.prosemirror.net/t/managing-nodes-with-multiple-views/4559/3 "2022-04-18T11:26:29Z")

</div>

Do you mean that it’s possible to use one type with three views by using attributes?

“To track uploading images and their location, you’ll want a state field, so that you can map their positions through changes.” - Thank you, I understood it

---

<div class="post-metadata">

**Author:** ![lunar616](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/lunar616/32/2662_2.png) [@lunar616](https://discuss.prosemirror.net/u/lunar616)\
**Post date:** [April 18, 2022, 4:45pm UTC](https://discuss.prosemirror.net/t/managing-nodes-with-multiple-views/4559/4 "2022-04-18T16:45:57Z")

</div>

I did it by adding an unique data-attribute at the creation stage of the first view. And at the time of changing I just find this node by this attribute and get its position at the document and then replace it
