Looking to implement an internal clipboard with a history feature for my application. Unfortunately, using the clipboard API will require user permission which is not feasible.
I want to ensure that formatting such as bold, italics, and strikethrough is preserved.
Considering extracting content from window.getSelection(), but struggling to clone all HTML within the selection easily.
The extracted contents will need to be displayed in another container element within the app.
Any suggestions on how to accomplish this would be greatly appreciated.
Best regards, Matthias
EDIT: Currently intercepting the copy event and replacing it with a custom function. Need to extract content starting from the anchorNode, cutting potential offsets, moving towards the focusNode (also with offset). Additionally, any unknown or unwanted tags (such as span, h1, div, etc.) must be removed while preserving text content. Hoping someone has tackled a similar task to help save time :/