Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/editor/src/app/documentRenderers/richtext/FrameHost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,16 @@ export function FrameHost(props: { url: string; sessionStore: SessionStore }) {
// Methods the parent is exposing to the child
methods: methods,
});
connection.promise.then((methods) => {
connectionMethods = methods;
});
console.info("parent window connecting to iframe");
connection.promise.then(
(methods) => {
console.info("connected to iframe succesfully");
connectionMethods = methods;
},
(e) => {
console.error("connection to iframe failed", e);
},
);
return iframe;
}, [props.url, props.sessionStore]);

Expand Down
13 changes: 10 additions & 3 deletions packages/frame/src/Frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,16 @@ export const Frame: React.FC<Props> = observer((props) => {
// Methods child is exposing to parent
methods,
});
connection.promise.then((parent) => {
connectionMethods.current = parent;
});
console.info("iframe connecting to parent window");
connection.promise.then(
(parent) => {
console.info("connected to parent window succesfully");
connectionMethods.current = parent;
},
(e) => {
console.error("connection to parent window failed", e);
},
);
}, [modelReceivers]);

const document = useResource(() => {
Expand Down