While I write code a copy function for text rich editor, got a problem. When I trying to get text which stored from div which has contenteditable attribute into clipboard, it wrapped by many inline styles. I don't want to wrapped it inline styles, because body size will be increase.
<div contenteditable id="test" style="min-width:600px; min-height: 800px;"/>
document.getElementById("test").addEventListener("paste", (e)=>{
e.preventDefault();
console.log(e.clipboardData.getData("text/html"));
})
<meta charset='utf-8'><span style="color: rgb(0, 0, 0); font-family: "Apple SD Gothic Neo"; font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">sdasdasdas</span>
How can I get a copied text that only has exactly in line styles what i intend like below?
<span>sdasdasdas</span>
or
<span style="color: rgb(0, 0, 0);">sdasdasdas</span>