Single step with too large data

Hello, I am developing a collaborative editor by prosemirror. But I have a problem. When I paste too much text once, a single step with many nodes will be created.But I want to split the step,so I can send smaller step to server. I can not find the solution,please help me.Thanks too much!

This isn’t something the library will do for you. You could try to do something in dispatchTransaction that, if a large insertion has multiple nodes at its top level, splits it into smaller insertions, but that wouldn’t always work (say, when pasting a single huge list).

oh,thanks.I am going to try.

Your reply inspired me. But dispatchTransaction is called when anything changed such as focus. My code follows: function paste() { const doc = this.createDocument(clipboardData.getData(‘text/html’)); const size = doc.content.size; const slice1 = doc.slice(0, Math.ceil(size/2)); const slice2 = doc.slice(Math.ceil(size/2)); const div1 = document.createElement('div); const div2 =document.createElement(‘div’); const fragment1 = DOMSerializer.fromSchema(this.shema).serializeFragment(slice1.content); const fragment2 = DOMSerializer.fromSchema(this.shema).serializeFragment(slice2.content); div1.appendChild(fragment1); div2.appendChild(fragment2); document.execCommand(‘insertHtml’, false, div1.innerHTML); document.execCommand(‘insertHtml’, false, div2.innerHTML); }