I'm attempting to paste some stylized font into a quillJS editor and keep the formatting. However, the formatting is removed whenever I paste it. I can create a clipboard matcher and have it set the font color manually, but I don't get to keep the original formatting. It's just replaced.
Here's my codepen: https://codepen.io/ashinyacorn/pen/wvvRoJp?editors=0011
And this is what I'm working with:
var Clipboard = Quill.import('modules/clipboard');
var Delta = Quill.import('delta');
var quill = new Quill('#editor');
quill.clipboard.addMatcher('B', function(node, delta) {
console.log('How BOLD of you');
return delta.compose(new Delta().retain(delta.length(), { bold: true }));
});
//Keep font formatting (size, color) ?
quill.clipboard.addMatcher('FONT', function(node, delta) {
console.log('HOW FONTY');
return delta;
});
I would expect that if you were to paste in something that has a font styling, it would be kept. But it isn't, unless I override the delta and manually set the color myself. Is there anyway to tell the delta what the font color and style already is? Or a way to tell the clipboard to keep the styling?