How to split an inline node on update

I have a custom inline node that outputs a span. The html of the doc is like

<p>Hello <span data-my-id="1234">Adam</span></p>

If I type the letter f into the word Adam, I would like to split the span. So it would look like

<p>Hello <span data-my-id="1234">Ad</span>f<span data-my-id="1234">am</span></p>

By default it does

<p>Hello <span data-my-id="1234">Adfam</span></p>

How could I force the span to always be split when the user either types or pastes in the middle of it?

I am using TipTap if that helps.

const $from = state.tr.selection.$from
const parent = $from.parent
if (parent.type === your_inline_node) {
  const start = $from.before()
  const end = $from.end()
  state.tr.replace(start, end, new_slice_you_want)
}

You could set up a text input handler that, if the selection is a text selection inside such a node, first splits the node and then inserts the text.