how do I implement 'atomic' effect with Decoration.replace

this is the markText api with a ‘atomic’ option
in codemirror 6 the Decoration.mark not support pass a element, so I use Decoration.replace pass a widget

but how do I implement ‘atomic’ effect with Decoration.replace,I don’t find any option seem to implement this effect

Set up EditorView.atomicRanges to get the same decoration set you’re using for the replacements.

your function of mention isn’t simple ,
could show me a demo

I’ve added an example to the decoration example that uses atomicRanges.

I apologize now I see your reply.
I need to set up in the range. not Regexp ,
and the best way that can turn off the state