Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
Fix: Snapshot (#1785)
Eric Hayes0eaca4c78f08
diff --git a/js/app/packages/lexical-core/transformers/index.ts b/js/app/packages/lexical-core/transformers/index.tsindex 99a0c00265..8005c84337 100644--- a/js/app/packages/lexical-core/transformers/index.ts+++ b/js/app/packages/lexical-core/transformers/index.ts@@ -1,7 +1,6 @@import type { Transformer } from '@lexical/markdown';import { I_MACRO_QUOTE } from './classedBlock';import { CUSTOM_TRANSFORMERS } from './customTransformers';-import { E_SNAPSHOT_NODE, I_SNAPSHOT_NODE } from './snapshot';import { I_IMAGE_CONSTRAINED, IMAGE } from './image';import {E_BLOCK_EQUATION_NODE,@@ -24,6 +23,7 @@ import {I_THEME_MENTION,I_USER_MENTION,} from './mentions';+import { E_SNAPSHOT_NODE, I_SNAPSHOT_NODE } from './snapshot';import { E_TABLE_NODE, I_TABLE_NODE } from './tables';import {BR_TAG_TO_LINE_BREAK,@@ -46,6 +46,7 @@ export { isConversionOnlyTransformer };* standard markdown syntax.*/export const INTERNAL_TRANSFORMERS: Transformer[] = [+ I_SNAPSHOT_NODE, // Must be before mentions to avoid matching inner tags in snapshot contentPRESERVE_LINES,LINK_XML, // Prefer internal xml link to handle []() in link textMARK_XML,@@ -64,7 +65,6 @@ export const INTERNAL_TRANSFORMERS: Transformer[] = [I_EQUATION_NODE,I_THEME_MENTION,I_WATERMARK,- I_SNAPSHOT_NODE,...CUSTOM_TRANSFORMERS,UNKNOWN_MENTION, // Must be last to act as fallback for unrecognized XML tags];@@ -101,6 +101,7 @@ export const EXTERNAL_TRANSFORMERS: Transformer[] = [* Complete set of transformers supporting both internal and external markdown operations.*/export const ALL_TRANSFORMERS: Transformer[] = [+ I_SNAPSHOT_NODE, // Must be before mentions to avoid matching inner tags in snapshot contentPRESERVE_LINES,LINK_XML, // Prefer internal xml link to handle []() in link textMARK_XML,@@ -111,6 +112,7 @@ export const ALL_TRANSFORMERS: Transformer[] = [BR_TAG_TO_LINE_BREAK,I_TABLE_NODE,E_TABLE_NODE,+ E_SNAPSHOT_NODE,I_USER_MENTION,E_USER_MENTION,I_GROUP_MENTION,@@ -128,8 +130,6 @@ export const ALL_TRANSFORMERS: Transformer[] = [I_THEME_MENTION,I_WATERMARK,E_WATERMARK,- I_SNAPSHOT_NODE,- E_SNAPSHOT_NODE,// order mattersE_MULTILINE_BLOCK_EQUATION_NODE,E_BLOCK_EQUATION_NODE,diff --git a/js/app/packages/lexical-core/transformers/snapshot.ts b/js/app/packages/lexical-core/transformers/snapshot.tsindex e0e8612a03..b2b75d33e9 100644--- a/js/app/packages/lexical-core/transformers/snapshot.ts+++ b/js/app/packages/lexical-core/transformers/snapshot.ts@@ -18,6 +18,9 @@ export const I_SNAPSHOT_NODE: TextMatchTransformer = {export: (node) => {if (!$isSnapshotNode(node)) return null;+ // Escape angle brackets as unicode escapes so that XML tags inside the+ // content (e.g. <m-document-card>) don't get matched by element+ // transformers during import. JSON.parse handles \u003c/\u003e natively.const data = JSON.stringify({documentId: node.getDocumentId(),documentName: node.getDocumentName(),@@ -25,7 +28,9 @@ export const I_SNAPSHOT_NODE: TextMatchTransformer = {content: node.getContent(),snapshotDate: node.getSnapshotDate(),mentionUuid: node.getMentionUuid(),- });+ })+ .replace(/</g, '\\u003c')+ .replace(/>/g, '\\u003e');return `<m-snapshot>${data}</m-snapshot>`;},