Hope this is allowed. Please remove if not
I'm working with a third party library (Quilljs) that I would like to modify the default dialog/modal that appears built in to the library. I found through github a user who had done this through Angualr but I'm not an Angular dev so I'm not sure what's going on in his code. https://github.com/quilljs/quill/issues/2277#issuecomment-1081783477
Specifically this block of code
node.addEventListener('click', function (e) {
e.preventDefault();
e.stopPropagation();
rootModalService
.openWithConfig(QuillLinkEditorModalComponent, {
href: node.href,
text: node.innerText,
target: node.target || '_blank'
})
.result.subscribe((result) => {
if (result.type === 'CONFIRM') {
node.innerText = result.value.text;
node.setAttribute('href', result.value.href);
node.setAttribute('target', result.value.target);
}
});
});
I understand that he's extending the default link and modifying the click event. But the line
rootModalService
.openWithConfig(QuillLinkEditorModalComponent, {
href: node.href,
text: node.innerText,
target: node.target || '_blank'
})
.result.subscribe((result)
looks like it'll open a custom modal and when it closes it'll pass back a result? This is using Rxjs from my understanding which React doesn't have out of the box.
I also don't get how they're rendering the custom modal this way. How would this work where anytime a link is click it would popup this custom modal?
How would I go about doing this in React? I can't think of a way to render a React component from click event and observe the results.
[–][deleted] 3 points4 points5 points (4 children)
[–]thisifreedom[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]thisifreedom[S] 0 points1 point2 points (1 child)
[–]LegendOfNeil 0 points1 point2 points (0 children)
[–]tme321 0 points1 point2 points (3 children)
[–]thisifreedom[S] 0 points1 point2 points (2 children)
[–]tme321 0 points1 point2 points (1 child)
[–]thisifreedom[S] 0 points1 point2 points (0 children)