Skip to content

Commit

Permalink
pass proper editor instance
Browse files Browse the repository at this point in the history
  • Loading branch information
jomarko committed Jan 10, 2025
1 parent 0291e41 commit 7d93fa1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 3 additions & 4 deletions packages/online-editor/src/dmnRunner/DmnRunnerTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ import setObjectValueByPath from "lodash/set";
import cloneDeep from "lodash/cloneDeep";
import { DmnRunnerProviderActionType } from "./DmnRunnerTypes";
import { DmnRunnerExtendedServicesError } from "./DmnRunnerContextProvider";
import { useEditorRef } from "@kie-tools-core/editor/dist/embedded";
import { MessageBusClientApi } from "@kie-tools-core/envelope-bus/dist/api";
import { NewDmnEditorEnvelopeApi } from "@kie-tools/dmn-editor-envelope/dist/NewDmnEditorEnvelopeApi";
import { EmbeddedEditorRef } from "@kie-tools-core/editor/dist/embedded";

export function DmnRunnerTable() {
export function DmnRunnerTable(props: { editor: EmbeddedEditorRef | undefined }) {
// STATEs
const [dmnRunnerTableError, setDmnRunnerTableError] = useState<boolean>(false);
const { editor } = useEditorRef();

// REFs
const [inputsContainerRef, setInputsContainerRef] = useState<HTMLDivElement | null>(null);
Expand Down Expand Up @@ -142,7 +141,7 @@ export function DmnRunnerTable() {
jsonSchemaBridge={jsonSchemaBridge}
results={results}
dmnSpecialCallback={(nodeId: string) => {
const newDmnEditorEnvelopeApi = editor?.getEnvelopeServer()
const newDmnEditorEnvelopeApi = props.editor?.getEnvelopeServer()
.envelopeApi as unknown as MessageBusClientApi<NewDmnEditorEnvelopeApi>;

newDmnEditorEnvelopeApi.notifications.dmnEditor_openBoxedExpressionEditor.send(nodeId);
Expand Down
1 change: 1 addition & 0 deletions packages/online-editor/src/editor/EditorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ Error details: ${err}`);
workspaceFile={file.workspaceFile}
workspaces={workspaces}
dmnLanguageService={dmnLanguageService}
editor={editor}
isEditorReady={editor?.isReady ?? false}
editorValidate={editor?.validate}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { DmnLanguageService } from "@kie-tools/dmn-language-service";
import { DmnRunnerTable } from "../dmnRunner/DmnRunnerTable";
import { ErrorBoundary } from "../reactExt/ErrorBoundary";
import { DmnRunnerErrorBoundary } from "../dmnRunner/DmnRunnerErrorBoundary";
import { EmbeddedEditorRef } from "@kie-tools-core/editor/dist/embedded";

interface EditorPageDockContextType {
panel: PanelId;
Expand Down Expand Up @@ -74,6 +75,7 @@ interface Props {
workspaces: WorkspacesContextType;
dmnLanguageService?: DmnLanguageService;
isEditorReady: boolean;
editor: EmbeddedEditorRef | undefined;
editorValidate?: () => Promise<Notification[]>;
}

Expand All @@ -83,6 +85,7 @@ export function EditorPageDockContextProvider({
workspaces,
workspaceFile,
isEditorReady,
editor,
editorValidate,
}: React.PropsWithChildren<Props>) {
const { i18n } = useOnlineI18n();
Expand Down Expand Up @@ -186,7 +189,7 @@ export function EditorPageDockContextProvider({
case PanelId.DMN_RUNNER_TABLE:
return (
<DmnRunnerErrorBoundary>
<DmnRunnerTable />
<DmnRunnerTable editor={editor} />
</DmnRunnerErrorBoundary>
);
default:
Expand Down

0 comments on commit 7d93fa1

Please sign in to comment.