I want to copy my styled text from Quill into for example Gmail without keeping the styles that Quill includes when copy & pasting. I want to keep the styling of headings, lists and so on - but I'd just like to strip all the colors that gets included.
To replicate what I'm trying to achieve, please copy the text in the snippet below, and then paste it into another editor like Gmail.
How do I prevent the style tags from being included when copying from Quill?
var quill = new Quill('#editor-container', {
modules: {
toolbar: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline'],
['image', 'code-block']
]
},
placeholder: 'Compose an epic...',
theme: 'snow' // or 'bubble'
});
quill.clipboard.dangerouslyPasteHTML('<h1>Testing Testing 123</h1><p>This is some text, please copy everything here and then paste into Gmail</p>');
#editor-container {
height: 100px;
}
.ql-editor h1 {
color: red;
}
.ql-editor p {
color: blue;
}
<link href="//cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet"/>
<link href="//cdn.quilljs.com/1.3.6/quill.bubble.css" rel="stylesheet"/>
<script src="//cdn.quilljs.com/1.3.6/quill.js"></script>
<div id="editor-container"></div>