-
Notifications
You must be signed in to change notification settings - Fork 82
fix(code-highlighter): ensure HTML formatted code is correctly copied #252
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
base: chore/all-my-stuffs
Are you sure you want to change the base?
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 |
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.