From 067e0a06bf3a2c12290ce52a7893a3734426c178 Mon Sep 17 00:00:00 2001 From: thecalcc Date: Tue, 31 Oct 2023 09:03:51 +0200 Subject: [PATCH] Fix superdesk-api so it's compatible with planning develop --- scripts/core/get-superdesk-api-implementation.tsx | 4 ++++ scripts/core/superdesk-api.d.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/scripts/core/get-superdesk-api-implementation.tsx b/scripts/core/get-superdesk-api-implementation.tsx index 28a8377aee..cb644addfa 100644 --- a/scripts/core/get-superdesk-api-implementation.tsx +++ b/scripts/core/get-superdesk-api-implementation.tsx @@ -106,6 +106,7 @@ import {tryLocking, tryUnlocking} from './helpers/locking-helpers'; import {showPopup} from './ui/components/popupNew'; import {Card} from './ui/components/Card'; import {getTextColor} from './helpers/utils'; +import {showModal} from '@superdesk/common'; function getContentType(id): Promise { return dataApi.findOne('content_types', id); @@ -344,6 +345,9 @@ export function getSuperdeskApiImplementation( }, prepareExternalImageForDroppingToEditor, }, + showModal: (Component: React.ComponentType<{closeModal(): void}>, containerClass?: string) => { + return showModal(Component, containerClass); + }, alert: (message: string) => modal.alert({bodyText: message}), confirm: (message: string, title?: string) => new Promise((resolve) => { modal.confirm(message, title ?? gettext('Confirm')) diff --git a/scripts/core/superdesk-api.d.ts b/scripts/core/superdesk-api.d.ts index 90024bbf43..c9be4cf1b3 100644 --- a/scripts/core/superdesk-api.d.ts +++ b/scripts/core/superdesk-api.d.ts @@ -2662,6 +2662,7 @@ declare module 'superdesk-api' { additionalData?: Partial, ): void; }; + showModal: (Component: React.ComponentType<{closeModal(): void;}>, containerClass?: string) => Promise; alert(message: string): Promise; confirm(message: string, title?: string): Promise; showIgnoreCancelSaveDialog(props: IIgnoreCancelSaveProps): Promise;