JavaScript for WordPress Forums Gutenberg Development Block Doesn't Refresh on Options Changes

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #117435
    azizultex
    Participant

    Hi Zac,
    I’m creating a topic here as you asked in email support.

    THE PROBLEM:
    I’ve developed a custom block that embed Media Library, Youtube, Vimeo, or Other source video as selected using a tag <smartvideo>. The tag works like <smartvideo src={smartvideoEmbedLink} width='1240' height='742' class='swarm-fluid' autoplay muted loop controls playsinline></smartvideo> The options are created in Control Panel right side. But one problem I faced is that the block preview doesn’t auto fresh on options changes. It actually save the data because the changes shows on manually reload the page.

    PROBLEM SCREEN RECORD:
    https://recordit.co/Y5qADa8vHn

    POTENTIAL SOLUTION:
    I went through https://github.com/WordPress/gutenberg/blob/master/packages/block-library/src/video/edit.js#L301 I found that using createRef could solve the issue, but it works for video tag only. Doesn’t work for iframe or our custom tag smartvideo

    Any help is highly appreciated.

    Thanks in advanced.

    #117507
    Zac Gordon
    Keymaster

    Okay, the first thing I want to check is if you just hardcode the value of the options attribute to the page, is that changing when you select different values? Before testing the media part of this, want to make sure _some_ change is happening when you change the dropdown.

    Can you please share the code you are using for updating the attribute value when the dropdown changes?

    #117536
    azizultex
    Participant

    Hi Zac,
    Yes, the values update. As previously stated, ‘video’ tag works fine, except the iframe and our custom smartvideo tags. I already shared my github repo link to you on your email. Please check.

    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.