We are facing similar issue on dashboard as well where users are not able to copy the sql from server activity table, I've attached screenshot for your reference.
I am Neethu Mariya Joy, an undergraduate pursuing BE in Computer Science at BITS Pilani.
I've attempted to fix https://redmine.postgresql.org/issues/2309. Codemirrors catches all the keyboard and mouse events when 'readOnly' option is set to 'noCursor' and does not allow copying.
So, I've set 'readOnly' option to true. In order to hide the cursor, I've added a class 'hide-cursor-workaround' and applied css styles to hide the cursor.
I'm attaching my patch as bug2309.diff below as per the contribution guidelines.
Hope this helps. Thank you for your consideration!