wdpr
    Preparing search index...

    Runtime module for auto-resizing [[html]] block iframes.

    HTML blocks are rendered as iframes. This module listens for postMessage events from those iframes and adjusts the iframe's height to match its content, eliminating scrollbars.

    The communication protocol uses a typed message with type: "wdpr-html-block-resize" and a numeric height field. The module also exports a script string (HTML_BLOCK_RESIZE_SCRIPT) that should be injected into the iframe's HTML to send resize messages.

    DOM interactions:

    • Listens for message events on window
    • Matches e.source against iframe.html-block-iframe elements in the root
    • Sets iframe.style.height to the reported content height

    The destroy() cleanup function removes the message listener.

    Variables

    HTML_BLOCK_RESIZE_SCRIPT

    Functions

    initHtmlBlockResize