From 9284f601e56e29088b1deeb1c27f8ca6159f6f64 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Mon, 3 Sep 2018 11:08:25 -0700 Subject: [PATCH] separate messages --- pages/embed.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pages/embed.js b/pages/embed.js index f0a6022..7d7b1af 100644 --- a/pages/embed.js +++ b/pages/embed.js @@ -78,16 +78,23 @@ class Embed extends React.Component { // Used by embed provider src: window.location.toString(), context: 'iframe.resize', - height: this.ref.current.exportContainerNode.offsetHeight, - // Carbon specific data - id: this.state.id ? `carbon:${this.state.id}` : 'carbon', - code: this.state.code + height: this.ref.current.exportContainerNode.offsetHeight }), '*' ) } - updateCode = code => this.setState({ code }, this.postMessage) + updateCode = code => { + this.setState({ code }, this.postMessage) + + getParent(window).postMessage( + { + id: this.state.id ? `carbon:${this.state.id}` : 'carbon', + code + }, + '*' + ) + } render() { return (