On saving the dialog by content author, need to modify multifield rich text html string
Hi,
Need your thought on this:
I have multifield dialog with rich text and I need to add some dynamic html attributes in anchor link:
My thoughts:
1. I can add a component specific client lib with category "cq.authoring.dialog" and then on keyup event I can get the html string and add html attribute in this string, then save it back.
If this is correct approach then I need your suggestions how I can get dialog properties in client lib file? Also, I need to do this on author instance only.
2. My second thought is, I can add a sling modal and handle this on java side and return a formatted JSON
3. First I can set it through sly.set and added into a div container, then get div element by JS and add the html attributes, then set it back [this not preferable]
Ex:

Also, after this formatting I need to send this JSON to a SPA, So I don't want to this on SPA's script.
Kindly suggest good approach. I appreciate any feedback you share.
Thanks
Abhishek