-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{Feature} Code generator doesn't keep it's formatting when pasting into word #1492
Comments
hey @danbuntu. would you mind sharing more details about the issue you're facing? It would be great if you could attach any relevant information that could help better understand the problem. Thanks! |
Hi @sanjai0py This image shows the generate code box with a curl request in it. Headers, data, key etc are all different colours This image shows what happens when this is pasted into word - the layout formatting is kept but the colours are removed. As such it's harder to read. |
Thanks for the update. It looks like the issue might be coming from MS Word, as the formatting is not being preserved when pasted. Have you tried Google Docs instead? Here are some helpful links: https://answers.microsoft.com/en-us/msoffice/forum/all/when-pasting-text-from-web-into-ms-word-it-will/3844d928-58d1-43c6-89f9-cd147288ab75 https://www.quora.com/Why-does-the-font-look-different-when-pasted-into-Microsoft-Word-from-the-clipboard-compared-with-copy-pasting-directly-from-the-original-source-a-web-page. Let me know if you need anything else! |
It's the same problem in Google docs |
For anyone else have the same problem I can recomend this plugin for word: https://appsource.microsoft.com/en-us/product/office/WA104382008 It does a good job of formatting the code |
hey, thanks for the update @danbuntu! this walkaround might help people. but i did some research and found out something interesting. turns out that the contents can be copied as rich text, but it's not as easy as it sounds. i tried tweaking the settings of react-copy-to-clipboard package, which is used for copying the editor values when copy to clipboard is pressed, but it only copies the text as plain text by default. i also tried passing an options parameter into it like {format:"text/html"} [1], but it didn't work. i even tried using electron's inbuilt way to copy text to clipboard [2], but that didn't work either. the last and final way is to try using codemirror's features [3], which are unfortunately quite hard to implement, and the code examples/discussions are from a decade ago. so, i think the only hope to make this feature work is when this #1450 for adding monaco gets merged. i think this feature will be implemented out of the box then. [1] copy-to-clipboard - npm (npmjs.com) |
Ok thats sounds like a possible postive solution then at some point. |
When you generate code by right clicking and selecting 'generate code' it'#s all lovely and formatted with nice colouring to herlp distinguish the parts.
If you click the copy button and then paste into msword the layout formatting is kept but the colouring is removed.
It would be great if the colours were kept.
The text was updated successfully, but these errors were encountered: