rich text copy

I am also looking for this functionality (copy to clipboard with markup) for a very long time. As my users want to copy the SQL code to Word with markup/syntax hightlighting. See my old post:

So plus 1 for this topic/feature request.

I tried this hack as follows but it doesn’t work with me:

    editor = CodeMirror.fromTextArea(document.getElementById("sqlCode"), {
      inputStyle: "contenteditable",
      autofocus: true,
      mode: "text/x-ELO-mssql",
      indentWithTabs: true,
      smartIndent: true,
      lineNumbers: true,
      matchBrackets : true,
      readOnly: true,
      tabSize: 2,
      styleSelectedText: true,   //for the addon mark-selection.js
      extraKeys: {"Ctrl-Space": "autocomplete"}, // To invoke the auto complete
      hint: CodeMirror.hint.sql,
      hintOptions: { }
    });

and commented out two lines in codemirror.js:

  //on(div, "copy", onCopyCut);
  //on(div, "cut", onCopyCut);