Filtering input characters

For legacy reasons, our OT algorithm doesn’t support characters outside the Basic Multilingual Plane (BMP). We plan to fix this limitation in the future, but this would require significant work. For now, we would like to migrate across our existing solution which replaces such characters with another dummy character.

It seems like a transactionFilter is the right tool for this and I’ve attempted it in this codesandbox. The replacement works as expected but it inserts in reverse and I’m not sure why.

Could you offer any advice on getting this working? Thanks!

This approach where you replace all local transactions with a fresh one that has similar changes will strip all effects and annotations from the transactions, so that is probably not going to work (it’ll mess up the undo history, for example).

But I think the problem here is that the changes are all interpreted in the original document’s coordinate system. A filter that adds the the existing transaction by appending a change that deletes the astral characters, using sequential so that its coordinates are interpreted in the in-between coordinate system, might work (return [tr, {changes: ..., sequential: true}]).