Error when updating content on paste

Thank you for your answer.

I had to replace the changeFilter with a transactionFilter.
I was using the changeFilter because I wanted to replicate the beforeChange
event and this comment says this is the way to go.

    EditorState.transactionFilter.of((tr) => {
      if (tr.isUserEvent('input.paste')) {
        const ranges = tr.startState.selection.ranges[0]
        return [{
          changes: {
           from: ranges.from, to: ranges.to, insert: 'XXXXX'}
          }]
      }
      return tr
    }),

Is this a correct way to do this?

Regards