Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Copy to clipboard with styles and show the text with styles when pasted

i have a project that needs to copy strikethrough text here is the example site

https://convertcase.net/strikethrough-text-generator/

i want to strikethrough the text and copy it with the styles and when i paste it somewhere it should show the same strikethrough text with styles.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The website above applies styles even in google chrome search bar.

How can i do it with the javascript ?

Thanks

>Solution :

The site you referenced generates a ‘modified’ version of the string, with a special Unicode character between every letter. I used Babelstone to check the contents of the modified string.

If you enter ‘ABC’, then convert, the website add a "COMBINING LONG STROKE OVERLAY {strikethrough}" after every character.

The problem here is not ‘styles’ (I am assuming you are talking about CSS styles), but rather you would have to add the Unicode character above after every character.

TLDR:
After every character in ‘ABC’, add the U+0336 character, then copy it to the clipboard.

You can get the Unicode character here.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading