While working with Quill in my application, I'm trying to add functionality to dynamically link to resources - i.e. if the user types a username or page name, it will wrap it in a link that leads to that resource. The catch is, I don't want these changes committed to the delta or saved back to the server1.
Is there any way to mask / filter Quill's editor content, without sending the masked changes back to the delta? Or is there another approach that achieves the same result? All it needs to be is an <a>
tag that doesn't get saved to the delta.
I've successfully written a Quill plugin to identify resources and wrap them in links as the user types, but it seems that any kind of modification to the editor content prompts the changes being absorbed into the delta. Hell, if I modify the element via the dev console, Quill picks up the changes.
I thought about just letting the links live in the delta, and removing the formatting before saving to the server - but my implementation left the delta increasingly fractured, and after a few reloads / sessions it increasingly broke my code's ability to detect new links.
My next thought is to create a second / cloned editor window, and somehow selectively sync input back to the main editor window. The logistics of keeping the content synced between the two windows seems like a nightmare though, especially when using the toolbar buttons.
1The reason I don't want these changes in the delta is that resources are very dynamic - hundreds could be added or deleted between sessions, and having thousands of files each save hundreds of references to long-dead resources adds up to a lot of overhead. It's ideal for the links to be client-side-only.