hyunsupul / aesop-core

Open-sourced suite of components that empower interactive storytelling in WordPress.
http://aesopstoryengine.com
GNU General Public License v2.0
243 stars 56 forks source link

Custom component content not recognized for editing in Admin-Backend #323

Closed MichaWe closed 7 years ago

MichaWe commented 7 years ago

We created a custom component and registered a new shortcode for it. The new component has multiple attributes and 'type' = 'wrap' set in the options returned for the 'aesop_avail_components' filter.

When creating the component in the admin backend the text is displayed properly in the TinyMCE editor. But once to click the Edit-Option the $content-Text is lost and when returning to the Editor a dangling [/aesop_my_custom_shortcode] Shortcode is visible.

The reason for this is an error in the 'parse' function in 'admin/assets/js/tinymce/aiview/plugin.js'. The regular expression in 're_full' misses an underscore do properly detect the closing tag when the shortcode contains underscores.

Old: var re_full = /\[aesop_([a-zA-Z_]+)\s([^\[\]]*)]([^\[\]]+)\[\/aesop_[a-zA-Z]+]/g;

Fixed: var re_full = /\[aesop_([a-zA-Z_]+)\s([^\[\]]*)]([^\[\]]+)\[\/aesop_[a-zA-Z_]+]/g;

hyunsupul commented 7 years ago

Hi I added this change and will be a part of the next release. Thank you