Thanks for your reply, But I did some tinkering and wrote a custom js function to replace the non-breaking white space written by the editor and replace it with common white space as it is being copied, for anyone looking for the code.
<script>
function copyCode() {
var Text = document.getElementById(‘code-wrap’).innerText;
var results = Text.replace(/ /gi,” “);
navigator.clipboard.writeText(results);
}
</script>