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

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.

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

How can i do it with the javascript ?


>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.

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

You can get the Unicode character here.

Leave a Reply