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.

flag(channel/md): flag off document cards in channels until fixed (#1193)

Seamusb37204f88ddc
diff --git a/js/app/packages/block-channel/component/BaseInput.tsx b/js/app/packages/block-channel/component/BaseInput.tsx
index 5bed13a1cc..6cf820d898 100644
--- a/js/app/packages/block-channel/component/BaseInput.tsx
+++ b/js/app/packages/block-channel/component/BaseInput.tsx
@@ -72,6 +72,7 @@ import { useChannelMarkdownArea } from './MarkdownArea';
import { TaskPreviewPanel } from './TaskPreviewPanel';
import { useUserId } from '@core/context/user';
import { isMobile } from '@core/mobile/isMobile';
+import { ENABLE_STATIC_DOCUMENT_CARDS } from '@core/constant/featureFlags';
false && fileFolderDrop;
@@ -372,7 +373,9 @@ export function BaseInput(props: BaseInputProps) {
editor.update(
() => {
$getRoot().markDirty();
- $convertSingleMentionToCard();
+ if (ENABLE_STATIC_DOCUMENT_CARDS) {
+ $convertSingleMentionToCard();
+ }
},
{ discrete: true }
);
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/core/StaticMarkdown.tsx b/js/app/packages/core/component/LexicalMarkdown/component/core/StaticMarkdown.tsx
index e8883dc274..7dcbfbc018 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/core/StaticMarkdown.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/core/StaticMarkdown.tsx
@@ -55,7 +55,10 @@ import {
import { Dynamic } from 'solid-js/web';
import { replaceCitations } from '../../citationsUtils';
import '../../styles.css';
-import { ENABLE_SVG_PREVIEW } from '@core/constant/featureFlags';
+import {
+ ENABLE_STATIC_DOCUMENT_CARDS,
+ ENABLE_SVG_PREVIEW,
+} from '@core/constant/featureFlags';
import type { MarkNode } from '@lexical/mark';
import type { SearchMatchNode } from '@lexical-core/nodes/SearchMatchNode';
import { theme as baseTheme, createTheme } from '../../theme';
@@ -540,12 +543,25 @@ const Equation: RenderableEntity<EquationNode> = {
const DocumentCard: RenderableEntity<DocumentCardNode> = {
guard: (node: LexicalNode): node is DocumentCardNode =>
node.__type === 'document-card',
- render: (props) =>
- DocumentCardDecorator({
- ...props.node.exportComponentProps(),
- key: props.node.getKey(),
- theme: props.theme,
- }),
+ render: (props) => {
+ if (ENABLE_STATIC_DOCUMENT_CARDS) {
+ return DocumentCardDecorator({
+ ...props.node.exportComponentProps(),
+ key: props.node.getKey(),
+ theme: props.theme,
+ });
+ }
+ // TODO (seamus) : temp fix to make existing doc cards in dev look right.
+ return (
+ <p class="my-1.5">
+ {DocumentMentionDecorator({
+ ...props.node.exportComponentProps(),
+ key: props.node.getKey(),
+ theme: props.theme,
+ })}
+ </p>
+ );
+ },
};
// Table rendering components for Lexical tables
diff --git a/js/app/packages/core/constant/featureFlags.ts b/js/app/packages/core/constant/featureFlags.ts
index 9d6bdff98f..d795e22325 100644
--- a/js/app/packages/core/constant/featureFlags.ts
+++ b/js/app/packages/core/constant/featureFlags.ts
@@ -113,3 +113,6 @@ export const ENABLE_CREATE_TASK = true;
export const ENABLE_TASKS_TABS = true;
export const ENABLE_EMAIL_SHARING = true;
+
+// Auto expand stand-alone mentions to richer previews in channels
+export const ENABLE_STATIC_DOCUMENT_CARDS = false;