This is an example shortcode:
[boutique_banner title="Loyalty Program:" link="More" linkhref="/"]Earn 1 point for every $5 spent[/boutique_banner]
I have created a custom mce view to display this shortcode nicely in the backend editor. Now I'm working on the "edit" button when this shortcode is clicked.
I am trying to get all the attributes and the shortcode content, so I can display them when doing editor.windowManager.open
This is the working regex I have for getting the attributes:
var re = /([\w\-.:]+)\s*=\s*"([^"]*)"/g, values = {}, match;
while(match = re.exec(shortcode_string)){
values[match[1]] = match[2]
}
But I'm a little stuck on getting the actual shortcode content, [x]this stuff[/x]
Is there an existing javascript shortcode parser in wordpress? I had a look through the gallery mce view to try and see how they handle shortcode attribute parsing but nothing stood out.
Any ideas?
Thanks!