title: Wordpress detect gallery edited when multiple galleries are used
body: <p>I am developing a mce plugin for custom gallery support. I am able to create multiple galleries as usual but the edit/pencil icon (that appears over the gallery in the visual mode) is not distinguishing between multiple galleries. In fact, I am not even sure how to get the gallery that initiated the event. I tried using jQuery('#wpwrap textarea') but it always shows the first gallery. </p>
  
  <p>Here is what I see if I inspect on the edit/pencil icon and I see the same HTML code no matter which gallery I click.</p>
  
  <pre><code>&lt;div id="mceu_60" class="mce-toolbar-grp mce-inline-toolbar-grp mce-container mce-panel mce-arrow-down" hidefocus="1" tabindex="-1" role="group" style="left: 489.969px; top: 1027.98px; display: none;"&gt;
      &lt;div id="mceu_60-body" class="mce-container-body mce-stack-layout"&gt;
          &lt;div id="mceu_61" class="mce-container mce-toolbar mce-stack-layout-item mce-first mce-last" role="toolbar"&gt;
              &lt;div id="mceu_61-body" class="mce-container-body mce-flow-layout"&gt;
                  &lt;div id="mceu_62" class="mce-container mce-flow-layout-item mce-first mce-last mce-btn-group" role="group"&gt;
                      &lt;div id="mceu_62-body"&gt;
                          &lt;div id="mceu_58" class="mce-widget mce-btn mce-first" tabindex="-1" aria-labelledby="mceu_58" role="button" aria-label="Edit "&gt;
                              &lt;button role="presentation" type="button" tabindex="-1"&gt;
                                  &lt;i class="mce-ico mce-i-dashicon dashicons-edit"&gt;&lt;/i&gt;
                              &lt;/button&gt;
                          &lt;/div&gt;
                          &lt;div id="mceu_59" class="mce-widget mce-btn mce-last" tabindex="-1" aria-labelledby="mceu_59" role="button" aria-label="Remove"&gt;
                              &lt;button role="presentation" type="button" tabindex="-1"&gt;
                                  &lt;i class="mce-ico mce-i-dashicon dashicons-no"&gt;&lt;/i&gt;
                              &lt;/button&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The plugin code is at <a href="https://github.com/saravr/enhanced-wp-gallery" rel="nofollow noreferrer">https://github.com/saravr/enhanced-wp-gallery</a>.</p>
  
  <p>Any idea how I can distinguish which "gallery" is being edited ?</p>