This is an automated email from the ASF dual-hosted git repository.

tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new 1eb6a367d12 kie-issues#1595: Sandbox: Add "Open in Boxed Expression 
Editor" button in the DMN Runner form output cards (#2720)
1eb6a367d12 is described below

commit 1eb6a367d126953c398900e825133f88e42d2584
Author: Jozef Marko <[email protected]>
AuthorDate: Wed Jan 22 21:56:40 2025 +0100

    kie-issues#1595: Sandbox: Add "Open in Boxed Expression Editor" button in 
the DMN Runner form output cards (#2720)
---
 packages/boxed-expression-component/README.md      | 10 -----
 .../dmn-editor-envelope/src/DmnEditorFactory.tsx   |  2 +-
 packages/dmn-editor-envelope/src/DmnEditorRoot.tsx |  4 ++
 .../src/NewDmnEditorChannelApi.ts}                 |  9 +----
 .../src/NewDmnEditorEnvelopeApi.ts}                | 15 +++----
 .../src/NewDmnEditorEnvelopeApiFactory.ts          | 46 ++++++++++++++++++++++
 .../src/NewDmnEditorFactory.tsx                    | 42 ++++++++++++++++++++
 packages/dmn-editor/src/DmnEditor.tsx              |  6 +++
 packages/form-dmn/src/FormDmnOutputs.tsx           | 28 +++++++++++--
 .../src/dmnRunner/DmnRunnerContext.tsx             |  2 +
 .../src/dmnRunner/DmnRunnerContextProvider.tsx     |  4 ++
 .../src/dmnRunner/DmnRunnerDrawerPanelContent.tsx  | 27 ++++++++++++-
 packages/online-editor/src/editor/EditorPage.tsx   |  1 +
 .../src/editor/Toolbar/NewFileDropdownMenu.tsx     |  5 +--
 .../src/envelope/NewDmnEditorEnvelopeApp.ts        | 13 ++++--
 .../EditorEnvelopeLocatorFactory.ts                | 12 +-----
 .../hooks/EditorEnvelopeLocatorContext.tsx         |  2 -
 packages/online-editor/src/home/HomePage.tsx       |  5 +--
 18 files changed, 178 insertions(+), 55 deletions(-)

diff --git a/packages/boxed-expression-component/README.md 
b/packages/boxed-expression-component/README.md
index a9dc432b9c5..ee3b6bb598c 100644
--- a/packages/boxed-expression-component/README.md
+++ b/packages/boxed-expression-component/README.md
@@ -28,16 +28,6 @@ This editor provides the possibility to edit the expression 
related to a Decisio
 The main component is 
`src/components/BoxedExpressionEditor/BoxedExpressionEditor.tsx`.
 It represents the entry point for using the editor.
 
-In the `showcase` folder, there is a tiny React application, which represent 
the Proof Of Value about how it is possible to integrate the 
`BoxedExpressionEditor` component inside another existing application.
-
-Once the showcase application gets launched, you can see on the right side of 
the page the JSON that is actually produced for the corresponding selected 
logic type.
-Such JSON represents the model data that must be adopted to initialize the 
`BoxedExpressionEditor` component, by populating its props.
-
-The retrieval of the updated expression is performed by making usage of global 
functions, belonging to `beeApiWrapper` object, that must be available in the 
`Window` namespace and used by the `BoxedExpressionEditor` component.
-All exposed function expected to exist, are defined in 
`src/api/BoxedExpressionEditor.ts`.
-
-Consider that the showcase app is able to display the most updated JSON 
representing an expression, because uses such APIs (please refer to 
`showcase/src/index.tsx`).
-
 ## Scripts
 
 In the main project (where the components actually live), it is possible to 
