diff --git a/src/client/create-diagram-dialog/components/create-diagram-dialog.tsx b/src/client/create-diagram-dialog/components/create-diagram-dialog.tsx index e8dee98..ac8a57e 100644 --- a/src/client/create-diagram-dialog/components/create-diagram-dialog.tsx +++ b/src/client/create-diagram-dialog/components/create-diagram-dialog.tsx @@ -26,6 +26,8 @@ const CreateDiagramDialog = () => { useEffect(() => { const handleMessage = async (e: MessageEvent) => { const action = e.data.action; + const type = e.data.type; + if (action === 'save') { const data = e.data.data; const metadata = new URLSearchParams({ @@ -54,6 +56,8 @@ const CreateDiagramDialog = () => { console.error('Error preparing diagram insertion', error); showAlertDialog('Error preparing diagram, please try again'); } + } else if (type === 'mermaid-chart-google-docs-back' && action === 'navigateBack') { + handleDialogClose(); } }; diff --git a/src/client/edit-diagram-dialog/components/edit-diagram-dialog.tsx b/src/client/edit-diagram-dialog/components/edit-diagram-dialog.tsx index 511772a..91f8e83 100644 --- a/src/client/edit-diagram-dialog/components/edit-diagram-dialog.tsx +++ b/src/client/edit-diagram-dialog/components/edit-diagram-dialog.tsx @@ -45,6 +45,8 @@ const EditDiagramDialog = () => { useEffect(() => { const handleMessage = async (e: MessageEvent) => { const action = e.data.action; + const type = e.data.type; + console.log('action', action); if (action === 'save') { const data = e.data.data; @@ -73,6 +75,8 @@ const EditDiagramDialog = () => { console.error('Error preparing diagram update', error); showAlertDialog('Error preparing diagram update, please try again'); } + } else if (type === 'mermaid-chart-google-docs-back' && action === 'navigateBack') { + handleDialogClose(); } }; diff --git a/src/client/select-diagram-dialog/components/select-diagram-dialog.tsx b/src/client/select-diagram-dialog/components/select-diagram-dialog.tsx index c613671..03acb61 100644 --- a/src/client/select-diagram-dialog/components/select-diagram-dialog.tsx +++ b/src/client/select-diagram-dialog/components/select-diagram-dialog.tsx @@ -26,7 +26,7 @@ const SelectDiagramDialog = () => { return; } const url = buildUrl( - '/app/plugins/select?pluginSource=googledocs', + '/app/plugins/confluence/select?pluginSource=googledocs', authState.token ); setDiagramsUrl(url); @@ -35,6 +35,8 @@ const SelectDiagramDialog = () => { useEffect(() => { const handleMessage = async (e: MessageEvent) => { const action = e.data.action; + const type = e.data.type; + if (action === 'save') { const data = e.data.data; const metadata = new URLSearchParams({ @@ -63,6 +65,9 @@ const SelectDiagramDialog = () => { showAlertDialog('Error preparing diagram, please try again'); console.error('Error preparing diagram insertion', error); } + } else if (type === 'mermaid-chart-google-docs-back' && action === 'navigateBack') { + // Handle back navigation from the iframe - close the dialog + handleDialogClose(); } };