Hi @TonyGoughAdaptavist ,
Perhaps you’re looking for a similar solution to @GeoffBullen in his Confluence dynamicContentMacro - Is it possible to open custom editor upon macro add topic?
If so, you may like to look at a Glitch app I created that provides a rough demo:
The example is a bit incomplete and glitchy, but will hopefully give you some ideas.
Regards,
Dugald