• Hot Themes

    (@hotwptemplates)


    Hi all,

    I am making a slider block. I created a parent block (slider), child block (slides) and everything worked smoothly so far. However, I have problems with moving and deletion of the child blocks inside the parent block.

    The script that creates the slider adds some divs. For example, original HTML when script is not running is:

    <div class="slider-block">
    <div class="slide"></div>
    <div class="slide"></div>
    <div class="slide"></div>
    </div>

    After the slider script is executed, HTML is:

    <div class="slider-block">
    <div class="viewport">
    <div class="slide"></div>
    <div class="slide"></div>
    <div class="slide"></div>
    </div>
    </div>

    So, far it works fine. The slider rotates and work smoothly in both editor and site front end.

    However, when I try to move slide child blocks or delete them, I got ReactJS error explaining “failed to execute ‘removechild’ on ‘node’: the node to be removed is not a child of this node.”

    Any workaround for this? Or it’s not possible to use scripts that manipulates DOM (add new elements, wrap exisiting elements, etc.).

    Thanks,
    Milos

Viewing 1 replies (of 1 total)
  • Are you able to modify the slider script, or is it a 3rd party script?

    Because the Editor expects innerBlocks to be children of the element defined as the parent I can’t see a way around this other than in the editor manually adding the <div class="viewport"> element and making it the wrapper of the innerBlocks children. Then in the slider script only add this wrapper div if it doesn’t already exist.

Viewing 1 replies (of 1 total)
  • The topic ‘Parent and child blocks and DOM manipulation’ is closed to new replies.