Support » Plugins » Hacks » Updating Existing Shortcode from custom TinyMCE popup

  • Hi,

    I’m trying to create a user-friedly shortcode plugin. I’ve managed to create a TinyMCE plugins to add a new button, which opens a custom ‘short code helper’ page in a popup, allowing shortcode to be placed in the post content (following this tutorial).

    I’ve also managed to create a placeholder for the shortcode in the Visual post/page editor, which when double-clicked, opens the same popup short code parameters panel, based on code found here.

    I can currently update a single existing instance of the shortcode using the above method (which is great). Unfortunately, though, if I add more than one instance of the shortcode, things go a bit wrong. For example, with two instances, if I try to update the properties of the first shortcode instance, the second instance is deleted. I’m assuming this this is because the editor does not know which shortcode instance to update.

    Anyone any ideas on how I could fix this? Can I pass some kind of unique reference to the shortcode DOM element (or its placeholder) to the popup helper panel page, then pass this back to TinyMCE when the Update button is pressed, so the Editor is able to find the correct element, and not delete others?

    Anyone any tips?


  • The topic ‘Updating Existing Shortcode from custom TinyMCE popup’ is closed to new replies.