How to remove default attributes from content?

I recently discovered the data-gramm='true' attribute in the EditorView.contentAttributes was causing Grammarly to not work. I tried to override it with data-gramm='false', but it turns out they just check for the presence of this attribute and not the value. Is there any way to remove default attributes and not just override them?

Removing attributes is not currently supported, but could be added I guess. However, I don’t think Grammarly will work with CodeMirror in any case (it assumes it can just mess with the DOM however it likes, and that’s not really something the library reacts well to).

I can’t get it to update the actual text through Grammarly (I imagine it’s due to how the state/view is managed in CodeMirror), but even just the suggestions are nice to have. I think having an option to remove these attributes (without the hacked solution I’m using) would be nice, and I could probably put a PR together if you’d like.

How are you seeing the suggestions? Last time I looked, it modified the DOM to style text with suggestions, and I’d expect CodeMirror to immediately clear such changes again.

They have made some changes so that it no longer places the suggestions in the content itself.

image

Ahh, that’s an improvement. Then I guess I can remove the attribute from the library, until new issues are found. Does that solve your problem?

1 Like

I believe that would do it! I’m still curious about what it would take to get updates to work, but that might be another discussion and might not be possible with the Grammarly extension yet.