@mashroom/mashroom-portal-iframe-app

2.6.0 • Public • Published

Mashroom Portal iFrame App

Plugin for Mashroom Server, a Microfrontend Integration Platform.

Adds a (responsive) iFrame Portal App to the Mashroom Portal.

Usage

If node_modules/@mashroom is configured as plugin path just add @mashroom/mashroom-portal-iframe-app as dependency.

After placing it on a page use the Portal Admin Toolbar to set the following properties:

  • url: The URL of the page to show in the iframe
  • width: The iframe width (Default 100%)
  • defaultHeight: The height to use if the embedded page doesn't post the actual required height

To make the iFrame responsive, the embedded page has to post its height via message like so:

var lastContentHeight = null;

function sendHeight() {
    var contentHeight = document.getElementById('content-wrapper').offsetHeight;
    if (lastContentHeight !== contentHeight) {
        parent.postMessage({
            height: contentHeight + /* margin */ 20
        }, "*");
        lastContentHeight = contentHeight;
    }
}

setInterval(sendHeight, 1000);

Dependents (0)

Package Sidebar

Install

npm i @mashroom/mashroom-portal-iframe-app

Weekly Downloads

7

Version

2.6.0

License

MIT

Unpacked Size

7.67 kB

Total Files

4

Last publish

Collaborators

  • jkofler