From 608c12b25c998c9ec8761337b7a48205f14a703f Mon Sep 17 00:00:00 2001 From: Paulo Martins Date: Tue, 23 Mar 2021 11:58:31 -0300 Subject: [PATCH] PingPongFactory as a parameter to EmbeddedDivPingPong (#29) * PingPongFactory as a parameter to EmbeddedDivPingPong * PingPongFactory as a parameter to EmbeddedDivPingPong * PingPongFactory as a parameter to EmbeddedDivPingPong * PingPongFactory as a parameter to EmbeddedDivPingPong --- .../ping-pong-view/src/embedded/div/EmbeddedDivPingPong.tsx | 6 +++--- .../ping-pong-view/src/envelope/PingPongEnvelopeView.tsx | 5 ++++- packages/webapp/src/Pages/PingPong/PingPongDivViewsPage.tsx | 6 ++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/ping-pong-view/src/embedded/div/EmbeddedDivPingPong.tsx b/packages/ping-pong-view/src/embedded/div/EmbeddedDivPingPong.tsx index 2419d458734..93734cba64b 100644 --- a/packages/ping-pong-view/src/embedded/div/EmbeddedDivPingPong.tsx +++ b/packages/ping-pong-view/src/embedded/div/EmbeddedDivPingPong.tsx @@ -20,9 +20,8 @@ import { PingPongApi, PingPongChannelApi, PingPongEnvelopeApi } from "../../api" import { EnvelopeServer } from "@kogito-tooling/envelope-bus/dist/channel"; import { EmbeddedEnvelopeFactory } from "@kogito-tooling/envelope/dist/embedded"; import { ContainerType } from "@kogito-tooling/envelope/dist/api"; -import { init } from "../../envelope"; +import { init, PingPongFactory } from "../../envelope"; import { EnvelopeBusMessage } from "@kogito-tooling/envelope-bus/dist/api"; -import { PingPongReactImplFactory } from "ping-pong-view-react"; export type Props = PingPongChannelApi & { mapping: { @@ -30,6 +29,7 @@ export type Props = PingPongChannelApi & { }; targetOrigin: string; name: string; + pingPongViewFactory: PingPongFactory; }; export const EmbeddedDivPingPong = React.forwardRef((props: Props, forwardedRef: React.Ref) => { @@ -48,7 +48,7 @@ export const EmbeddedDivPingPong = React.forwardRef((props: Props, forwardedRef: window.postMessage(message, "*", transfer); }, }, - pingPongViewFactory: new PingPongReactImplFactory(), + pingPongViewFactory: props.pingPongViewFactory, }); return envelopeServer.envelopeApi.requests.pingPongView__init( diff --git a/packages/ping-pong-view/src/envelope/PingPongEnvelopeView.tsx b/packages/ping-pong-view/src/envelope/PingPongEnvelopeView.tsx index 71bd4b159d6..986fd02c74f 100644 --- a/packages/ping-pong-view/src/envelope/PingPongEnvelopeView.tsx +++ b/packages/ping-pong-view/src/envelope/PingPongEnvelopeView.tsx @@ -34,7 +34,10 @@ export const PingPongEnvelopeView = React.forwardRef((props, forwardedRef) => { <>

This is an implementation of Ping-Pong View

-

The {"