Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(tasks): allow go to location for task snippets (#2622)

Seamus41199d41c4d8
diff --git a/js/app/packages/core/component/DocumentPreview.tsx b/js/app/packages/core/component/DocumentPreview.tsx
index c5ccbb796e..1c91db498f 100644
--- a/js/app/packages/core/component/DocumentPreview.tsx
+++ b/js/app/packages/core/component/DocumentPreview.tsx
@@ -39,6 +39,7 @@ import LoadingSpinner from '@icon/regular/spinner.svg';
import TrashSimple from '@icon/regular/trash-simple.svg';
import MacroEmbed from '@macro-icons/macro-embed.svg';
import { useBinaryDocumentQuery } from '@queries/storage/binary-document';
+import { isBlockNameWithLocation } from '@core/component/LexicalMarkdown/component/core/BlockLink';
import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
import { channelTheme } from '@core/component/LexicalMarkdown/theme';
import { UserIcon as UserIconComponent } from '@core/component/UserIcon';
@@ -557,12 +558,12 @@ export function PopupPreview(props: {
});
}
- if (props.documentInfo.type !== 'channel') return;
+ if (!isBlockNameWithLocation(props.documentInfo.type)) return;
const orchestrator = splitManager.getOrchestrator();
const handle = await orchestrator.getBlockHandle(
props.documentInfo.id,
- 'channel'
+ props.documentInfo.type
);
await handle?.goToLocationFromParams(props.documentInfo.params);
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/core/BlockLink.tsx b/js/app/packages/core/component/LexicalMarkdown/component/core/BlockLink.tsx
index be18680cd4..919999be31 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/core/BlockLink.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/core/BlockLink.tsx
@@ -13,10 +13,13 @@ export const blockNamesWithLocations = [
'md',
'email',
'chat',
+ 'task',
] as const;
export type BlockNameWithLocations = (typeof blockNamesWithLocations)[number];
-function isBlockNameWithLocation(name: string): name is BlockNameWithLocations {
+export function isBlockNameWithLocation(
+ name: string
+): name is BlockNameWithLocations {
return blockNamesWithLocations.includes(name as BlockNameWithLocations);
}