# rich text copy

**URL:** <https://discuss.codemirror.net/t/rich-text-copy/695>\
**Category:** Uncategorized\
**Created:** [March 28, 2016, 12:59am UTC](https://discuss.codemirror.net/t/rich-text-copy/695 "2016-03-28T00:59:57Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![janoonk](https://discuss.codemirror.net/letter_avatar_proxy/v4/letter/j/57b2e6/32.png) [@janoonk](https://discuss.codemirror.net/u/janoonk)\
**Post date:** [May 20, 2016, 4:32pm UTC](https://discuss.codemirror.net/t/rich-text-copy/695/3 "2016-05-20T16:32:33Z")

</div>

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:

> [@How to copy text with markup from codemirror editor to other application](https://discuss.codemirror.net/t/how-to-copy-text-with-markup-from-codemirror-editor-to-other-application/539/2):
>
> Copying from CodeMirror only copies the plain text. The highlighting is purely a display issue, the content is treated as just text. You could use something like the [runmode addon](http://codemirror.net/doc/manual.html#addon_runmode) to create a syntax highlighted view that the user can copy from, but that won’t be editable.

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);
> 
> ```

---

_[View the full topic](https://discuss.codemirror.net/t/rich-text-copy/695)._
