fix(editor-ext): stop persisting unfurl data on integration link nodes

This commit is contained in:
Philipinho
2026-08-09 15:35:05 +01:00
parent 99bcf3da9d
commit a351ecd77a
@@ -10,12 +10,12 @@ export interface IntegrationLinkOptions {
export interface IntegrationLinkAttributes {
url: string;
provider: string;
unfurlData: Record<string, any> | null;
status: "pending" | "loaded" | "error";
}
// Shared by IntegrationLink (block) and IntegrationMention (inline) so both
// serialize the same attrs and stay convertible into each other.
// serialize the same attrs and stay convertible into each other. Unfurl data
// is intentionally NOT an attribute: it is fetched per viewer at render time
// so third-party permissions apply on every view.
export function createIntegrationAttributes() {
return {
url: {
@@ -35,31 +35,6 @@ export function createIntegrationAttributes() {
"data-provider": attributes.provider,
}),
},
unfurlData: {
default: null,
parseHTML: (element: HTMLElement) => {
const data = element.getAttribute("data-unfurl");
if (!data) return null;
try {
return JSON.parse(data);
} catch {
return null;
}
},
renderHTML: (attributes: IntegrationLinkAttributes) => ({
"data-unfurl": attributes.unfurlData
? JSON.stringify(attributes.unfurlData)
: null,
}),
},
status: {
default: "pending",
parseHTML: (element: HTMLElement) =>
element.getAttribute("data-status") ?? "pending",
renderHTML: (attributes: IntegrationLinkAttributes) => ({
"data-status": attributes.status,
}),
},
};
}