execute, from the root folder, the following scripts (`pnpm` is recommended):
diff --git a/packages/dmn-editor-envelope/src/DmnEditorFactory.tsx 
b/packages/dmn-editor-envelope/src/DmnEditorFactory.tsx
index 0af0ec31460..ca44d6f5bcb 100644
--- a/packages/dmn-editor-envelope/src/DmnEditorFactory.tsx
+++ b/packages/dmn-editor-envelope/src/DmnEditorFactory.tsx
@@ -42,7 +42,7 @@ export class DmnEditorFactory implements 
EditorFactory<Editor, KogitoEditorChann
 }
 
 export class DmnEditorInterface implements Editor {
-  private self: DmnEditorRoot;
+  protected self: DmnEditorRoot;
   public af_isReact = true;
   public af_componentId: "dmn-editor";
   public af_componentTitle: "DMN Editor";
diff --git a/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx 
b/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
index 6388a6b4a11..284178b8a07 100644
--- a/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
+++ b/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
@@ -100,6 +100,10 @@ export class DmnEditorRoot extends 
React.Component<DmnEditorRootProps, DmnEditor
 
   // Exposed API
 
+  public openBoxedExpressionEditor(nodeId: string): void {
+    this.dmnEditorRef.current?.openBoxedExpressionEditor(nodeId);
+  }
+
   public async undo(): Promise<void> {
     this.setState((prev) => ({ ...prev, pointer: Math.max(0, prev.pointer - 1) 
}));
   }
diff --git a/packages/online-editor/src/envelope/NewDmnEditorEnvelopeApp.ts 
b/packages/dmn-editor-envelope/src/NewDmnEditorChannelApi.ts
similarity index 67%
copy from packages/online-editor/src/envelope/NewDmnEditorEnvelopeApp.ts
copy to packages/dmn-editor-envelope/src/NewDmnEditorChannelApi.ts
index 2a7d112a7b6..a29086a40ed 100644
--- a/packages/online-editor/src/envelope/NewDmnEditorEnvelopeApp.ts
+++ b/packages/dmn-editor-envelope/src/NewDmnEditorChannelApi.ts
@@ -17,11 +17,6 @@
  * under the License.
  */
 
-import * as EditorEnvelope from "@kie-tools-core/editor/dist/envelope";
-import { DmnEditorFactory } from 
"@kie-tools/dmn-editor-envelope/dist/DmnEditorFactory";
+import { KogitoEditorChannelApi } from "@kie-tools-core/editor/dist/api";
 
-EditorEnvelope.init({
-  container: document.getElementById("envelope-app")!,
-  bus: { postMessage: (message, targetOrigin, _) => 
window.parent.postMessage(message, "*", _) },
-  editorFactory: new DmnEditorFactory(),
-});
+export interface NewDmnEditorChannelApi extends KogitoEditorChannelApi {}
diff --git a/packages/online-editor/src/envelope/NewDmnEditorEnvelopeApp.ts 
b/packages/dmn-editor-envelope/src/NewDmnEditorEnvelopeApi.ts
similarity index 67%
copy from packages/online-editor/src/envelope/NewDmnEditorEnvelopeApp.ts
copy to packages/dmn-editor-envelope/src/NewDmnEditorEnvelopeApi.ts
index 2a7d112a7b6..692f3ca8622 100644
--- a/packages/online-editor/src/envelope/NewDmnEditorEnvelopeApp.ts
+++ b/packages/dmn-editor-envelope/src/NewDmnEditorEnvelopeApi.ts
@@ -17,11 +17,12 @@
  * under the License.
  */
 
-import * as EditorEnvelope from "@kie-tools-core/editor/dist/envelope";
-import { DmnEditorFactory } from 
"@kie-tools/dmn-editor-envelope/dist/DmnEditorFactory";
+import { KogitoEditorEnvelopeApi } from "@kie-tools-core/editor/dist/api";
 
-EditorEnvelope.init({
-  container: document.getElementById("envelope-app")!,
-  bus: { postMessage: (message, targetOrigin, _) => 
window.parent.postMessage(message, "*", _) },
-  editorFactory: new DmnEditorFactory(),
-});
+export interface NewDmnEditorEnvelopeApi extends KogitoEditorEnvelopeApi {
+  /**
+   * Open boxed expression editor for given node
+   * @param nodeId id of the node to open
+   */
+  dmnEditor_openBoxedExpressionEditor(nodeId: string): void;
+}
diff --git a/packages/dmn-editor-envelope/src/NewDmnEditorEnvelopeApiFactory.ts 
b/packages/dmn-editor-envelope/src/NewDmnEditorEnvelopeApiFactory.ts
new file mode 100644
index 00000000000..8c58c9dbdcf
--- /dev/null
+++ b/packages/dmn-editor-envelope/src/NewDmnEditorEnvelopeApiFactory.ts
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { EnvelopeApiFactoryArgs } from "@kie-tools-core/envelope";
+import { EditorEnvelopeViewApi, KogitoEditorEnvelopeApiImpl } from 
"@kie-tools-core/editor/dist/envelope";
+import { KogitoEditorEnvelopeContextType } from 
"@kie-tools-core/editor/dist/api";
+import { NewDmnEditorInterface } from "./NewDmnEditorFactory";
+import { NewDmnEditorEnvelopeApi } from "./NewDmnEditorEnvelopeApi";
+import { NewDmnEditorChannelApi } from "./NewDmnEditorChannelApi";
+import { NewDmnEditorFactory } from "./NewDmnEditorFactory";
+
+export type NewDmnEnvelopeApiFactoryArgs = EnvelopeApiFactoryArgs<
+  NewDmnEditorEnvelopeApi,
+  NewDmnEditorChannelApi,
+  EditorEnvelopeViewApi<NewDmnEditorInterface>,
+  KogitoEditorEnvelopeContextType<NewDmnEditorChannelApi>
+>;
+
+export class NewDmnEditorEnvelopeApiImpl
+  extends KogitoEditorEnvelopeApiImpl<NewDmnEditorInterface, 
NewDmnEditorEnvelopeApi, NewDmnEditorChannelApi>
+  implements NewDmnEditorEnvelopeApi
+{
+  constructor(readonly dmnArgs: NewDmnEnvelopeApiFactoryArgs) {
+    super(dmnArgs, new NewDmnEditorFactory());
+  }
+
+  public dmnEditor_openBoxedExpressionEditor(nodeId: string): void {
+    this.getEditorOrThrowError().openBoxedExpressionEditor(nodeId);
+  }
+}
diff --git a/packages/dmn-editor-envelope/src/NewDmnEditorFactory.tsx 
b/packages/dmn-editor-envelope/src/NewDmnEditorFactory.tsx
new file mode 100644
index 00000000000..ca94144d6c6
--- /dev/null
+++ b/packages/dmn-editor-envelope/src/NewDmnEditorFactory.tsx
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { EditorFactory, EditorInitArgs, KogitoEditorEnvelopeContextType } from 
"@kie-tools-core/editor/dist/api";
+import { NewDmnEditorChannelApi } from "./NewDmnEditorChannelApi";
+import { DmnEditorInterface } from "./DmnEditorFactory";
+
+export class NewDmnEditorFactory implements 
EditorFactory<NewDmnEditorInterface, NewDmnEditorChannelApi> {
+  public createEditor(
+    envelopeContext: KogitoEditorEnvelopeContextType<NewDmnEditorChannelApi>,
+    initArgs: EditorInitArgs
+  ): Promise<NewDmnEditorInterface> {
+    return Promise.resolve(new NewDmnEditorInterface(envelopeContext, 
initArgs));
+  }
+}
+
+export class NewDmnEditorInterface extends DmnEditorInterface {
+  /**
+   * Open boxed expression editor for given node
+   * @param nodeId id of the node to open
+   */
+  public openBoxedExpressionEditor(nodeId: string): void {
+    this.self.openBoxedExpressionEditor(nodeId);
+  }
+}
diff --git a/packages/dmn-editor/src/DmnEditor.tsx 
b/packages/dmn-editor/src/DmnEditor.tsx
index 3a1b18aa288..e1115f7f97f 100644
--- a/packages/dmn-editor/src/DmnEditor.tsx
+++ b/packages/dmn-editor/src/DmnEditor.tsx
@@ -67,6 +67,7 @@ const SVG_PADDING = 20;
 export type DmnEditorRef = {
   reset: (mode: DmnLatestModel) => void;
   getDiagramSvg: () => Promise<string | undefined>;
+  openBoxedExpressionEditor: (nodeId: string) => void;
   getCommands: () => Commands;
 };
 
@@ -203,6 +204,11 @@ export const DmnEditorInternal = ({
         const state = dmnEditorStoreApi.getState();
         return state.dispatch(state).dmn.reset(normalize(model));
       },
+      openBoxedExpressionEditor: (nodeId: string) => {
+        dmnEditorStoreApi.setState((state) => {
+          state.dispatch(state).boxedExpressionEditor.open(nodeId);
+        });
+      },
       getDiagramSvg: async () => {
         const nodes = diagramRef.current?.getReactFlowInstance()?.getNodes();
         const edges = diagramRef.current?.getReactFlowInstance()?.getEdges();
diff --git a/packages/form-dmn/src/FormDmnOutputs.tsx 
b/packages/form-dmn/src/FormDmnOutputs.tsx
index 9cd9ac6ce94..303b8a92ba2 100644
--- a/packages/form-dmn/src/FormDmnOutputs.tsx
+++ b/packages/form-dmn/src/FormDmnOutputs.tsx
@@ -19,6 +19,7 @@
 
 import * as React from "react";
 import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { ArrowUpIcon } from 
"@patternfly/react-icons/dist/js/icons/arrow-up-icon";
 import { CheckCircleIcon } from 
"@patternfly/react-icons/dist/js/icons/check-circle-icon";
 import { InfoCircleIcon } from 
"@patternfly/react-icons/dist/js/icons/info-circle-icon";
 import { ExclamationCircleIcon } from 
"@patternfly/react-icons/dist/js/icons/exclamation-circle-icon";
@@ -40,6 +41,8 @@ import "./styles.scss";
 import { ErrorBoundary } from "@kie-tools/dmn-runner/dist/ErrorBoundary";
 import { ExclamationTriangleIcon } from 
"@patternfly/react-icons/dist/js/icons/exclamation-triangle-icon";
 import { DecisionResult, DmnEvaluationStatus, DmnEvaluationResult } from 
"@kie-tools/extended-services-api";
+import { Flex } from "@patternfly/react-core/dist/js/layouts/Flex";
+import { Button } from "@patternfly/react-core/dist/js/components/Button";
 
 const ISSUES_URL = "https://github.com/apache/incubator-kie-issues/issues";;
 
@@ -61,9 +64,10 @@ export interface FormDmnOutputsProps {
   locale?: string;
   notificationsPanel: boolean;
   openExecutionTab?: () => void;
+  openBoxedExpressionEditor?: (nodeId: string) => void;
 }
 
-export function FormDmnOutputs({ openExecutionTab, ...props }: 
FormDmnOutputsProps) {
+export function FormDmnOutputs({ openExecutionTab, openBoxedExpressionEditor, 
...props }: FormDmnOutputsProps) {
   const [formResultStatus, setFormResultStatus] = 
useState<FormDmnOutputsStatus>(FormDmnOutputsStatus.EMPTY);
   const [formResultError, setFormResultError] = useState<boolean>(false);
   const i18n = useMemo(() => {
@@ -247,6 +251,13 @@ export function FormDmnOutputs({ openExecutionTab, 
...props }: FormDmnOutputsPro
     [i18n]
   );
 
+  const onOpenBoxedExpressionEditor = useCallback(
+    (nodeId: string) => {
+      return openBoxedExpressionEditor?.(nodeId);
+    },
+    [openBoxedExpressionEditor]
+  );
+
   const resultsToRender = useMemo(
     () =>
       props.results?.map((dmnFormResult, index) => (
@@ -258,14 +269,25 @@ export function FormDmnOutputs({ openExecutionTab, 
...props }: FormDmnOutputsPro
             onAnimationEnd={(e) => onAnimationEnd(e, index)}
           >
             <CardTitle>
-              <Title headingLevel={"h2"}>{dmnFormResult.decisionName}</Title>
+              <Flex justifyContent={{ default: "justifyContentSpaceBetween" }}>
+                <Title headingLevel={"h2"}>{dmnFormResult.decisionName}</Title>
+                {onOpenBoxedExpressionEditor !== undefined && (
+                  <Button
+                    variant={"plain"}
+                    title={`Open ${dmnFormResult.decisionName} expression`}
+                    icon={<ArrowUpIcon />}
+                    data-navigate-to-expression-id={dmnFormResult.decisionId}
+                    onClick={() => 
onOpenBoxedExpressionEditor?.(dmnFormResult.decisionId)}
+                  />
+                )}
+              </Flex>
             </CardTitle>
             <CardBody isFilled={true}>{result(dmnFormResult.result)}</CardBody>
             
<CardFooter>{resultStatus(dmnFormResult.evaluationStatus)}</CardFooter>
           </Card>
         </div>
       )),
-    [onAnimationEnd, props.results, result, resultStatus]
+    [onAnimationEnd, onOpenBoxedExpressionEditor, props.results, result, 
resultStatus]
   );
 
   const formResultErrorMessage = useMemo(
diff --git a/packages/online-editor/src/dmnRunner/DmnRunnerContext.tsx 
b/packages/online-editor/src/dmnRunner/DmnRunnerContext.tsx
index 7812fb0ae62..fcbbda6d9ac 100644
--- a/packages/online-editor/src/dmnRunner/DmnRunnerContext.tsx
+++ b/packages/online-editor/src/dmnRunner/DmnRunnerContext.tsx
@@ -26,6 +26,7 @@ import { InputRow } from "@kie-tools/form-dmn";
 import { DecisionResult } from "@kie-tools/extended-services-api";
 import { DmnRunnerProviderAction } from "./DmnRunnerTypes";
 import type { JSONSchema4 } from "json-schema";
+import { EmbeddedEditorRef } from "@kie-tools-core/editor/dist/embedded";
 
 export interface DmnRunnerContextType {
   configs: UnitablesInputsConfigs;
@@ -41,6 +42,7 @@ export interface DmnRunnerContextType {
   results: Array<DecisionResult[] | undefined>;
   resultsDifference: Array<Array<object>>;
   status: DmnRunnerStatus;
+  dmnEditor: EmbeddedEditorRef | undefined;
 }
 
 export interface DmnRunnerCallbacksContextType {
diff --git a/packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx 
b/packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx
index 7cb82c0e04e..e14ba93af5c 100644
--- a/packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx
+++ b/packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx
@@ -73,11 +73,13 @@ import {
 import { extractDifferencesFromArray } from 
"@kie-tools/dmn-runner/dist/results";
 import { openapiSchemaToJsonSchema } from 
"@openapi-contrib/openapi-schema-to-json-schema";
 import type { JSONSchema4 } from "json-schema";
+import { EmbeddedEditorRef } from "@kie-tools-core/editor/dist/embedded";
 
 interface Props {
   isEditorReady?: boolean;
   workspaceFile: WorkspaceFile;
   dmnLanguageService?: DmnLanguageService;
+  dmnEditor: EmbeddedEditorRef | undefined;
 }
 
 const initialDmnRunnerProviderStates: DmnRunnerProviderState = {
@@ -708,6 +710,7 @@ export function DmnRunnerContextProvider(props: 
PropsWithChildren<Props>) {
       results,
       resultsDifference,
       status,
+      dmnEditor: props.dmnEditor,
     }),
     [
       canBeVisualized,
@@ -723,6 +726,7 @@ export function DmnRunnerContextProvider(props: 
PropsWithChildren<Props>) {
       results,
       resultsDifference,
       status,
+      props.dmnEditor,
     ]
   );
 
diff --git 
a/packages/online-editor/src/dmnRunner/DmnRunnerDrawerPanelContent.tsx 
b/packages/online-editor/src/dmnRunner/DmnRunnerDrawerPanelContent.tsx
index ac899b3bf2e..cc3b3ad7086 100644
--- a/packages/online-editor/src/dmnRunner/DmnRunnerDrawerPanelContent.tsx
+++ b/packages/online-editor/src/dmnRunner/DmnRunnerDrawerPanelContent.tsx
@@ -38,6 +38,9 @@ import { DmnRunnerLoading } from "./DmnRunnerLoading";
 import { DmnRunnerProviderActionType } from "./DmnRunnerTypes";
 import { PanelId, useEditorDockContext } from 
"../editor/EditorPageDockContextProvider";
 import { DmnRunnerExtendedServicesError } from "./DmnRunnerContextProvider";
+import { MessageBusClientApi } from "@kie-tools-core/envelope-bus/dist/api";
+import { NewDmnEditorEnvelopeApi } from 
"@kie-tools/dmn-editor-envelope/dist/NewDmnEditorEnvelopeApi";
+import { useSettings } from "../settings/SettingsContext";
 
 enum ButtonPosition {
   INPUT,
@@ -65,13 +68,24 @@ export function DmnRunnerDrawerPanelContent() {
   const [rowSelectionIsOpen, openRowSelection] = useState<boolean>(false);
 
   const { i18n, locale } = useOnlineI18n();
-  const { currentInputIndex, dmnRunnerKey, extendedServicesError, inputs, 
jsonSchema, results, resultsDifference } =
-    useDmnRunnerState();
+  const {
+    currentInputIndex,
+    dmnRunnerKey,
+    extendedServicesError,
+    inputs,
+    jsonSchema,
+    results,
+    resultsDifference,
+    dmnEditor,
+  } = useDmnRunnerState();
   const { setDmnRunnerContextProviderState, onRowAdded, setDmnRunnerInputs, 
setDmnRunnerMode } = useDmnRunnerDispatch();
   const { notificationsPanel, onOpenPanel } = useEditorDockContext();
 
   const formInputs: InputRow = useMemo(() => inputs[currentInputIndex], 
[inputs, currentInputIndex]);
 
+  const { settings } = useSettings();
+  const isLegacyDmnEditor = useMemo(() => settings.editors.useLegacyDmnEditor, 
[settings.editors.useLegacyDmnEditor]);
+
   const onResize = useCallback((width: number) => {
     // FIXME: PatternFly bug. The first interaction without resizing the 
splitter will result in width === 0.
     if (width === 0) {
@@ -324,6 +338,15 @@ export function DmnRunnerDrawerPanelContent() {
                       locale={locale}
                       notificationsPanel={true}
                       openExecutionTab={openExecutionTab}
+                      openBoxedExpressionEditor={
+                        !isLegacyDmnEditor
+                          ? (nodeId: string) => {
+                              const newDmnEditorEnvelopeApi = 
dmnEditor?.getEnvelopeServer()
+                                .envelopeApi as unknown as 
MessageBusClientApi<NewDmnEditorEnvelopeApi>;
+                              
newDmnEditorEnvelopeApi.notifications.dmnEditor_openBoxedExpressionEditor.send(nodeId);
+                            }
+                          : undefined
+                      }
                     />
                   </PageSection>
                 </div>
diff --git a/packages/online-editor/src/editor/EditorPage.tsx 
b/packages/online-editor/src/editor/EditorPage.tsx
index 1d3c343e716..e0ba6b6f63f 100644
--- a/packages/online-editor/src/editor/EditorPage.tsx
+++ b/packages/online-editor/src/editor/EditorPage.tsx
@@ -475,6 +475,7 @@ Error details: ${err}`);
                   workspaceFile={file.workspaceFile}
                   isEditorReady={editor?.isReady}
                   dmnLanguageService={dmnLanguageService}
+                  dmnEditor={editor}
                 >
                   <EditorToolbar workspaceFile={file.workspaceFile} 
editor={editor} />
                   <Divider />
diff --git a/packages/online-editor/src/editor/Toolbar/NewFileDropdownMenu.tsx 
b/packages/online-editor/src/editor/Toolbar/NewFileDropdownMenu.tsx
index 47462d66535..72471d958fb 100644
--- a/packages/online-editor/src/editor/Toolbar/NewFileDropdownMenu.tsx
+++ b/packages/online-editor/src/editor/Toolbar/NewFileDropdownMenu.tsx
@@ -32,10 +32,7 @@ import {
   MenuItem,
   MenuList,
 } from "@patternfly/react-core/dist/js/components/Menu";
-import {
-  SupportedFileExtensions,
-  useEditorEnvelopeLocator,
-} from "../../envelopeLocator/hooks/EditorEnvelopeLocatorContext";
+import { useEditorEnvelopeLocator } from 
"../../envelopeLocator/hooks/EditorEnvelopeLocatorContext";
 import { Button, ButtonVariant } from 
"@patternfly/react-core/dist/js/components/Button";
 import { Alert, AlertActionCloseButton } from 
"@patternfly/react-core/dist/js/components/Alert";
 import { basename, extname } from "path";
diff --git a/packages/online-editor/src/envelope/NewDmnEditorEnvelopeApp.ts 
b/packages/online-editor/src/envelope/NewDmnEditorEnvelopeApp.ts
index 2a7d112a7b6..babd3fb7a5b 100644
--- a/packages/online-editor/src/envelope/NewDmnEditorEnvelopeApp.ts
+++ b/packages/online-editor/src/envelope/NewDmnEditorEnvelopeApp.ts
@@ -18,10 +18,15 @@
  */
 
 import * as EditorEnvelope from "@kie-tools-core/editor/dist/envelope";
-import { DmnEditorFactory } from 
"@kie-tools/dmn-editor-envelope/dist/DmnEditorFactory";
+import { NewDmnEditorInterface } from 
"@kie-tools/dmn-editor-envelope/dist/NewDmnEditorFactory";
+import { NewDmnEditorChannelApi } from 
"@kie-tools/dmn-editor-envelope/dist/NewDmnEditorChannelApi";
+import { NewDmnEditorEnvelopeApi } from 
"@kie-tools/dmn-editor-envelope/dist/NewDmnEditorEnvelopeApi";
+import { NewDmnEditorEnvelopeApiImpl } from 
"@kie-tools/dmn-editor-envelope/dist/NewDmnEditorEnvelopeApiFactory";
 
-EditorEnvelope.init({
+EditorEnvelope.initCustom<NewDmnEditorInterface, NewDmnEditorEnvelopeApi, 
NewDmnEditorChannelApi>({
   container: document.getElementById("envelope-app")!,
-  bus: { postMessage: (message, targetOrigin, _) => 
window.parent.postMessage(message, "*", _) },
-  editorFactory: new DmnEditorFactory(),
+  bus: { postMessage: (message, targetOrigin, _) => 
window.parent.postMessage(message, targetOrigin!, _) },
+  apiImplFactory: {
+    create: (args) => new NewDmnEditorEnvelopeApiImpl(args),
+  },
 });
diff --git 
a/packages/online-editor/src/envelopeLocator/EditorEnvelopeLocatorFactory.ts 
b/packages/online-editor/src/envelopeLocator/EditorEnvelopeLocatorFactory.ts
index eb679129b4a..750abf073d2 100644
--- a/packages/online-editor/src/envelopeLocator/EditorEnvelopeLocatorFactory.ts
+++ b/packages/online-editor/src/envelopeLocator/EditorEnvelopeLocatorFactory.ts
@@ -18,7 +18,7 @@
  */
 
 import { EditorEnvelopeLocator, EnvelopeContentType, EnvelopeMapping } from 
"@kie-tools-core/editor/dist/api";
-import { FileTypes, isOfKind } from 
"@kie-tools-core/workspaces-git-fs/dist/constants/ExtensionHelper";
+import { isOfKind } from 
"@kie-tools-core/workspaces-git-fs/dist/constants/ExtensionHelper";
 import { EditorConfig } from "./EditorEnvelopeLocatorApi";
 
 export const GLOB_PATTERN = {
@@ -29,16 +29,6 @@ export const GLOB_PATTERN = {
   pmml: "**/*.pmml",
 };
 
-export const supportedFileExtensionArray = [
-  FileTypes.DMN,
-  FileTypes.BPMN,
-  FileTypes.BPMN2,
-  FileTypes.SCESIM,
-  FileTypes.PMML,
-];
-
-export type SupportedFileExtensions = (typeof 
supportedFileExtensionArray)[number];
-
 export function isModel(path: string): boolean {
   return isOfKind("dmn", path) || isOfKind("bpmn", path) || isOfKind("pmml", 
path);
 }
diff --git 
a/packages/online-editor/src/envelopeLocator/hooks/EditorEnvelopeLocatorContext.tsx
 
b/packages/online-editor/src/envelopeLocator/hooks/EditorEnvelopeLocatorContext.tsx
index 2f8586d9afe..ac9194e355f 100644
--- 
a/packages/online-editor/src/envelopeLocator/hooks/EditorEnvelopeLocatorContext.tsx
+++ 
b/packages/online-editor/src/envelopeLocator/hooks/EditorEnvelopeLocatorContext.tsx
@@ -25,8 +25,6 @@ import { EditorConfig } from "../EditorEnvelopeLocatorApi";
 import { EditorEnvelopeLocator } from 
"@kie-tools-core/editor/dist/api/EditorEnvelopeLocator";
 import { FileTypes } from 
"@kie-tools-core/workspaces-git-fs/dist/constants/ExtensionHelper";
 
-export type SupportedFileExtensions = "bpmn" | "bpmn2" | "BPMN" | "BPMN2" | 
"dmn" | "DMN" | "pmml" | "PMML";
-
 // FIXME: Chaging `any` to `EditorEnvelopeLocator` breaks --env live. Please 
adress this as part of https://github.com/apache/incubator-kie-issues/issues/109
 export const EditorEnvelopeLocatorContext = 
React.createContext<EditorEnvelopeLocator>({} as any);
 
diff --git a/packages/online-editor/src/home/HomePage.tsx 
b/packages/online-editor/src/home/HomePage.tsx
index 55004e5f74e..baf12b0b9d7 100644
--- a/packages/online-editor/src/home/HomePage.tsx
+++ b/packages/online-editor/src/home/HomePage.tsx
@@ -23,10 +23,7 @@ import { PageSection } from 
"@patternfly/react-core/dist/js/components/Page";
 import { Text, TextContent, TextVariants } from 
"@patternfly/react-core/dist/js/components/Text";
 import { Title } from "@patternfly/react-core/dist/js/components/Title";
 import { Label } from "@patternfly/react-core/dist/js/components/Label";
-import {
-  SupportedFileExtensions,
-  useEditorEnvelopeLocator,
-} from "../envelopeLocator/hooks/EditorEnvelopeLocatorContext";
+import { useEditorEnvelopeLocator } from 
"../envelopeLocator/hooks/EditorEnvelopeLocatorContext";
 import { useHistory } from "react-router";
 import { Button, ButtonVariant } from 
"@patternfly/react-core/dist/js/components/Button";
 import {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to