Closed DLMartin- closed 4 years ago
Is this also a problem when you use native Quill without React? Might be better to ask over on the parent repo because I think it has more to do with the parsing behavior than the React integration.
I cross-posted in the Quill github repo, nobody has responded yet but I did make a discovery. If I create a custom clipboard and override the onPaste method with something simple (like a console.log), it works as I'd expect it to normally work.
var Clipboard = Quill.import('modules/clipboard');
class SampleClipboard extends Clipboard {
onPaste(e) {
if (e.defaultPrevented || !this.quill.isEnabled()) return;
}
}
Quill.register('modules/clipboard', SampleClipboard, true);
It's interesting that Quills default behavior strips all formatting out, unless you copy the entire line.
I have defined a blot for a custom tag,
<YUM>
.It works great when I paste in the whole thing, but if I copy some text from the middle of a
<YUM>
element and paste it somewhere else, the tag is not carried over (only the formatting).Is there a way to keep the copied texts surrounding element(s)? For example, if I were to have this in the DOM:
<em><strong><YUM>This is here</YUM> and it cannot be stopped.</strong></em>
And I were to highlight and copyis is her
, when I paste it, I would expect it to be wrapped up like this:<em><strong><YUM>is is her</YUM></strong></em>
, instead of<span>is is her</span>
, or at least<YUM>is is her</YUM>
.Here's my blot:
And I've set my editor up to give me a ref so I can set some sample text, as well as poke around for some information.
React-Quill version