Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To create an instance of the PublisherConnector, you will need to use the “build” method and pass in the iframe element.

Code Block
languagehtmljsx
<body>
    <iframe id="editor-iframe" style="width:1200px; height:800px"
        src="https://example.chili-publish.online/example/editor_html.aspx?doc=3d178228-a9b9-49d0-90d9-c1c8f8b67f05&apiKey=Sczs1ruhiZcaFiqg0G07gMFMq07X+SG2o8KlW8oAeZGvqoB1a0YvkbeZU1wJK15aIhANgZmhg+13NQlxpBEq7Q=="></iframe>
    <script type="module">
        import {PublisherConnector} from 'https://unpkg.com/@chili-publish/publisher-connector@latest/dist/PublisherConnector.min.js';
    
        const iframe = document.getElementById("editor-iframe");
    
        (async () => {
            const publisherConnector = await PublisherConnector.build(iframe);
            const documentName = await publisherConnector.getObject("document.name");
            console.log(documentName);
        })();
    </script>
</body>

...