slab / quill

Quill is a modern WYSIWYG editor built for compatibility and extensibility
https://quilljs.com
BSD 3-Clause "New" or "Revised" License
42.93k stars 3.34k forks source link

Font whitelist and clipboard.convert() #4309

Open TheEponymousBob opened 1 month ago

TheEponymousBob commented 1 month ago

Discussed in https://github.com/slab/quill/discussions/4301

Originally posted by **TheEponymousBob** July 10, 2024 Should adding a font to one's whitelist be reflected in `clipboard.convert()` for HTML when dealing with style attributes? I'm trying to render HTML from a legacy app that saves fonts as, for example, `Hello`. I've updated the font whitelist and verified that it is going in to the registry. But when I trace through the `convert()` code, I reach `clipboard.matchAttributor()`, which checks a whitelist in `STYLE_ATTRIBUTORS`, and this does not seem to have been updated when the new font is registered. I've put this in a [CodePen](https://codepen.io/crosswordbob/pen/rNEawdN?editors=1111). The console will show that only the monospace font is being recognised. Uncommenting the last two lines should show that the roboto font has been registered.
joelsantosbr commented 1 month ago

I have the same problem, I tried every way to make quill recognize the style: font-family of external html and without success

TheEponymousBob commented 1 month ago

My horrible workaround is currently to add a custom matcher (heavily based on clipboard.matchAttributor()) that gets run after Quill's own matchers. It's fiddly but doable.