Add or Remove Decoration based on user interaction


I’m new to CodeMirror. I have a use case where I want to add or remove mark decoration based on user interaction with buttons. I was able to give these mark decorations when editor is initialized via state field or view plugin.

I’m unable to find a way to dynamically updated/remove mark decoration.

Any suggestion would be greatly appreciated.