Copy text to clipboard when readonly is set to cursor

Is it possible to copy text to clipboard when the readOnly: “nocursor”, is set in this way, or am I missing something. I would like to add a copy to clipboard button like google has here and let the users manually select the code and copy it.

Right now when I select the code and right click on it the copy method isn’t availible neither does ctrl + C do anything.

readOnly: "nocursor" is a disaster and is going away in the next major version. It indeed doesn’t allow CodeMirror’s keybindings to fire, because you can’t focus the editor. I’m not sure why the context menu is also broken, but indeed, it appears to be.

myCodeMirror.setOption(“readOnly”, true); does the trick for me. Thanks!

1 Like

thank you. readOnly set true work for me… :slight_smile: