Copy/paste global elements only works when 1 or more items have already been added


When attempting to paste one or more copied global elements (e.g. a, button, input, select, etc), this only works if one already exists in the list.

Step-by-step reproduction instructions:

  1. Open the Post Editor/Site Editor
  2. Go to Globals > Elements > HTML
  3. Create one or more elements (as mentioned above e.g. button)
  4. Copy one ore more elements (e.g. button)
  5. Go to a clean site with no buttons (or delete all buttons on the existing site)
  6. Attempt to paste a button
  7. Note it doesn’t work
  8. Now, add a single button
  9. Paste the previously copied buttons
  10. Note that it now works correctly.

Environment info

  • WordPress version: 6.5.3
  • Cwicly Plugin version: