fix(code-highlighter): ensure HTML formatted code is correctly copied#252
fix(code-highlighter): ensure HTML formatted code is correctly copied#252SteaceP wants to merge 2 commits intosharevb:chore/all-my-stuffsfrom
Conversation
|
Hi @SteaceP , thanks for this PR, but it sounds like this will break direct pastability in Word by the lack of mime type text/html. Copying html as text/plain is not what was asked in related issue. May be could we could add a useCopyWithMimeType to simplify |
|
Sorry I didn't saw that issues. I was trying to use the tools and it wasn't working at all. |
|
But did you get any error in F12 console ? Sounds like ClipboardItem only works in HTTPS |
|
Yes I did get an error, but I though about ssl... Then when I tried with ssl it wasn't coping the HTML just the text since I was coping in notepad. |
|
For reference, it comes from here: CorentinTh#1280 |
|
May be would be interesting to add a button to copy Raw Html, rename existing button, and refactor for a copy to html instead of raw ClipboardItem. For now, I am in vacation and only respond by smartphone |
… copy functionality
The copy button will now be able to paste using Rich text in Word, etc. and HTML formated in other like VScode automaticaly. |
|
Hi @SteaceP , I have some concern about actual code, but many thanks for testing in Outlook. Could be better to create a generic useCopyHtml with fallback if ClipboardItem failed. Also i18n extraction. And maybe shikijs/shiki#742 and may be allowing independant dark light mode and even mso attributes for formatting. And finaly I think about a html to email html tool |
|
Hi @SteaceP, I just made a change to make a generic useCopyHtml, I let you may be:
Many thanks |
85499bb to
9a1c825
Compare
This pull request simplifies the code in the
code-highlighter.vuecomponent by removing unused imports and streamlining the copy-to-clipboard functionality. The main focus is on reducing complexity, improving maintainability and fixing the broken button.Code simplification and cleanup:
useCopyClipboardItemsimport and related logic, replacing it with a simpler usage of the existinguseCopycomposable for copying HTML-formatted code. [1] [2]htmlClipboardItemsand now directly passesformattedCodeHtmlas the source touseCopy.