Support » Developing with WordPress » Problems unsing multiple empty image blocks

  • Resolved adrianfilipow

    (@adrianfilipow)


    Hello,

    I am working on a plugin that selects a specific attachment in a media frame. I encountered some problems using multiple empty blocks in one post.

    If I am on a post and I create a block e.g. „image“ and choose „Media Library“ to pick an attachment the media frame opens.

    Then I select an attachment using: „wp.media.frame.state().get(‘selection’).add(wp.media.attachment(5))“ and everything works as expected.

    The problem: If I place multiple empty blocks and choose „Media Library“ from a block that is above another empty block I get an error that the state is undefined.

    Why is that happening and how could I fix this?

    A short screen capture for better understanding: https://streamable.com/c4xuw5

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.