IframeCommunicationManager

Type: Class

How to get iframeCommunicationManager?

JavaScript

import iframeCommunicationManager from 'fontoxml-iframe-communication/src/iframeCommunicationManager.js'

Allows the application hosting a Fonto window to control the active Fonto instance and vice versa.

Import fontoxml-iframe-communication/iframeCommunicationManager from the Fonto application to communicate with the hosting application. Use the browser's native postMessage API to control the Fonto instance from the hosting application.

Messages posted to the Fonto window or iframe should have as their data a JSON-encoded object with at least a type property specifying the type of the message, as listed in the table below.

Accepted messages

Message type

Description

fontoxml-execute-operation

Execute an operation. The message data should contain the operationName to invoke, and data to pass to the operation. Only operations from a limited whitelist may be invoked from an external source. By default this list is empty. Set the iframe-communication-operations-whitelist configuration setting to an array of operation names to specify the whitelist.

Methods

postMessageToParent

Type: Function

Post a custom command message to the parent window.

Arguments

sendClose

Type: Function

Tell the hosting application to close the Fonto instance. The hosting application is responsible for cleaning up auto-saves, releasing locks and closing the window or iframe. If discardSaves is true, all saves of the current session should be discarded.

Arguments

sendToggleFullScreen

Type: Function

Tell the hosting application to resize the Fonto window or iframe between a full-screen view and one hosted in the CMS interface.

Arguments