Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

feat: Obfuscate data-id attributes in Notion page viewer

Cursor Agentc191f7ca7fa5
diff --git a/components/view/viewer/notion-page.tsx b/components/view/viewer/notion-page.tsx
index 4beb997b..b2367c0c 100644
--- a/components/view/viewer/notion-page.tsx
+++ b/components/view/viewer/notion-page.tsx
@@ -81,6 +81,16 @@ const obfuscateNotionIds = (container: HTMLElement) => {
uuidPattern.lastIndex = 0;
});
+ // Obfuscate data-id attributes
+ const elementsWithDataId = container.querySelectorAll("[data-id]");
+ elementsWithDataId.forEach((el) => {
+ const dataId = el.getAttribute("data-id");
+ if (dataId && uuidPattern.test(dataId)) {
+ el.setAttribute("data-id", getObfuscatedId(dataId));
+ }
+ uuidPattern.lastIndex = 0;
+ });
+
// Obfuscate class names that contain Notion IDs
const allElements = container.querySelectorAll("*");
allElements.forEach((el) => {